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
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/passwords_controller.rb', line 16 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
29 30 31 |
# File 'app/controllers/passwords_controller.rb', line 29 def edit # <-- render edit.html.haml end |
#new ⇒ Object
11 12 13 |
# File 'app/controllers/passwords_controller.rb', line 11 def new # <-- render new.html.haml end |
#update ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/passwords_controller.rb', line 34 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 |