Class: Users::PasswordsController

Inherits:
Devise::PasswordsController
  • Object
show all
Defined in:
app/controllers/virgo/users/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/virgo/users/passwords_controller.rb', line 6

def create
  self.resource = resource_class.find_by_email(params[:user][:email])

  if resource.nil?
    self.resource = resource_class.new

    flash.now[:warning] = "No account found matching that email"

    render "new" and return
  end

  resource.send_reset_password_instructions

  if successfully_sent?(resource)
    respond_with({}, :location => virgo.after_sending_reset_password_instructions_path_for(resource_name))
  else
    respond_with(resource)
  end
end

#resource_paramsObject



26
27
28
29
# File 'app/controllers/virgo/users/passwords_controller.rb', line 26

def resource_params
  params[:user].present? ? params.require(:user).permit(:email, :login, :password,
  :password_confirmation, :reset_password_token) : {}
end