]> sipb.mit.edu Git - ikiwiki.git/commitdiff
add support for a passwordless login token
authorJoey Hess <joey@kitenet.net>
Mon, 2 Apr 2012 16:17:07 +0000 (12:17 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 2 Apr 2012 16:17:07 +0000 (12:17 -0400)
The plan is to use this for accounts that are created implicitly, as when
a non-logged-in user subscribes to notifyemail. Such an account has no
password, and login can be accomplished by way of a url that is sent to
them in email.

When the user sets a password, the passwordless login token is disabled.

IkiWiki/Plugin/passwordauth.pm

index c167f52b5c2d11586325cfc1d51a9a3825614f9e..6a5153efd0d3be38add31947238182862aa9cc02 100644 (file)
@@ -96,6 +96,12 @@ sub setpassword ($$;$) {
        else {
                IkiWiki::userinfo_set($user, $field, $password);
        }
        else {
                IkiWiki::userinfo_set($user, $field, $password);
        }
+
+       # Setting the password clears any passwordless login token.
+       if ($field ne 'passwordless') {
+               IkiWiki::userinfo_set($user, "cryptpasswordless", "");
+               IkiWiki::userinfo_set($user, "passwordless", "");
+       }
 }
 
 sub formbuilder_setup (@) {
 }
 
 sub formbuilder_setup (@) {