1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Improved password reset flow with notifications.

Also added links to sign-in/register.
Fixed links in emails sent out.

Fixes #210 and #218.
This commit is contained in:
Dan Brown
2016-10-30 11:33:56 +00:00
parent 91fe7f0bee
commit 8b43b91057
8 changed files with 99 additions and 4 deletions

View File

@ -216,6 +216,37 @@ class AuthTest extends TestCase
->seePageIs('/login');
}
public function test_reset_password_flow()
{
$this->visit('/login')->click('Forgot Password?')
->seePageIs('/password/email')
->type('admin@admin.com', 'email')
->press('Send Reset Link')
->see('A password reset link has been sent to admin@admin.com');
$this->seeInDatabase('password_resets', [
'email' => 'admin@admin.com'
]);
$reset = DB::table('password_resets')->where('email', '=', 'admin@admin.com')->first();
$this->visit('/password/reset/' . $reset->token)
->see('Reset Password')
->submitForm('Reset Password', [
'email' => 'admin@admin.com',
'password' => 'randompass',
'password_confirmation' => 'randompass'
])->seePageIs('/')
->see('Your password has been successfully reset');
}
public function test_reset_password_page_shows_sign_links()
{
$this->setSettings(['registration-enabled' => 'true']);
$this->visit('/password/email')
->seeLink('Sign in')
->seeLink('Sign up');
}
/**
* Perform a login
* @param string $email