Sha256: 47ea746c3ff62eb28162f0acd26444c9090ae75425d9e810c72e0821aeab87c7

Contents?: true

Size: 850 Bytes

Versions: 23

Compression:

Stored size: 850 Bytes

Contents

class PasswordResetsController < ApplicationController
  
  def create
    user = User.find_by_email(params[:email])
    if user
      user.send_password_reset
      redirect_to root_url, :notice => t('authentication.reset_password_email_sent_confirmation')
    else
      redirect_to root_url, :alert => t('authentication.warning.no_such_email')
    end
  end

  def edit
    @user = User.find_by_password_reset_token!(params[:id])
  end

  def update
    @user = User.find_by_password_reset_token!(params[:id])
    if @user.password_reset_sent_at < 24.hours.ago
      redirect_to new_password_reset_path, :alert => t('authentication.warning.password_reset_expired')
    elsif @user.update_attributes(params[:user])
      redirect_to root_url, :notice => t('authentication.password_reset_confirmation')
    else
      render :edit
    end
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
tkh_authentication-0.1.8 app/controllers/password_resets_controller.rb
tkh_authentication-0.9.2 app/controllers/password_resets_controller.rb
tkh_authentication-0.9.1 app/controllers/password_resets_controller.rb
tkh_authentication-0.9 app/controllers/password_resets_controller.rb
tkh_authentication-0.1.7 app/controllers/password_resets_controller.rb
tkh_authentication-0.1.6 app/controllers/password_resets_controller.rb
tkh_authentication-0.1.5 app/controllers/password_resets_controller.rb
tkh_authentication-0.1.3 app/controllers/password_resets_controller.rb
tkh_authentication-0.1.2 app/controllers/password_resets_controller.rb
tkh_authentication-0.1.1 app/controllers/password_resets_controller.rb
tkh_authentication-0.1 app/controllers/password_resets_controller.rb
tkh_authentication-0.0.12 app/controllers/password_resets_controller.rb
tkh_authentication-0.0.11 app/controllers/password_resets_controller.rb
tkh_authentication-0.0.10 app/controllers/password_resets_controller.rb
tkh_authentication-0.0.9 app/controllers/password_resets_controller.rb
tkh_authentication-0.0.8 app/controllers/password_resets_controller.rb
tkh_authentication-0.0.7 app/controllers/password_resets_controller.rb
tkh_authentication-0.0.6 app/controllers/password_resets_controller.rb
tkh_authentication-0.0.5 app/controllers/password_resets_controller.rb
tkh_authentication-0.0.4 app/controllers/password_resets_controller.rb