mirror of
https://github.com/we-promise/sure.git
synced 2026-04-23 14:04:06 +00:00
fix(authentication): Fix issues when users try to logout (#603)
Run set last login information action only when the user exist. Thus preventing running it after the logout method, which was causing an error
This commit is contained in:
@@ -3,7 +3,7 @@ module Authentication
|
|||||||
|
|
||||||
included do
|
included do
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
after_action :set_last_login_at
|
after_action :set_last_login_at, if: -> { Current.user }
|
||||||
end
|
end
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
|||||||
fill_in "Password", with: "password"
|
fill_in "Password", with: "password"
|
||||||
click_button "Log in"
|
click_button "Log in"
|
||||||
end
|
end
|
||||||
assert_text "Dashboard"
|
assert_text "Dashboard", wait: 5
|
||||||
|
find('[data-controller="menu"]').click
|
||||||
|
click_button "Logout"
|
||||||
|
assert_text "Sign in to your account"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user