1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

Added back email confirmation check in middleware

During writing of the update notes, found that the upgrade path would be
tricky from a security point of view. If people were pending email
confirmation but had an active session, they could technically be
actively logged in after the next release.

Added middlware as an extra precaution for now.
This commit is contained in:
Dan Brown
2021-08-30 21:28:17 +01:00
parent 3e870c30e1
commit 2740603d99
3 changed files with 66 additions and 0 deletions

View File

@@ -459,6 +459,22 @@ class AuthTest extends BrowserKitTest
$this->assertFalse($log->hasWarningThatContains('Failed login for admin@admin.com'));
}
public function test_logged_in_user_with_unconfirmed_email_is_logged_out()
{
$this->setSettings(['registration-confirmation' => 'true']);
$user = $this->getEditor();
$user->email_confirmed = false;
$user->save();
auth()->login($user);
$this->assertTrue(auth()->check());
$this->get('/books');
$this->assertRedirectedTo("/");
$this->assertFalse(auth()->check());
}
/**
* Perform a login.
*/