Class: Masq::PasswordsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Masq::PasswordsController
- Defined in:
- app/controllers/masq/passwords_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Forgot password.
-
#update ⇒ Object
Reset password.
Instance Method Details
#create ⇒ Object
Forgot password
7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/masq/passwords_controller.rb', line 7 def create if account = Account.find_by(email: params[:email], activation_code: nil) account.forgot_password! redirect_to(login_path, notice: t(:password_reset_link_has_been_sent)) else flash[:alert] = t(:could_not_find_user_with_email_address) render(action: "new") end end |
#update ⇒ Object
Reset password
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/masq/passwords_controller.rb', line 18 def update if params[:password].blank? flash[:alert] = t(:password_cannot_be_blank) render(action: "edit") elsif @account.update(password: params[:password], password_confirmation: params[:password_confirmation]) redirect_to(login_path, notice: t(:password_reset)) else flash[:alert] = t(:password_mismatch) render(action: "edit") end end |