There's no real problem if they do change it, except they may get confused
and expect to be able to log in with the changed email and get the same
user account.
sub import {
hook(type => "getsetup", id => "emailauth", "call" => \&getsetup);
sub import {
hook(type => "getsetup", id => "emailauth", "call" => \&getsetup);
- hook(type => "cgi", id => "cgi", "call" => \&cgi);
+ hook(type => "cgi", id => "emailauth", "call" => \&cgi);
+ hook(type => "formbuilder_setup", id => "emailauth", "call" => \&formbuilder_setup);
IkiWiki::loadplugin("loginselector");
IkiWiki::Plugin::loginselector::register_login_plugin(
"emailauth",
IkiWiki::loadplugin("loginselector");
IkiWiki::Plugin::loginselector::register_login_plugin(
"emailauth",
+sub formbuilder_setup (@) {
+ my %params=@_;
+ my $form=$params{form};
+ my $session=$params{session};
+
+ if ($form->title eq "preferences" &&
+ IkiWiki::emailuser($session->param("name"))) {
+ $form->field(name => "email", disabled => 1);
+ }
+}
+
# Generates the token that will be used in the authurl to log the user in.
# This needs to be hard to guess, and relatively short. Generating a cgi
# session id will make it as hard to guess as any cgi session.
# Generates the token that will be used in the authurl to log the user in.
# This needs to be hard to guess, and relatively short. Generating a cgi
# session id will make it as hard to guess as any cgi session.