summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm22
-rw-r--r--IkiWiki/Wrapper.pm2
2 files changed, 23 insertions, 1 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index f550b673a..b42489210 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -314,6 +314,11 @@ sub cgi_prefs ($$) { #{{{
if (! is_admin($user_name)) {
$form->field(name => "locked_pages", type => "hidden");
}
+
+ if ($config{httpauth}) {
+ $form->field(name => "password", type => "hidden");
+ $form->field(name => "confirm_password", type => "hidden");
+ }
if (! $form->submitted) {
$form->field(name => "email", force => 1,
@@ -643,6 +648,7 @@ sub cgi () { #{{{
# Everything below this point needs the user to be signed in.
if (((! $config{anonok} || $do eq 'prefs') &&
+ (! $config{httpauth}) &&
(! defined $session->param("name") ||
! userinfo_get($session->param("name"), "regdate"))) || $do eq 'signin') {
cgi_signin($q, $session);
@@ -654,6 +660,22 @@ sub cgi () { #{{{
return;
}
+
+ if ($config{httpauth} && (! defined $session->param("name"))) {
+ if (! defined $q->remote_user()) {
+ error("Could not determine authenticated username.");
+ }
+ else {
+ $session->param("name", $q->remote_user());
+ if (!userinfo_get($session->param("name"),"regdate")) {
+ userinfo_setall($session->param("name"), {
+ email => "",
+ password => "",
+ regdate=>time,
+ });
+ }
+ }
+ }
if ($do eq 'create' || $do eq 'edit') {
cgi_editpage($q, $session);
diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm
index 4a98af622..a3ecccd5b 100644
--- a/IkiWiki/Wrapper.pm
+++ b/IkiWiki/Wrapper.pm
@@ -28,7 +28,7 @@ sub gen_wrapper () { #{{{
my @envsave;
push @envsave, qw{REMOTE_ADDR QUERY_STRING REQUEST_METHOD REQUEST_URI
CONTENT_TYPE CONTENT_LENGTH GATEWAY_INTERFACE
- HTTP_COOKIE} if $config{cgi};
+ HTTP_COOKIE REMOTE_USER} if $config{cgi};
my $envsave="";
foreach my $var (@envsave) {
$envsave.=<<"EOF"