Class: RailsJwtAuth::ProfilesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RailsJwtAuth::ProfilesController
show all
- Includes:
- ParamsHelper, RenderHelper
- Defined in:
- app/controllers/rails_jwt_auth/profiles_controller.rb
Constant Summary
collapse
- PASSWORD_PARAMS =
%i[current_password password password_confirmation].freeze
Instance Method Summary
collapse
#render_204, #render_404, #render_410, #render_422, #render_profile, #render_registration, #render_session
Instance Method Details
#email ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/rails_jwt_auth/profiles_controller.rb', line 30
def email
return update unless current_user.is_a?(RailsJwtAuth::Confirmable)
if current_user.update_email(profile_update_email_params)
render_204
else
render_422(current_user.errors.details)
end
end
|
#password ⇒ Object
22
23
24
25
26
27
28
|
# File 'app/controllers/rails_jwt_auth/profiles_controller.rb', line 22
def password
if current_user.update_password(update_password_params)
render_204
else
render_422(current_user.errors.details)
end
end
|
#show ⇒ Object
10
11
12
|
# File 'app/controllers/rails_jwt_auth/profiles_controller.rb', line 10
def show
render_profile current_user
end
|
#update ⇒ Object
14
15
16
17
18
19
20
|
# File 'app/controllers/rails_jwt_auth/profiles_controller.rb', line 14
def update
if current_user.update(profile_update_params)
render_204
else
render_422(current_user.errors.details)
end
end
|