Reworked Password-Reset flow (#1627)

* Reworked Password-Reset flow
- No more Passwords sent via E-Mail
- Correct redirects.

* Fixed spelling & last redirect

* Small fixes and updated tests for pw-reset-flow

* Fixed tests for pw-reset-flow

* Fixed tests for the Password reset flow

* Fixed typos, resolved Feedback

* Renamed event before password reset

* Renamed event after password reset

* Tweak a few comments, send the reset email instantly

---------

Co-authored-by: Christoph Schläpfer <c.schlaepfer@datact.ch>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
This commit is contained in:
authored and GitHub committed 2023-09-22 18:15:18 -07:00
1 parent cba659534c
commit 3ee7f29689
8 files changed
+296 -123

No files matched your search

+10 -4
View File
@@ -63,15 +63,21 @@ class Client implements \FOSSBilling\InjectionAwareInterface
return $app->render($template);
}
public function get_reset_password_confirm(\Box_App $app, $hash)
{
$api = $this->di['api_guest'];
$service = $this->di['mod_service']('client');
$this->di['events_manager']->fire(['event' => 'onBeforePasswordResetClient']);
$data = [
'hash' => $hash,
];
$api->client_confirm_reset($data);
$app->redirect('/login');
$template = 'mod_client_set_new_password';
// Call password_reset_valid function and if true, then render the template, otherwise redirect to the index page
$result = $service->password_reset_valid($data);
if ($result !== false) {
return $app->render($template);
} else {
$app->redirect('/');
}
}
}