Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinnie Okada <vokada@mrvinn.com>2015-04-27 07:04:33 +0300
committerVinnie Okada <vokada@mrvinn.com>2015-05-16 23:03:07 +0300
commit0bfab084a811d7dad1f1929ee7b5c2bc59015173 (patch)
treeda3c6e696e22b3d9e377f956c1adbec4380a3e97 /app/helpers/emails_helper.rb
parent35729671fb3a123ddeb7b2b1cda446fd661bd4e6 (diff)
Explain reset token expiration in emails
Tell new users when their password reset token expires and provide a link to get a new one.
Diffstat (limited to 'app/helpers/emails_helper.rb')
-rw-r--r--app/helpers/emails_helper.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb
index 0df3ecc90b7..12aa561a14e 100644
--- a/app/helpers/emails_helper.rb
+++ b/app/helpers/emails_helper.rb
@@ -35,4 +35,23 @@ module EmailsHelper
lexer = Rugments::Lexers::Diff.new
raw formatter.format(lexer.lex(diffcontent))
end
+
+ def password_reset_token_valid_time
+ valid_hours = Devise.reset_password_within / 60 / 60
+ if valid_hours >= 24
+ unit = 'day'
+ valid_length = (valid_hours / 24).floor
+ else
+ unit = 'hour'
+ valid_length = valid_hours.floor
+ end
+
+ pluralize(valid_length, unit)
+ end
+
+ def reset_token_expire_message
+ link_tag = link_to('request a new one', new_user_password_url)
+ msg = "This link is valid for #{password_reset_token_valid_time}. "
+ msg << "After it expires, you can #{link_tag}."
+ end
end