Class: DeviseTokenAuth::PasswordsController
- Inherits:
-
Devise::PasswordsController
- Object
- Devise::PasswordsController
- DeviseTokenAuth::PasswordsController
- Includes:
- Devise::Controllers::Helpers
- Defined in:
- app/controllers/devise_token_auth/passwords_controller.rb
Instance Method Summary collapse
Instance Method Details
#create {|resource| ... } ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/devise_token_auth/passwords_controller.rb', line 5 def create self.resource = resource_class.send_reset_password_instructions(resource_params) yield resource if block_given? throw "Not implemented" if resource.errors.empty? render json: { success: true } else render json: { success: false, errors: ["Something went wrong. Please contact [email protected]."] }, status: 401 end end |
#resource_params ⇒ Object
48 49 50 |
# File 'app/controllers/devise_token_auth/passwords_controller.rb', line 48 def resource_params params.permit(:email, :password, :password_confirmation, :reset_password_token) end |
#update {|resource| ... } ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/devise_token_auth/passwords_controller.rb', line 24 def update self.resource = resource_class.reset_password_by_token(resource_params) yield resource if block_given? throw "Not implemented" if resource.errors.empty? resource.unlock_access! if unlockable?(resource) render json: { success: true, data: { user: self.resource } } else render json: { success: false, errors: ["Something went wrong. Please contact [email protected]."] }, status: 401 end end |