Commit ee9ab16d authored by xjm's avatar xjm

Issue #2477641 by opdavies, pguillard, kaypro4, gyuhyon, edutrul, yoroy:...

Issue #2477641 by opdavies, pguillard, kaypro4, gyuhyon, edutrul, yoroy: One-time login link failure messages are misleading because they are not marked as errors
parent b58943a0
...@@ -99,7 +99,7 @@ public function resetPass($uid, $timestamp, $hash) { ...@@ -99,7 +99,7 @@ public function resetPass($uid, $timestamp, $hash) {
else { else {
if ($reset_link_user = $this->userStorage->load($uid)) { if ($reset_link_user = $this->userStorage->load($uid)) {
drupal_set_message($this->t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href="@logout">logout</a> and try using the link again.', drupal_set_message($this->t('Another user (%other_user) is already logged into the site on this computer, but you tried to use a one-time link for user %resetting_user. Please <a href="@logout">logout</a> and try using the link again.',
array('%other_user' => $account->getUsername(), '%resetting_user' => $reset_link_user->getUsername(), '@logout' => $this->url('user.logout')))); array('%other_user' => $account->getUsername(), '%resetting_user' => $reset_link_user->getUsername(), '@logout' => $this->url('user.logout'))), 'warning');
} }
else { else {
// Invalid one-time link specifies an unknown user. // Invalid one-time link specifies an unknown user.
...@@ -120,7 +120,7 @@ public function resetPass($uid, $timestamp, $hash) { ...@@ -120,7 +120,7 @@ public function resetPass($uid, $timestamp, $hash) {
if ($user && $user->isActive()) { if ($user && $user->isActive()) {
// No time out for first time login. // No time out for first time login.
if ($user->getLastLoginTime() && $current - $timestamp > $timeout) { if ($user->getLastLoginTime() && $current - $timestamp > $timeout) {
drupal_set_message($this->t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.')); drupal_set_message($this->t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'error');
return $this->redirect('user.pass'); return $this->redirect('user.pass');
} }
elseif ($user->isAuthenticated() && ($timestamp >= $user->getLastLoginTime()) && ($timestamp <= $current) && ($hash === user_pass_rehash($user->getPassword(), $timestamp, $user->getLastLoginTime(), $user->id()))) { elseif ($user->isAuthenticated() && ($timestamp >= $user->getLastLoginTime()) && ($timestamp <= $current) && ($hash === user_pass_rehash($user->getPassword(), $timestamp, $user->getLastLoginTime(), $user->id()))) {
...@@ -128,7 +128,7 @@ public function resetPass($uid, $timestamp, $hash) { ...@@ -128,7 +128,7 @@ public function resetPass($uid, $timestamp, $hash) {
return $this->formBuilder()->getForm('Drupal\user\Form\UserPasswordResetForm', $user, $expiration_date, $timestamp, $hash); return $this->formBuilder()->getForm('Drupal\user\Form\UserPasswordResetForm', $user, $expiration_date, $timestamp, $hash);
} }
else { else {
drupal_set_message($this->t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.')); drupal_set_message($this->t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'error');
return $this->redirect('user.pass'); return $this->redirect('user.pass');
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment