Class: SimplyAuth::PasswordsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/simply_auth/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @reset_password_token = SimplyAuth::ResetPasswordToken.new(password_params)
  if @reset_password_token.save
    PasswordMailer.reset_password(@reset_password_token).deliver_now
    flash[:notice] = "Please check your email for password reset instructions."
    redirect_to new_session_path
  else
    render :new
  end
end

#editObject



18
19
20
21
# File 'app/controllers/simply_auth/passwords_controller.rb', line 18

def edit
  @reset_password_token = SimplyAuth::ResetPasswordToken.find(params[:token])
  @password_reset = SimplyAuth::PasswordReset.new(reset_password_token_id: params[:token])
end

#newObject



3
4
5
# File 'app/controllers/simply_auth/passwords_controller.rb', line 3

def new
  @reset_password_token = SimplyAuth::ResetPasswordToken.new(permit_password_params)
end

#updateObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/simply_auth/passwords_controller.rb', line 23

def update
  @password_reset = SimplyAuth::PasswordReset.new(password_reset_params)
  @reset_password_token = SimplyAuth::ResetPasswordToken.find(@password_reset.reset_password_token_id)
  if @password_reset.save
    redirect_to new_session_path
  else
    render :edit
  end
end