allow adminuser to be an email address
parent
239cd95db7
commit
22339188e7
|
@ -154,31 +154,33 @@ sub import (@) {
|
||||||
foreach my $admin (@{$config{adminuser}}) {
|
foreach my $admin (@{$config{adminuser}}) {
|
||||||
next if defined IkiWiki::openiduser($admin);
|
next if defined IkiWiki::openiduser($admin);
|
||||||
|
|
||||||
# Prompt for password w/o echo.
|
if (! defined IkiWiki::emailuser($admin)) {
|
||||||
my ($password, $password2);
|
# Prompt for password w/o echo.
|
||||||
system('stty -echo 2>/dev/null');
|
my ($password, $password2);
|
||||||
local $|=1;
|
system('stty -echo 2>/dev/null');
|
||||||
print "\n\nCreating wiki admin $admin ...\n";
|
local $|=1;
|
||||||
for (;;) {
|
print "\n\nCreating wiki admin $admin ...\n";
|
||||||
print "Choose a password: ";
|
for (;;) {
|
||||||
chomp($password=<STDIN>);
|
print "Choose a password: ";
|
||||||
print "\n";
|
chomp($password=<STDIN>);
|
||||||
print "Confirm password: ";
|
print "\n";
|
||||||
chomp($password2=<STDIN>);
|
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');
|
||||||
|
|
||||||
last if $password2 eq $password;
|
if (IkiWiki::userinfo_setall($admin, { regdate => time }) &&
|
||||||
|
IkiWiki::Plugin::passwordauth::setpassword($admin, $password)) {
|
||||||
print "Password mismatch.\n\n";
|
IkiWiki::userinfo_set($admin, "email", $config{adminemail}) if defined $config{adminemail};
|
||||||
}
|
}
|
||||||
print "\n\n\n";
|
else {
|
||||||
system('stty sane 2>/dev/null');
|
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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ our $wikiname_short=IkiWiki::Setup::Automator::sanitize_wikiname($wikiname);
|
||||||
our $rcs=IkiWiki::Setup::Automator::ask(
|
our $rcs=IkiWiki::Setup::Automator::ask(
|
||||||
gettext("What revision control system to use?"), "git");
|
gettext("What revision control system to use?"), "git");
|
||||||
our $admin=IkiWiki::Setup::Automator::ask(
|
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};
|
use Net::Domain q{hostfqdn};
|
||||||
our $domain=hostfqdn() || IkiWiki::Setup::Automator::ask(
|
our $domain=hostfqdn() || IkiWiki::Setup::Automator::ask(
|
||||||
gettext("What is the domain name of the web server?"), "");
|
gettext("What is the domain name of the web server?"), "");
|
||||||
|
|
Loading…
Reference in New Issue