Class: Authengine::AccountsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Authengine::AccountsController
- Defined in:
- app/controllers/authengine/accounts_controller.rb
Instance Method Summary collapse
- #edit ⇒ Object
-
#show ⇒ Object
Activate action.
-
#update ⇒ Object
Change password action.
Instance Method Details
#edit ⇒ Object
26 27 |
# File 'app/controllers/authengine/accounts_controller.rb', line 26 def edit end |
#show ⇒ Object
Activate action
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/authengine/accounts_controller.rb', line 8 def show # Uncomment and change paths to have user logged in after activation - not recommended # self.current_user = User.find_and_activate!(params[:id]) logger.info "accounts show" @user = User.find_with_activation_code(params[:activation_code]) session[:activation_code] = params[:activation_code] redirect_to :controller=>:users, :action=>:signup, :id=>@user.id rescue User::ArgumentError flash[:notice] = 'Activation code not found. Please contact database administrator.' redirect_to login_path rescue User::ActivationCodeNotFound flash[:notice] = 'Activation code not found. Please contact database administrator.' redirect_to login_path rescue User::AlreadyActivated flash[:notice] = 'Your account has already been activated. You can log in below.' redirect_to login_path end |
#update ⇒ Object
Change password action
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/authengine/accounts_controller.rb', line 30 def update # removed to make restful (should actually be put) # return unless request.post? if User.authenticate(current_user.login, params[:old_password]) if ((params[:password] == params[:password_confirmation]) && !params[:password_confirmation].blank?) current_user.password_confirmation = params[:password_confirmation] current_user.password = params[:password] if current_user.save flash[:notice] = "Password updated." # redirect_to user_path(current_user) redirect_to :controller=>session[:referer][:controller], :action=>session[:referer][:action] else flash[:error] = "An error occured, your password was not changed." render :action => 'edit' end else flash[:error] = "New password does not match the password confirmation." @old_password = params[:old_password] render :action => 'edit' end else flash[:error] = "Your old password is incorrect." render :action => 'edit' end end |