Class: PasswordsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PasswordsController
- Defined in:
- app/controllers/passwords_controller.rb
Overview
Copyright © 2008-2013 Michael Dvorkin and contributors.
Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or www.opensource.org/licenses/mit-license.php
Instance Method Summary collapse
-
#create ⇒ Object
—————————————————————————-.
-
#edit ⇒ Object
—————————————————————————-.
-
#new ⇒ Object
—————————————————————————-.
-
#update ⇒ Object
—————————————————————————-.
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/passwords_controller.rb', line 18 def create @user = User.find_by_email(params[:email]) if @user @user.deliver_password_reset_instructions! flash[:notice] = t(:msg_pwd_instructions_sent) redirect_to root_url else flash[:notice] = t(:msg_email_not_found) redirect_to action: :new end end |
#edit ⇒ Object
31 32 33 |
# File 'app/controllers/passwords_controller.rb', line 31 def edit # <-- render edit.html.haml end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/passwords_controller.rb', line 13 def new # <-- render new.html.haml end |
#update ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/passwords_controller.rb', line 36 def update if empty_password? flash[:notice] = t(:msg_enter_new_password) render :edit elsif @user.update_attributes(params.require(:user).permit(:password, :password_confirmation)) flash[:notice] = t(:msg_password_updated) redirect_to profile_url else render :edit end end |