]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/passwordauth.pm
Merge branch 'master' into debian-jessie-backports
[git.ikiwiki.info.git] / IkiWiki / Plugin / passwordauth.pm
index 0cf2a26ea99380b6dd395824945bfcebd42c33b9..c966087ce75039baa9f1492a81976de4502936fd 100644 (file)
@@ -231,7 +231,7 @@ sub formbuilder_setup (@) {
                                $form->field(
                                        name => "password",
                                        validate => sub {
-                                               checkpassword($form->field("name"), shift);
+                                               checkpassword(scalar $form->field("name"), shift);
                                        },
                                );
                        }
@@ -251,6 +251,12 @@ sub formbuilder_setup (@) {
                                                my $name=shift;
                                                length $name &&
                                                $name=~/$config{wiki_file_regexp}/ &&
+                                               # don't allow registering
+                                               # accounts that look like
+                                               # openids, or email
+                                               # addresses, even if the
+                                               # file regexp allows it
+                                               $name!~/[\/:\@]/ &&
                                                ! IkiWiki::userinfo_get($name, "regdate");
                                        },
                                );
@@ -277,7 +283,7 @@ sub formbuilder_setup (@) {
        }
        elsif ($form->title eq "preferences") {
                my $user=$session->param("name");
-               if (! IkiWiki::openiduser($user)) {
+               if (! IkiWiki::openiduser($user) && ! IkiWiki::emailuser($user)) {
                        $form->field(name => "name", disabled => 1, 
                                value => $user, force => 1,
                                fieldset => "login");
@@ -389,7 +395,7 @@ sub formbuilder (@) {
                if ($form->submitted eq "Save Preferences" && $form->validate) {
                        my $user_name=$form->field('name');
                        if (defined $form->field("password") && length $form->field("password")) {
-                               setpassword($user_name, $form->field('password'));
+                               setpassword($user_name, scalar $form->field('password'));
                        }
                }
        }