summaryrefslogtreecommitdiff
path: root/actions/recoverpassword.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2008-08-29 01:28:24 -0400
committerZach Copley <zach@controlyourself.ca>2008-08-29 01:28:24 -0400
commit47726844a0ceef6fc4697aca710c8e1bee5bf7f5 (patch)
tree0b594c9d5c14677961ee4819a4becc364883f264 /actions/recoverpassword.php
parent98e941753bab2a4c04da1302f26300cb7d6ff364 (diff)
CSRF protection in recoverpassword
darcs-hash:20080829052824-7b5ce-39a8fd299b7a85793ad7a19fe00c93813ca882b6.gz
Diffstat (limited to 'actions/recoverpassword.php')
-rw-r--r--actions/recoverpassword.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index 444dd1f2a..0f3901543 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -176,6 +176,7 @@ class RecoverpasswordAction extends Action {
common_element_start('form', array('method' => 'post',
'id' => 'recoverpassword',
'action' => common_local_url('recoverpassword')));
+ common_hidden('token', common_session_token());
common_password('newpassword', _('New password'),
_('6 or more characters, and don\'t forget it!'));
common_password('confirm', _('Confirm'),
@@ -270,6 +271,13 @@ class RecoverpasswordAction extends Action {
function reset_password() {
+ # CSRF protection
+ $token = $this->trimmed('token');
+ if (!$token || $token != common_session_token()) {
+ $this->show_form(_('There was a problem with your session token. Try again, please.'));
+ return;
+ }
+
$user = $this->get_temp_user();
if (!$user) {