Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
Changing the code to user more getters
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Jan 24, 2017
1 parent b9f5e87 commit b9247eb
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Model/Behavior/UserBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public function initPasswordReset($value, $options = []) {
$defaults = [
'field' => [
$this->_table->aliasField($this->_field('email')),
$this->_table->alias($this->_field('username'))
$this->_table->aliasField($this->_field('username'))
]
];

Expand All @@ -553,12 +553,15 @@ public function initPasswordReset($value, $options = []) {
throw new RecordNotFoundException(__d('burzum/user_tools', 'User not found.'));
}

$result->{$this->_field('passwordToken')} = $this->generateToken($options['tokenLength']);
$result->{$this->_field('passwordTokenExpires')} = $this->expirationTime($options['expires']);
$result->set($this->_field('passwordToken'), $this->generateToken($options['tokenLength']));
$result->set($this->_field('passwordTokenExpires'), $this->expirationTime($options['expires']));

if (!$this->_table->save($result, ['checkRules' => false])) {
new RuntimeException('Could not initialize password reset. Data could not be saved.');
}

$this->_table->save($result, ['checkRules' => false]);
$this->sendPasswordResetToken($result, [
'to' => $result->{$this->_field('email')}
'to' => $result->get($this->_field('email'))
]);
}

Expand Down

0 comments on commit b9247eb

Please sign in to comment.