Module: EasyAuth::Controllers::PasswordReset
- Included in:
- PasswordResetController
- Defined in:
- lib/easy_auth/controllers/password_reset.rb
Class Method Summary collapse
Instance Method Summary collapse
- #after_failed_attempted_password_reset ⇒ Object
- #after_failed_password_reset ⇒ Object
- #after_successful_attempted_password_reset ⇒ Object
- #after_successful_password_reset ⇒ Object
- #after_successful_password_reset_url ⇒ Object
- #create ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Class Method Details
.included(base) ⇒ Object
2 3 4 5 6 |
# File 'lib/easy_auth/controllers/password_reset.rb', line 2 def self.included(base) base.instance_eval do before_filter :find_account_from_reset_token, :only => [:edit, :update] end end |
Instance Method Details
#after_failed_attempted_password_reset ⇒ Object
53 54 55 |
# File 'lib/easy_auth/controllers/password_reset.rb', line 53 def after_failed_attempted_password_reset after_successful_attempted_password_reset end |
#after_failed_password_reset ⇒ Object
43 44 45 46 |
# File 'lib/easy_auth/controllers/password_reset.rb', line 43 def after_failed_password_reset flash.now[:error] = I18n.t('easy_auth.password_reset.update.error') render :edit end |
#after_successful_attempted_password_reset ⇒ Object
48 49 50 51 |
# File 'lib/easy_auth/controllers/password_reset.rb', line 48 def after_successful_attempted_password_reset flash.now[:notice] = I18n.t('easy_auth.password_reset.create.notice') render :new end |
#after_successful_password_reset ⇒ Object
33 34 35 36 37 |
# File 'lib/easy_auth/controllers/password_reset.rb', line 33 def after_successful_password_reset session[:identity_id] = @identity.id @identity.update_column(:reset_token_digest, nil) redirect_to after_successful_password_reset_url, :notice => I18n.t('easy_auth.password_reset.update.notice') end |
#after_successful_password_reset_url ⇒ Object
39 40 41 |
# File 'lib/easy_auth/controllers/password_reset.rb', line 39 def after_successful_password_reset_url @identity.account end |
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/easy_auth/controllers/password_reset.rb', line 12 def create if @identity = EasyAuth.find_identity_model(params).where(:uid => params[:identities_password][:uid]).first unencrypted_reset_token = @identity.generate_reset_token! PasswordResetMailer.reset(@identity.id, unencrypted_reset_token).deliver after_successful_attempted_password_reset else @identity = EasyAuth.find_identity_model(params).new(uid: params[:identities_password][:uid]) after_failed_attempted_password_reset end end |
#new ⇒ Object
8 9 10 |
# File 'lib/easy_auth/controllers/password_reset.rb', line 8 def new @identity = EasyAuth.find_identity_model(params).new end |
#update ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/easy_auth/controllers/password_reset.rb', line 23 def update @identity = @account.password_identities.first if @account.update_attributes(account_params) after_successful_password_reset else after_failed_password_reset end end |