Class: PasswordsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  user = User.find_by_email!(params[:email])
  user.reset_perishable_token!
  UserMailer.password_reset(user).deliver
  redirect_to , :notice => 'Email to reset password successfully sent.'
rescue ActiveRecord::RecordNotFound
  flash.now[:alert] = 'Your email was not found. Did you mistype?'
  render :action => :new
end

#editObject



20
21
22
# File 'app/controllers/passwords_controller.rb', line 20

def edit
  # ...
end

#newObject



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

def new
  # ...
end

#updateObject



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

def update
  @user.update_attributes!(params[:user].merge(:perishable_token => nil))
  (@user)
  redirect_to user_path(@user), :notice => 'Your password was successfully updated!'
rescue ActiveRecord::RecordInvalid
  flash[:notice] = 'An error occurred. Please try again.'
  redirect_to 
end