Class: Masq::PasswordsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/masq/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

Forgot password



7
8
9
10
11
12
13
14
15
# File 'app/controllers/masq/passwords_controller.rb', line 7

def create
  if  = .find_by(email: params[:email], activation_code: nil)
    .forgot_password!
    redirect_to(, notice: t(:password_reset_link_has_been_sent))
  else
    flash[:alert] = t(:could_not_find_user_with_email_address)
    render(action: "new")
  end
end

#updateObject

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(, notice: t(:password_reset))
  else
    flash[:alert] = t(:password_mismatch)
    render(action: "edit")
  end
end