Class: Admin::PasswordResetsController
- Inherits:
-
AdminController
- Object
- ActionController::Base
- PagesCore::BaseController
- ApplicationController
- PagesCore::AdminController
- AdminController
- Admin::PasswordResetsController
- Defined in:
- app/controllers/admin/password_resets_controller.rb
Instance Attribute Summary
Attributes included from PagesCore::Authentication
Instance Method Summary collapse
Methods inherited from PagesCore::AdminController
Methods included from PagesCore::StaticCacheController
Methods included from PagesCore::PoliciesHelper
#policy, #verify_policy, #verify_policy_with_proc
Methods included from PagesCore::ProcessTitler
inc_number_of_requests, original_title
Methods included from PagesCore::ErrorRenderer
Methods included from PagesCore::Authentication
#authenticate!, #deauthenticate!, #logged_in?
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/admin/password_resets_controller.rb', line 11 def create @user = find_user_by_email(params[:email]) if @user @password_reset_token = @user.password_reset_tokens.create deliver_password_reset(@user, @password_reset_token) flash[:notice] = t("pages_core.password_reset.sent") else flash[:notice] = t("pages_core.password_reset.not_found") end redirect_to login_admin_users_url end |
#show ⇒ Object
23 24 25 |
# File 'app/controllers/admin/password_resets_controller.rb', line 23 def show @user = @password_reset_token.user end |
#update ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/admin/password_resets_controller.rb', line 27 def update @user = @password_reset_token.user if user_params[:password].present? && @user.update(user_params) @password_reset_token.destroy authenticate!(@user) flash[:notice] = t("pages_core.password_reset.changed") redirect_to login_admin_users_url else render action: :show end end |