summaryrefslogtreecommitdiffstats
path: root/app/controllers/account_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-29 08:58:40 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-01-29 08:58:40 +0000
commit9e1723c537fee06503a65613398a0953b1dc0042 (patch)
tree2a033c748489567812e2bf33ac77ca8f67916cb9 /app/controllers/account_controller.rb
parent427a745184d1b1b38ac045f6e86295e3e2b1e60a (diff)
downloadredmine-9e1723c537fee06503a65613398a0953b1dc0042.tar.gz
redmine-9e1723c537fee06503a65613398a0953b1dc0042.zip
Redirect with token in session (#24416).
git-svn-id: http://svn.redmine.org/redmine/trunk@16287 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/account_controller.rb')
-rw-r--r--app/controllers/account_controller.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index ece857a22..54a29fbf4 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -60,12 +60,20 @@ class AccountController < ApplicationController
# Lets user choose a new password
def lost_password
(redirect_to(home_url); return) unless Setting.lost_password?
- if params[:token]
- @token = Token.find_token("recovery", params[:token].to_s)
+ if prt = (params[:token] || session[:password_recovery_token])
+ @token = Token.find_token("recovery", prt.to_s)
if @token.nil? || @token.expired?
redirect_to home_url
return
end
+
+ # redirect to remove the token query parameter from the URL and add it to the session
+ if request.query_parameters[:token].present?
+ session[:password_recovery_token] = @token.value
+ redirect_to lost_password_url
+ return
+ end
+
@user = @token.user
unless @user && @user.active?
redirect_to home_url