Class: PasswordResetsController

Inherits:
BumbleController show all
Defined in:
app/controllers/password_resets_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/password_resets_controller.rb', line 4

def create
  if @user = User.find_by_email(params[:email])
    @user.deliver_password_reset_instructions!
    flash[:notice] = "Instructions to reset your password have been emailed to you. Please check your email."
    redirect_to root_path
  else
    flash[:notice] = "No user was found with that email address"
    render :action => :new
  end
end

#updateObject



15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/password_resets_controller.rb', line 15

def update
  @user.password = params[:user][:password]
  @user.password_confirmation = params[:user][:password_confirmation]
  if @user.save
    flash[:notice] = "Password successfully updated"
    redirect_to root_url
  else
    render :action => :edit
  end
end