]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
allow adminuser to be an email address
authorJoey Hess <joeyh@joeyh.name>
Thu, 14 May 2015 03:07:29 +0000 (23:07 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 14 May 2015 03:07:29 +0000 (23:07 -0400)
IkiWiki/Setup/Automator.pm
auto.setup

index a8b04d9669eb649d45dd68852bd3eedbf2c14889..9239974adece99801b4c008f33932ad633755ed9 100644 (file)
@@ -154,31 +154,33 @@ sub import (@) {
        foreach my $admin (@{$config{adminuser}}) {
                next if defined IkiWiki::openiduser($admin);
                
-               # Prompt for password w/o echo.
-               my ($password, $password2);
-               system('stty -echo 2>/dev/null');
-               local $|=1;
-               print "\n\nCreating wiki admin $admin ...\n";
-               for (;;) {
-                       print "Choose a password: ";
-                       chomp($password=<STDIN>);
-                       print "\n";
-                       print "Confirm password: ";
-                       chomp($password2=<STDIN>);
-
-                       last if $password2 eq $password;
-
-                       print "Password mismatch.\n\n";
-               }
-               print "\n\n\n";
-               system('stty sane 2>/dev/null');
+               if (! defined IkiWiki::emailuser($admin)) {
+                       # Prompt for password w/o echo.
+                       my ($password, $password2);
+                       system('stty -echo 2>/dev/null');
+                       local $|=1;
+                       print "\n\nCreating wiki admin $admin ...\n";
+                       for (;;) {
+                               print "Choose a password: ";
+                               chomp($password=<STDIN>);
+                               print "\n";
+                               print "Confirm password: ";
+                               chomp($password2=<STDIN>);
+       
+                               last if $password2 eq $password;
+       
+                               print "Password mismatch.\n\n";
+                       }
+                       print "\n\n\n";
+                       system('stty sane 2>/dev/null');
 
-               if (IkiWiki::userinfo_setall($admin, { regdate => time }) &&
-                   IkiWiki::Plugin::passwordauth::setpassword($admin, $password)) {
-                       IkiWiki::userinfo_set($admin, "email", $config{adminemail}) if defined $config{adminemail};
-               }
-               else {
-                       error("problem setting up $admin user");
+                       if (IkiWiki::userinfo_setall($admin, { regdate => time }) &&
+                           IkiWiki::Plugin::passwordauth::setpassword($admin, $password)) {
+                               IkiWiki::userinfo_set($admin, "email", $config{adminemail}) if defined $config{adminemail};
+                       }
+                       else {
+                               error("problem setting up $admin user");
+                       }
                }
        }
        
index 843b4193aba78f2312f84e3c62cd273274f04438..1bcac36cb31c799f8a85aa90b41d2f4408019534 100644 (file)
@@ -18,7 +18,7 @@ our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
 our $rcs=IkiWiki::Setup::Automator::ask(
        gettext("What revision control system to use?"), "git");
 our $admin=IkiWiki::Setup::Automator::ask(
-       gettext("Which user (wiki account or openid) will be admin?"), $ENV{USER});
+       gettext("Which user (wiki account, openid, or email) will be admin?"), $ENV{USER});
 use Net::Domain q{hostfqdn};
 our $domain=hostfqdn() || IkiWiki::Setup::Automator::ask(
        gettext("What is the domain name of the web server?"), "");