Class: PasswordResetsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/password_resets_controller.rb', line 24

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

#editObject



9
10
# File 'app/controllers/password_resets_controller.rb', line 9

def edit
end

#newObject



6
7
# File 'app/controllers/password_resets_controller.rb', line 6

def new
end

#updateObject



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/password_resets_controller.rb', line 12

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