Fixed error message, when using GET for password reset actions.
This commit is contained in:
parent
915e1b9e79
commit
53518039f1
1 changed files with 4 additions and 0 deletions
|
@ -10,6 +10,10 @@ class LoginController < ApplicationController
|
||||||
|
|
||||||
# Sends an email to a user with the token that allows setting a new password through action "password".
|
# Sends an email to a user with the token that allows setting a new password through action "password".
|
||||||
def reset_password
|
def reset_password
|
||||||
|
if request.get? || params[:user].nil? # Catch for get request and give better error message.
|
||||||
|
redirect_to forgot_password_url, alert: 'Ein Problem ist aufgetreten. Bitte erneut versuchen' and return
|
||||||
|
end
|
||||||
|
|
||||||
if (user = User.find_by_email(params[:user][:email]))
|
if (user = User.find_by_email(params[:user][:email]))
|
||||||
user.reset_password_token = user.new_random_password(16)
|
user.reset_password_token = user.new_random_password(16)
|
||||||
user.reset_password_expires = Time.now.advance(:days => 2)
|
user.reset_password_expires = Time.now.advance(:days => 2)
|
||||||
|
|
Loading…
Reference in a new issue