Class: QuoVadis::PasswordsController

Inherits:
QuoVadisController show all
Defined in:
app/controllers/quo_vadis/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



8
9
10
# File 'app/controllers/quo_vadis/passwords_controller.rb', line 8

def edit
  @password = QuoVadis::Password.new
end

#updateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/quo_vadis/passwords_controller.rb', line 12

def update
  @password = authenticated_model..password
  if @password.change(params[:password][:password],
                      params[:password][:new_password],
                      params[:password][:new_password_confirmation])
    qv.log authenticated_model., Log::PASSWORD_CHANGE
    QuoVadis.notify :password_change_notification, email: authenticated_model.email
    qv.logout_other_sessions
    qv.replace_session
    redirect_to qv.path_after_password_change, notice: QuoVadis.translate('flash.password.update')
  else
    render :edit, status: :unprocessable_entity
  end
end