From c16b1e638e3ccc936ec24daa8419d64c4f6d5016 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 2 Apr 2012 12:29:13 -0400 Subject: [PATCH] support do=tokenauth login for passwordless accounts --- IkiWiki/Plugin/passwordauth.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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"); -- 2.26.2