Debugging 'recover password'

db4
Slava Pestov 2008-06-18 02:52:49 -05:00
parent ef29b725b8
commit 1260a87468
4 changed files with 18 additions and 18 deletions

View File

@ -6,7 +6,7 @@
<p>Enter the username and e-mail address you used to register for this site, and you will receive a link for activating a new password.</p> <p>Enter the username and e-mail address you used to register for this site, and you will receive a link for activating a new password.</p>
<t:form t:action="recover-password"> <t:form t:action="$realm/recover-password">
<table> <table>

View File

@ -6,7 +6,7 @@
<p>Choose a new password for your account.</p> <p>Choose a new password for your account.</p>
<t:form t:action="new-password"> <t:form t:action="$realm/recover-3">
<table> <table>

View File

@ -4,6 +4,6 @@
<t:title>Recover lost password: step 4 of 4</t:title> <t:title>Recover lost password: step 4 of 4</t:title>
<p>Your password has been reset. You may now <t:a t:href="login">log in</t:a>.</p> <p>Your password has been reset. You may now <t:a t:href="$realm">proceed</t:a>.</p>
</t:chloe> </t:chloe>

View File

@ -1,8 +1,9 @@
! Copyright (c) 2008 Slava Pestov. ! Copyright (c) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: namespaces accessors kernel assocs arrays io.sockets threads USING: namespaces accessors kernel assocs arrays io.sockets threads
fry urls smtp validators html.forms fry urls smtp validators html.forms present
http http.server.responses http.server.dispatchers http http.server.responses http.server.redirection
http.server.dispatchers
furnace furnace.actions furnace.auth furnace.auth.providers furnace furnace.actions furnace.auth furnace.auth.providers
furnace.redirection ; furnace.redirection ;
IN: furnace.auth.features.recover-password IN: furnace.auth.features.recover-password
@ -13,13 +14,12 @@ SYMBOL: lost-password-from
request get url>> host>> host-name or ; request get url>> host>> host-name or ;
: new-password-url ( user -- url ) : new-password-url ( user -- url )
"recover-3" URL" recover-3" clone
swap [ swap
[ username>> "username" set ] [ username>> "username" set-query-param ]
[ ticket>> "ticket" set ] [ ticket>> "ticket" set-query-param ]
bi bi
] H{ } make-assoc adjust-url relative-to-request ;
derive-url ;
: password-email ( user -- email ) : password-email ( user -- email )
<email> <email>
@ -35,7 +35,7 @@ SYMBOL: lost-password-from
"If you believe that this request was legitimate, you may click the below link in\n" % "If you believe that this request was legitimate, you may click the below link in\n" %
"your browser to set a new password for your account:\n" % "your browser to set a new password for your account:\n" %
"\n" % "\n" %
swap new-password-url % swap new-password-url present %
"\n\n" % "\n\n" %
"Love,\n" % "Love,\n" %
"\n" % "\n" %
@ -48,7 +48,7 @@ SYMBOL: lost-password-from
: <recover-action-1> ( -- action ) : <recover-action-1> ( -- action )
<page-action> <page-action>
{ realm "recover-1" } >>template { realm "features/recover-password/recover-1" } >>template
[ [
{ {
@ -64,12 +64,12 @@ SYMBOL: lost-password-from
send-password-email send-password-email
] when* ] when*
URL" $login/recover-2" <redirect> URL" $realm/recover-2" <redirect>
] >>submit ; ] >>submit ;
: <recover-action-2> ( -- action ) : <recover-action-2> ( -- action )
<page-action> <page-action>
{ realm "recover-2" } >>template ; { realm "features/recover-password/recover-2" } >>template ;
: <recover-action-3> ( -- action ) : <recover-action-3> ( -- action )
<page-action> <page-action>
@ -80,7 +80,7 @@ SYMBOL: lost-password-from
} validate-params } validate-params
] >>init ] >>init
{ realm "recover-3" } >>template { realm "features/recover-password/recover-3" } >>template
[ [
{ {
@ -100,7 +100,7 @@ SYMBOL: lost-password-from
"new-password" value >>encoded-password "new-password" value >>encoded-password
users update-user users update-user
URL" $login/recover-4" <redirect> URL" $realm/recover-4" <redirect>
] [ ] [
<403> <403>
] if* ] if*
@ -108,7 +108,7 @@ SYMBOL: lost-password-from
: <recover-action-4> ( -- action ) : <recover-action-4> ( -- action )
<page-action> <page-action>
{ realm "recover-4" } >>template ; { realm "features/recover-password/recover-4" } >>template ;
: allow-password-recovery ( login -- login ) : allow-password-recovery ( login -- login )
<recover-action-1> <auth-boilerplate> <recover-action-1> <auth-boilerplate>