@@ -40,19 +40,22 class AccountController < ApplicationController | |||
|
40 | 40 | redirect_to home_url |
|
41 | 41 | end |
|
42 | 42 | |
|
43 |
# |
|
|
43 | # Lets user choose a new password | |
|
44 | 44 | def lost_password |
|
45 | 45 | redirect_to(home_url) && return unless Setting.lost_password? |
|
46 | 46 | if params[:token] |
|
47 | @token = Token.find_by_action_and_value("recovery", params[:token]) | |
|
48 | redirect_to(home_url) && return unless @token and !@token.expired? | |
|
47 | @token = Token.find_by_action_and_value("recovery", params[:token].to_s) | |
|
48 | if @token.nil? || @token.expired? | |
|
49 | redirect_to home_url | |
|
50 | return | |
|
51 | end | |
|
49 | 52 | @user = @token.user |
|
50 | 53 | if request.post? |
|
51 | 54 | @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation] |
|
52 | 55 | if @user.save |
|
53 | 56 | @token.destroy |
|
54 | 57 | flash[:notice] = l(:notice_account_password_updated) |
|
55 |
redirect_to |
|
|
58 | redirect_to signin_path | |
|
56 | 59 | return |
|
57 | 60 | end |
|
58 | 61 | end |
General Comments 0
You need to be logged in to leave comments.
Login now