Fixed bug in reset password error handling.

This commit is contained in:
Benjamin Meichsner 2013-03-27 22:12:46 +01:00
parent 18f6cadca2
commit 915e1b9e79
3 changed files with 3 additions and 3 deletions

View file

@ -67,8 +67,7 @@ class LoginController < ApplicationController
def validate_token
@user = User.find_by_id_and_reset_password_token(params[:id], params[:token])
if (@user.nil? || @user.reset_password_expires < Time.now)
flash.now.error = "Ungültiger oder abgelaufener Token. Bitte versuch es erneut."
render :action => 'forgot_password'
redirect_to forgot_password_url, alert: "Ungültiger oder abgelaufener Token. Bitte versuch es erneut."
end
end
end

View file

@ -26,4 +26,4 @@
.control-group
.controls
= submit_tag "Anmelden", class: 'btn'
= link_to "Passwort vergessen?", :controller => 'login', :action => 'forgot_password'
= link_to "Passwort vergessen?", forgot_password_path

View file

@ -17,6 +17,7 @@ Foodsoft::Application.routes.draw do
match '/login' => 'sessions#new', :as => 'login'
match '/logout' => 'sessions#destroy', :as => 'logout'
get '/login/forgot_password' => 'login#forgot_password', as: :forgot_password
get '/login/new_password' => 'login#new_password', as: :new_password
match '/login/accept_invitation/:token' => 'login#accept_invitation', as: :accept_invitation
resources :sessions, :only => [:new, :create, :destroy]