getgrav / grav-plugin-login

Grav Login Plugin
http://getgrav.org
MIT License
44 stars 54 forks source link

Forgot password function – wrong error message #284

Closed kvanderloock-site-works closed 2 years ago

kvanderloock-site-works commented 2 years ago

I got the following issue:

When i try to reset my passwort with a non existing email address there is a info message, that the reset introduction is sent.

The code in the Controller.php (Line 367) is the following:

if (!$user || !$user->exists()) {
  $messages->add($language->translate('PLUGIN_LOGIN.FORGOT_INSTRUCTIONS_SENT_VIA_EMAIL'), 'info');
  $this->setRedirect($this->login->getRoute('forgot') ?? '/');

  return true;
}

but if the user don't exist it should be:

if (!$user || !$user->exists()) {
  $messages->add($language->translate(['PLUGIN_LOGIN.FORGOT_USERNAME_DOES_NOT_EXIST', $email]), 'error');
  $this->setRedirect($this->login->getRoute('forgot') ?? '/');

  return true;
}

in addition to the functionality there is an issue with the german label (de.yaml - line 26):

FORGOT_USERNAME_DOES_NOT_EXIST: "Der Benutzer mit dem Benutzername <b>%s</ b> existiert nicht."

should be:

FORGOT_USERNAME_DOES_NOT_EXIST: "Der Benutzer mit dem Benutzername <b>%s</b> existiert nicht."

Best regards Kevin

rhukster commented 2 years ago

Is it possible to get a Pull Request for this?

kvanderloock-site-works commented 2 years ago

Created a Pull Request. Hope i did it correctly. It's my first time working in a shared repository. If something is not correct, please tell me!

rhukster commented 2 years ago

looks good to me, merged! thanks.