]> BookStack Code Mirror - bookstack/blobdiff - tests/Auth/AuthTest.php
Merge fixes from branch 'v0.12'
[bookstack] / tests / Auth / AuthTest.php
index 08d5ef8adb296eaea113da265d7afe2339a4d716..0d2e4ac170a660e3ed0925f65df404e915a1c398 100644 (file)
@@ -218,6 +218,37 @@ class AuthTest extends TestCase
             ->seePageIs('/login');
     }
 
+    public function test_reset_password_flow()
+    {
+        $this->visit('/login')->click('Forgot Password?')
+            ->seePageIs('/password/email')
+            ->type('[email protected]', 'email')
+            ->press('Send Reset Link')
+            ->see('A password reset link has been sent to [email protected]');
+
+        $this->seeInDatabase('password_resets', [
+            'email' => '[email protected]'
+        ]);
+
+        $reset = DB::table('password_resets')->where('email', '=', '[email protected]')->first();
+        $this->visit('/password/reset/' . $reset->token)
+            ->see('Reset Password')
+            ->submitForm('Reset Password', [
+                'email' => '[email protected]',
+                '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