Class: PasswordController
Overview
typed: ignore frozen_string_literal: true
Instance Method Summary
collapse
#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #render_not_found, #routing_error, search_params_key=
#append_info_to_payload
#check_boolean_param, #get_banners, #inventory_params, #reservation_params
Instance Method Details
#change ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'app/controllers/password_controller.rb', line 17
def change
return render plain: 'Page not found', status: 404 unless params[:user].present?
unless User.update_password(params[:user])
redirect_to(reset_password_path(params[:user][:hash_email], params[:user][:original_email]),
alert: User.update_password_errors.uniq.to_sentence) and return
end
end
|
#change_staff ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'app/controllers/password_controller.rb', line 26
def change_staff
@custom_footer = true
params_password = params.require(:staff).permit(:hash, :password_confirmation, :password)
token = params_password[:hash].to_s
staff = Staff.find_by(reset_password_token: token)
if staff.blank?
return redirect_to staff_reset_password_path(token),
alert: 'Url token is not valid'
end
unless verify_recaptcha(model: staff)
return redirect_to staff_reset_password_path(token),
alert: 'Captcha not valid, please try again!'
end
password_params = {
password_confirmation: params_password[:password_confirmation],
password: params_password[:password]
}
service = StaffService::ForgotPassword.new(staff, password_params)
if service.reset_password!
redirect_to staff_reset_password_path(token),
notice: 'Successfully change password'
else
redirect_to staff_reset_password_path(token),
alert: staff.errors.full_messages.uniq.to_sentence
end
end
|
#landing_page ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'app/controllers/password_controller.rb', line 6
def landing_page
unless params[:hash].present? && params[:original_email].present?
return render plain: 'Page not found', status: 404
end
unless User.is_valid_hash_email?(params[:hash], params[:original_email])
render plain: 'Page not found', status: 404
end
end
|
#staff_landing_page ⇒ Object
15
|
# File 'app/controllers/password_controller.rb', line 15
def staff_landing_page; end
|