Class: Authuser::PasswordsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Authuser::PasswordsController
- Defined in:
- app/controllers/authuser/passwords_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/authuser/passwords_controller.rb', line 12 def create if user = ::User.find_by_email(params[:password][:email]) user.forgot_password! ::AuthuserMailer.deliver_change_password user flash[:notice] = translate(:deliver_change_password, :scope => [:authuser, :controllers, :passwords], :default => "You will receive an email within the next few minutes. " << "It contains instructions for changing your password.") redirect_to url_after_create else flash.now[:failure] = translate(:unknown_email, :scope => [:authuser, :controllers, :passwords], :default => "Unknown email.") render :template => 'passwords/new' end end |
#edit ⇒ Object
29 30 31 32 |
# File 'app/controllers/authuser/passwords_controller.rb', line 29 def edit @user = ::User.find_by_id_and_token(params[:user_id], params[:token]) render :template => 'passwords/edit' end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/authuser/passwords_controller.rb', line 8 def new render :template => 'passwords/new' end |
#update ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/authuser/passwords_controller.rb', line 34 def update @user = ::User.find_by_id_and_token(params[:user_id], params[:token]) if @user.update_password(params[:user][:password], params[:user][:password_confirmation]) @user.confirm_email! unless @user.email_confirmed? sign_user_in(@user) flash[:success] = translate(:signed_in, :default => "Signed in.") redirect_to url_after_update else render :template => 'passwords/edit' end end |