Class: Decidim::Devise::PasswordsController
- Inherits:
-
Devise::PasswordsController
- Object
- Devise::PasswordsController
- Decidim::Devise::PasswordsController
- Includes:
- Decidim::DeviseControllers
- Defined in:
- app/controllers/decidim/devise/passwords_controller.rb
Overview
Custom Devise PasswordsController to avoid namespace problems.
Instance Method Summary collapse
Instance Method Details
#apply_password ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/decidim/devise/passwords_controller.rb', line 24 def apply_password self.resource = current_user @send_path = apply_password_path @form = Decidim::PasswordForm.from_params(params["user"]) Decidim::UpdatePassword.call(current_user, @form) do on(:ok) do flash[:notice] = t("passwords.update.success", scope: "decidim") bypass_sign_in(current_user) redirect_to after_sign_in_path_for current_user end on(:invalid) do flash.now[:alert] = t("passwords.update.error", scope: "decidim") resource.errors.errors.concat(@form.errors.errors) render action: "edit" end end end |
#change_password ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/controllers/decidim/devise/passwords_controller.rb', line 16 def change_password self.resource = current_user @send_path = apply_password_path flash[:secondary] = t("decidim.admin.password_change.notification", days: Decidim.config.admin_password_expiration_days) if flash[:secondary].blank? render :edit end |