diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-01 15:08:30 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-01 15:08:30 +0000 |
commit | a0fdcfcdd514c2af98f18cadfa75f8a6a85b4d2c (patch) | |
tree | ecba106fd4d1426cc2109a6ba3da091be2de1f87 /app/helpers/sessions_helper.rb | |
parent | 2828f81d2a41f46b89e13dc057b982f27aeee547 (diff) | |
download | gitlab-ce-a0fdcfcdd514c2af98f18cadfa75f8a6a85b4d2c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/sessions_helper.rb')
-rw-r--r-- | app/helpers/sessions_helper.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index f0389000eb3..129180d1ccf 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -39,4 +39,16 @@ module SessionsHelper # 2. https://github.com/redis-store/redis-store/blob/3acfa95f4eb6260c714fdb00a3d84be8eedc13b2/lib/redis/store/ttl.rb#L32 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) + regex = ::Gitlab::UntrustedRegexp.new('^(..?)(.*)(@.?)(.*)(\..*)$') + match = regex.match(email) + return email unless match + + match[1] + '*' * match[2].length + match[3] + '*' * match[4].length + match[5] + end end |