Class: User::ResetPasswordsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/user/reset_passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/user/reset_passwords_controller.rb', line 10

def create
  @send_password_reset = SendPasswordReset.new(send_password_reset_params)

  # silent failure on password reset?
  if @send_password_reset.identity and @send_password_reset.perform
    reset_password = User::ResetPassword.new(verification: @send_password_reset.verification)
    reset_mail = UserPlane::VerificationMailer.password_reset(reset_password)
    reset_mail.deliver_now
    redirect_to root_url, notice: t('.success', address: @send_password_reset.email)
  else
    flash[:notice] = t('.failure', address: @send_password_reset.email)
    render 'new'
  end
end

#editObject



25
26
27
# File 'app/controllers/user/reset_passwords_controller.rb', line 25

def edit
  @reset_password = ResetPassword.new(code: params[:code])
end

#newObject



6
7
8
# File 'app/controllers/user/reset_passwords_controller.rb', line 6

def new
  @send_password_reset = SendPasswordReset.new
end

#updateObject



29
30
31
32
33
34
35
36
# File 'app/controllers/user/reset_passwords_controller.rb', line 29

def update
  @reset_password = ResetPassword.new(reset_password_params)
  if @reset_password.perform
    redirect_to root_url, notice: t('.success')
  else
    render 'edit'
  end
end