Class: MerbAuthSlicePasswordReset::Passwords

Inherits:
Application
  • Object
show all
Defined in:
app/controllers/passwords.rb

Instance Method Summary collapse

Instance Method Details

#forgot_passwordObject



3
4
5
6
# File 'app/controllers/passwords.rb', line 3

def forgot_password
  @login_param_name = Merb::Authentication::Strategies::Basic::Base.
  render
end

#resetObject

Raises:

  • (NotFound)


20
21
22
23
24
25
# File 'app/controllers/passwords.rb', line 20

def reset
  session.user = Merb::Authentication.user_class.find_with_password_reset_code(params[:password_reset_code])
  raise NotFound if session.user.nil?
  session.user.reset_password!
  redirect_after_password_reset
end

#send_confirmationObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/passwords.rb', line 8

def send_confirmation
  @login_param_name = Merb::Authentication::Strategies::Basic::Base.
  @user = Merb::Authentication.user_class.(@login_param_name, params[@login_param_name])
  if @user
    @user.send_password_reset_notification
    redirect_after_sending_confirmation
  else
    message[:error] = "User with #{@login_param_name} \"%s\" not found".t(params[@login_param_name].freeze)
    render :forgot_password
  end
end