Class: Admin::PasswordResetsController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/generators/admin/install/templates/controllers/admin/password_resets_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
# File 'lib/generators/admin/install/templates/controllers/admin/password_resets_controller.rb', line 14

def create
  if @user = Admin::User.find_by(email: params[:email])
    send_password_reset_email
    redirect_to , notice: "Check your email for reset instructions"
  else
    redirect_to new_admin_password_reset_path, alert: "Sorry, we didn't recognize that email address"
  end
end

#editObject



11
12
# File 'lib/generators/admin/install/templates/controllers/admin/password_resets_controller.rb', line 11

def edit
end

#newObject



8
9
# File 'lib/generators/admin/install/templates/controllers/admin/password_resets_controller.rb', line 8

def new
end

#updateObject



23
24
25
26
27
28
29
# File 'lib/generators/admin/install/templates/controllers/admin/password_resets_controller.rb', line 23

def update
  if @user.update(user_params)
    redirect_to , notice: "Your password was reset successfully. Please sign in"
  else
    redirect_to edit_admin_password_reset_path(token: params[:token]), alert: @user.errors.first.full_message
  end
end