Class: Refinery::Authentication::Devise::PasswordsController

Inherits:
Devise::PasswordsController
  • Object
show all
Defined in:
app/controllers/refinery/authentication/devise/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /registrations/password



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/refinery/authentication/devise/passwords_controller.rb', line 31

def create
  if params[:authentication_devise_user].present? && (email = params[:authentication_devise_user][:email]).present? &&
     (user = User.where(:email => email).first).present?

    token = user.generate_reset_password_token!
    UserMailer.reset_notification(user, request, token).deliver_now
    redirect_to refinery.,
                :notice => t('email_reset_sent', :scope => 'refinery.authentication.devise.users.forgot')
  else
    flash.now[:error] = if (email = params[:authentication_devise_user][:email]).blank?
      t('blank_email', :scope => 'refinery.authentication.devise.users.forgot')
    else
      t('email_not_associated_with_account_html', :email => ERB::Util.html_escape(email), :scope => 'refinery.authentication.devise.users.forgot').html_safe
    end

    self.new

    render :new
  end
end

#editObject

GET /registrations/password/edit?reset_password_token=abcdef



24
25
26
27
28
# File 'app/controllers/refinery/authentication/devise/passwords_controller.rb', line 24

def edit
  self.resource = User.find_or_initialize_with_error_by_reset_password_token(params[:reset_password_token])
  set_minimum_password_length
  resource.reset_password_token = params[:reset_password_token]
end