diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /app/helpers/sessions_helper.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'app/helpers/sessions_helper.rb')
-rw-r--r-- | app/helpers/sessions_helper.rb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index 9ef347fff16..cf5cc92587f 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -40,10 +40,6 @@ module SessionsHelper request.env['rack.session.options'][:expire_after] = expiry_s end - def send_rate_limited?(user) - Gitlab::ApplicationRateLimiter.peek(:email_verification_code_send, scope: user) - end - def obfuscated_email(email) # Moved to Gitlab::Utils::Email in 15.9 Gitlab::Utils::Email.obfuscated_email(email) @@ -52,4 +48,23 @@ module SessionsHelper def remember_me_enabled? Gitlab::CurrentSettings.remember_me_enabled? end + + def unconfirmed_verification_email?(user) + token_valid_from = ::Users::EmailVerification::ValidateTokenService::TOKEN_VALID_FOR_MINUTES.minutes.ago + user.email_reset_offered_at.nil? && user.pending_reconfirmation? && user.confirmation_sent_at >= token_valid_from + end + + def verification_email(user) + unconfirmed_verification_email?(user) ? user.unconfirmed_email : user.email + end + + def verification_data(user) + { + obfuscated_email: obfuscated_email(verification_email(user)), + verify_path: session_path(:user), + resend_path: users_resend_verification_code_path, + offer_email_reset: user.email_reset_offered_at.nil?.to_s, + update_email_path: users_update_email_path + } + end end |