aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2012-04-02 12:29:13 -0400
committerJoey Hess <joey@kitenet.net>2012-04-02 12:29:13 -0400
commitc16b1e638e3ccc936ec24daa8419d64c4f6d5016 (patch)
treed2feaa3059ed3420fb8c502104b7da6ad66b502a
parentf9e96b0c32ea7db069c718020f65174ad0bcc1d7 (diff)
downloadikiwiki-c16b1e638e3ccc936ec24daa8419d64c4f6d5016.tar
ikiwiki-c16b1e638e3ccc936ec24daa8419d64c4f6d5016.tar.gz
support do=tokenauth login for passwordless accounts
-rw-r--r--IkiWiki/Plugin/passwordauth.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm
index ac955dc50..ea6ed158a 100644
--- a/IkiWiki/Plugin/passwordauth.pm
+++ b/IkiWiki/Plugin/passwordauth.pm
@@ -362,6 +362,22 @@ sub sessioncgi ($$) {
IkiWiki::cgi_prefs($q, $session);
exit;
}
+ elsif ($q->param('do') eq 'tokenauth') {
+ my $name=$q->param("name");
+ my $token=$q->param("token");
+
+ if (! defined $name || ! defined $token ||
+ ! length $name || ! length $token) {
+ error(gettext("incorrect url"));
+ }
+ if (! checkpassword($name, $token, "passwordless")) {
+ error(gettext("access denied"));
+ }
+
+ $session->param("name", $name);
+ IkiWiki::cgi_prefs($q, $session);
+ exit;
+ }
elsif ($q->param("do") eq "register") {
# After registration, need to go somewhere, so show prefs page.
$session->param(postsignin => "do=prefs");