Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24h wait period before next password reset email request / send #2295

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion oc-includes/osclass/UserActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,15 @@ function recover_password()
return 1;
}

$code = osc_genRandomPassword(30);
$date = date('Y-m-d H:i:s');
$pass_date = $user['s_pass_date'];

if( !empty($user['s_pass_code']) && ((strtotime($date) - strtotime($pass_date)) < 60*60*24) ) {
return 3;
}

$code = osc_genRandomPassword(30);

User::newInstance()->update(
array('s_pass_code' => $code, 's_pass_date' => $date, 's_pass_ip' => Params::getServerParam('REMOTE_ADDR')),
array('pk_i_id' => $user['pk_i_id'])
Expand Down
4 changes: 4 additions & 0 deletions oc-includes/osclass/controller/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ function doModel()
osc_add_flash_error_message( _m('The recaptcha code is wrong'));
$this->redirectTo( osc_recover_user_password_url() );
break;
case(3): // prevent multiple requests in 24 hours interval
osc_add_flash_error_message( _m('You have already requested a password reset. Please wait 24 hours to make another one.'));
$this->redirectTo( osc_user_login_url() );
break;
}
break;
case('forgot'): //form to recover the password (in this case we have the form in /gui/)
Expand Down