diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-05-13 23:07:29 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-05-13 23:07:29 -0400 |
commit | 22339188e7fac70362f024402ae873f51a36d578 (patch) | |
tree | d462003da8f62ebea3ceab3aea541453fcf13537 /IkiWiki | |
parent | 239cd95db7f1ec378384d3b97035f0a359ffc122 (diff) | |
download | ikiwiki-22339188e7fac70362f024402ae873f51a36d578.tar ikiwiki-22339188e7fac70362f024402ae873f51a36d578.tar.gz |
allow adminuser to be an email address
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Setup/Automator.pm | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/IkiWiki/Setup/Automator.pm b/IkiWiki/Setup/Automator.pm index a8b04d966..9239974ad 100644 --- a/IkiWiki/Setup/Automator.pm +++ b/IkiWiki/Setup/Automator.pm @@ -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"); + } } } |