<div dir="ltr">Hi Richard,<div><br></div><div>[Without knowing the full state diagram of the site you're setting up I'm not sure I'm really answering your question, however...]</div><div><br></div><div>What I can say is that when you send someone an email with a link to click, the corresponding GET route handler should *not* be assuming there's a session for that user since the web server's session cache may have been cleared before they respond to the email.</div><div><br></div><div>If you want the token attached to the user so that when they click on the link you know who's visiting, you should store the token in your database against the user's account.</div><div><br></div><div>Does that answer your question?</div><div><br></div><div>Andrew</div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 17, 2015 at 1:16 AM, Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div class="gmail_extra"><br><div class="gmail_quote">2015-09-16 16:46 GMT-05:00 Andrew Solomon <span dir="ltr"><<a href="mailto:andrew@geekuni.com" target="_blank">andrew@geekuni.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Richard<div><br></div><div>Firstly with the GET request when you click on this</div><div><br></div><div><span style="font-size:12.8px"> </span><a href="http://myapp.com/resetJiOk49ld9oekdisJkflSS3ed" style="font-size:12.8px" target="_blank">http://myapp.com/reset/JiOk49ld9oekdisJkflSS3ed</a><br></div><div><br></div><div>your route handler will be something like this (note ':' instead of '$'):</div><div><br></div><div>get '/reset/:token' => sub {</div><div><br></div><div>  return template 'pass_reset' => {</div><div>    token => params->{token}</div><div>  };</div><div><br></div><div>};</div><div><br></div><div>This template views/<a href="http://pass_reset.tt" target="_blank">pass_reset.tt</a> will contain something like</div><div><br></div><div><div><form action="/reset/[% token %]" method="post"></div><div>  <input type="password" name="password1"><br/></div><div>  <input type="password" name="password2"><br/></div><div>  <input type="submit" value="Submit"></div><div></form></div><div><br></div></div><div><br></div><div>and back in the controller on clicking submit, it will be handled by</div><div><br></div><div><div>post '/reset/:token' => sub {</div><div><br></div><div>   # do something to check params->{password1} eq params->{password2} ...</div><div><br></div><div>};</div></div><div><br></div><div><br></div><div>(Please imagine the code above is scribbled on a blackboard - I haven't run it:)</div><div><br></div><div>Andrew</div></div><div class="gmail_extra"><br></div></blockquote></div><br></div></span><div class="gmail_extra">Hi Andrew,<br><br></div><div class="gmail_extra">Thank you for the reply. For the value of token in the url '/reset/:token' do I first set the value of token with <br></div><div class="gmail_extra"><br></div><div class="gmail_extra">my $token = get_token(); # subroutine that returns generated token<br></div><div class="gmail_extra"><br>session username => $token; <br><br>so that it matches the url<a href="http://myapp.com/resetJiOk49ld9oekdisJkflSS3ed" style="font-size:12.8px" target="_blank">JiOk49ld9oekdisJkflSS3ed</a> link that was sent to the user in the email?<br><br></div></div>
<br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Andrew Solomon<div><br></div><div>Mentor@Geekuni <a href="http://geekuni.com/" target="_blank">http://geekuni.com/</a></div><div><a href="http://www.linkedin.com/in/asolomon" target="_blank">http://www.linkedin.com/in/asolomon</a><br></div></div></div>
</div>