diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-02 15:18:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-02 15:18:53 +0300 |
commit | 51d59a3538b97d85ebb46039044d3f498809b55a (patch) | |
tree | d574af08cc1e2ef8fa8337a0850fa36a7b9ab527 /app/services/users | |
parent | 74da249f7e22c20e144ba3c044c6bdeb5df86cd4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/users')
-rw-r--r-- | app/services/users/email_verification/base_service.rb | 7 | ||||
-rw-r--r-- | app/services/users/email_verification/validate_token_service.rb | 3 |
2 files changed, 5 insertions, 5 deletions
diff --git a/app/services/users/email_verification/base_service.rb b/app/services/users/email_verification/base_service.rb index 3337beec195..721290fe056 100644 --- a/app/services/users/email_verification/base_service.rb +++ b/app/services/users/email_verification/base_service.rb @@ -5,22 +5,23 @@ module Users class BaseService VALID_ATTRS = %i[unlock_token confirmation_token].freeze - def initialize(attr:) + def initialize(attr:, user:) @attr = attr + @user = user validate_attr! end protected - attr_reader :attr, :token + attr_reader :attr, :user, :token def validate_attr! raise ArgumentError, 'Invalid attribute' unless attr.in?(VALID_ATTRS) end def digest - Devise.token_generator.digest(User, attr, token) + Devise.token_generator.digest(User, user.email, token) end end end diff --git a/app/services/users/email_verification/validate_token_service.rb b/app/services/users/email_verification/validate_token_service.rb index b1b34e94f49..30413de805c 100644 --- a/app/services/users/email_verification/validate_token_service.rb +++ b/app/services/users/email_verification/validate_token_service.rb @@ -8,9 +8,8 @@ module Users TOKEN_VALID_FOR_MINUTES = 60 def initialize(attr:, user:, token:) - super(attr: attr) + super(attr: attr, user: user) - @user = user @token = token end |