Skip to content

Commit

Permalink
prevent predictability of recovery token InvoicePlane#733
Browse files Browse the repository at this point in the history
  • Loading branch information
naui95 committed Jun 11, 2022
1 parent 320e5fb commit 95068f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions application/modules/sessions/controllers/Sessions.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,12 @@ public function passwordreset($token = null)
}

// Test if a user with this email exists
if ($this->db->where('user_email', $email)) {
// Create a passwordreset token
if ($recovery_result = $this->db->where('user_email', $email)) {
// Create a passwordreset token.
$email = $this->input->post('email');
$token = md5(time() . $email);
//get salt to make unique the reset token
$this->load->library('crypt');
$token = md5(time() . $email . $this->crypt->salt());

// Save the token to the database and set the user to inactive
$db_array = array(
Expand Down

0 comments on commit 95068f2

Please sign in to comment.