Class: Admin::UserPasswordResetsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Trek::Authentication
Defined in:
lib/generators/trek/templates/controllers/admin/user_password_resets_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @user_password_reset = Trek::UserPasswordReset.new(user_password_reset_params)

  @user = @user_password_reset.user
  @user&.deliver_reset_password_instructions!

  redirect_to(%i[admin login], notice: t(".success"))
end

#editObject



20
21
# File 'lib/generators/trek/templates/controllers/admin/user_password_resets_controller.rb', line 20

def edit
end

#newObject



16
17
18
# File 'lib/generators/trek/templates/controllers/admin/user_password_resets_controller.rb', line 16

def new
  @user_password_reset = Trek::UserPasswordReset.new
end

#updateObject



32
33
34
35
36
37
38
# File 'lib/generators/trek/templates/controllers/admin/user_password_resets_controller.rb', line 32

def update
  if @user.change_password(params[:user][:new_password])
    redirect_to(%i[admin login], notice: t(".success"))
  else
    render action: "edit"
  end
end