Commit 6ab75328 authored by Sean McGivern's avatar Sean McGivern Committed by Oswaldo Ferreira

Merge branch 'sh-fix-mysql-almost-there-spec-failure' into 'master'

Fix sub-second timing comparison error for Devise confirmation period

Closes #2362

See merge request !1843
parent 3618283b
...@@ -1019,6 +1019,15 @@ class User < ActiveRecord::Base ...@@ -1019,6 +1019,15 @@ class User < ActiveRecord::Base
devise_mailer.send(notification, self, *args).deliver_later devise_mailer.send(notification, self, *args).deliver_later
end end
# This works around a bug in Devise 4.2.0 that erroneously causes a user to
# be considered active in MySQL specs due to a sub-second comparison
# issue. For more details, see: https://gitlab.com/gitlab-org/gitlab-ee/issues/2362#note_29004709
def confirmation_period_valid?
return false if self.class.allow_unconfirmed_access_for == 0.days
super
end
def ensure_external_user_rights def ensure_external_user_rights
return unless external? return unless external?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment