Class: RailsJwtAuth::PasswordsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RailsJwtAuth::PasswordsController
show all
- Includes:
- ParamsHelper, RenderHelper
- Defined in:
- app/controllers/rails_jwt_auth/passwords_controller.rb
Instance Method Summary
collapse
#render_204, #render_404, #render_422, #render_registration, #render_session
Instance Method Details
#create ⇒ Object
6
7
8
9
10
11
|
# File 'app/controllers/rails_jwt_auth/passwords_controller.rb', line 6
def create
user = RailsJwtAuth.model.where(email: password_create_params[:email].to_s.downcase).first
return render_422(email: [{error: :not_found}]) unless user
user.send_reset_password_instructions ? render_204 : render_422(user.errors.details)
end
|
#update ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/rails_jwt_auth/passwords_controller.rb', line 13
def update
return render_404 unless
params[:id] &&
(user = RailsJwtAuth.model.where(reset_password_token: params[:id]).first)
return render_422(password: [{error: :blank}]) if password_update_params[:password].blank?
user.update(password_update_params) ? render_204 : render_422(user.errors.details)
end
|