mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-30 12:18:43 +09:00
Fixed Password Reset handling (#1365)
* Fixed Passwort Reset handling so the message is the same whether the E-Mail address exists or not. * Fixed spelling & Test * Fixed Typo * Improved Staff PW Reset handling and removed both Exceptions to return true * Improved grammar & wording --------- Co-authored-by: Christoph Schläpfer <c.schlaepfer@datact.ch> Co-authored-by: Anuril <ta@TAPC01.localdomain> Co-authored-by: Belle Aerni <belleaerni@gmail.com>
This commit is contained in:
5 files changed
+7
-7
No files matched your search
@@ -160,7 +160,7 @@ class Guest extends \Api_Abstract
|
||||
|
||||
$c = $this->di['db']->findOne('Client', 'email = ?', [$data['email']]);
|
||||
if (!$c instanceof \Model_Client) {
|
||||
throw new \Box_Exception('Email not found in our database');
|
||||
return true;
|
||||
}
|
||||
|
||||
$hash = hash('sha256', time() . random_bytes(13));
|
||||
|
||||
@@ -59,7 +59,7 @@ $(function() {
|
||||
'guest/client/reset_password',
|
||||
$(this).serialize(),
|
||||
function(result) {
|
||||
bb.msg("{{ 'Password reset confirmation email was sent'|trans }}");
|
||||
bb.msg("{{ 'A password reset confirmation email will be sent to you if we found an account with that email address.'|trans }}");
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ class Guest extends \Api_Abstract
|
||||
$c = $this->di['db']->findOne('Admin', 'email = ?', [$data['email']]);
|
||||
|
||||
if (!$c instanceof \Model_Admin) {
|
||||
throw new \Box_Exception('Email not found in our database');
|
||||
return true;
|
||||
}
|
||||
$hash = hash('sha256', time() . random_bytes(13));
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<div class="card-body">
|
||||
<h2 class="h2 text-center mb-4">{{ 'Reset your password' | trans }}</h2>
|
||||
<p class="text-muted mb-4">{{ 'Enter your email address. You will receive a confirmation link if your account exists.' | trans }}</p>
|
||||
<form class="api-form" action="{{ 'api/guest/staff/passwordreset'|link }}" method="post" data-api-redirect="{{ 'index'|alink }}">
|
||||
<form class="api-form" action="{{ 'api/guest/staff/passwordreset'|link }}" method="post" data-api-redirect="{{ 'index'|alink }}" data-api-msg="{{ 'A password reset confirmation email will be sent to you if we found an account with that email address.'|trans }}">
|
||||
<input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="inputEmail">{{ 'Email address' | trans }}</label>
|
||||
|
||||
@@ -295,9 +295,9 @@ class GuestTest extends \BBTestCase {
|
||||
$client = new \Box\Mod\Client\Api\Guest();
|
||||
$client->setDi($di);
|
||||
|
||||
$this->expectException(\Box_Exception::class);
|
||||
$this->expectExceptionMessage('Email not found in our database');
|
||||
$client->reset_password($data);
|
||||
// expects true because we don't want to give away if the email exists or not
|
||||
$result = $client->reset_password($data);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testconfirm_reset()
|
||||
|
||||
Reference in new issue
Block a user