Skip to content
Snippets Groups Projects
Commit f6c6a621 authored by ziggy's avatar ziggy
Browse files

update_last_login checks if last_login_on is defined

parent 042317f5
Branches
Tags
1 merge request!5much improved reset password via email
Pipeline #206105 passed
...@@ -154,15 +154,17 @@ module AuthenticatedApp ...@@ -154,15 +154,17 @@ module AuthenticatedApp
# update last login date after successful authentication. # update last login date after successful authentication.
# #
def update_last_login def update_last_login
return unless respond_to?(:last_login_on)
new_date = fuzzy_date new_date = fuzzy_date
unless self.last_login_on == new_date return if last_login_on == new_date
if self.new_record?
if new_record?
self.last_login_on = new_date self.last_login_on = new_date
else else
update_column(:last_login_on, new_date) update_column(:last_login_on, new_date)
end end
end end
end
protected protected
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment