Class: PasswordResetsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @user = User.find_by_email(params[:email])
  if @user
    @user.reset_perishable_token!  
    UserMailer.password_reset(@user).deliver
    flash[Rails.application.config.constellation.authentication.success_flash] = t("constellation.authentication.password_resets.create.success_flash")
    redirect_to Rails.application.config.constellation.authentication.password_reset_redirection
  else
    flash.now[Rails.application.config.constellation.authentication.failure_flash] = t("constellation.authentication.password_resets.create.failure_flash")
    render :action => :new
  end
end

#editObject



21
22
23
# File 'app/controllers/password_resets_controller.rb', line 21

def edit
  render
end

#newObject



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

def new
end

#updateObject



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

def update
  @user.password = params[:user][:password]
  @user.password_confirmation = params[:user][:password_confirmation]
  if @user.save
    flash[Rails.application.config.constellation.authentication.success_flash] = t("constellation.authentication.password_resets.update.success_flash")
    redirect_to Rails.application.config.constellation.authentication.
  else
    render :action => :edit
  end
end