Open duncanmcclean opened 4 years ago
I have managed to make a hacky solution that works for now as it was rather annoying the client.
In the Statamic\Data\Users\Redis\User
class, I rewrote the setPasswordResetToken and
getPasswordResetToken` methods to look like this.
public function setPasswordResetToken($token)
{
$this->set('password_reset_token', $token);
$yaml = YAML::parse(File::get($this->passwordResetPath(), ''));
$yaml[$this->id()] = $token;
$yaml = array_filter($yaml);
File::put($this->passwordResetPath(), YAML::dump($yaml));
}
private function passwordResetPath()
{
return cache_path('password_resets.yaml');
}
/**
* Get the reset token/code for a password reset
*
* @return string
*/
public function getPasswordResetToken()
{
$yaml = YAML::parse(File::get($this->passwordResetPath(), ''));
return array_get($yaml, $this->id());
}
I'm not sure if this really is a Statamic bug or something that we're doing wrong when using Redis.
Describe the bug When you have the user driver set to
redis
and you request a password reset, an email is sent however the token is invalid.To Reproduce Steps to reproduce the behavior:
redis
insite/settings/users.yaml
Expected behavior Instead of erroring out saying the token is invalid, it should accept the token and allow the user to reset their password.
Screenshots![image](https://user-images.githubusercontent.com/19637309/74374361-25c18100-4dd6-11ea-9225-990677ca348f.png)
Environment details (please complete the following information):
Additional context Add any other context about the problem here.