Class: RailsJwtAuth::PasswordsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/rails_jwt_auth/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



2
3
4
5
6
# File 'app/controllers/rails_jwt_auth/passwords_controller.rb', line 2

def create
  user = RailsJwtAuth.model.find_by!(email: create_password_params[:email])
  user.send_reset_password_instructions
  render json: {}, status: 204
end

#updateObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/rails_jwt_auth/passwords_controller.rb', line 8

def update
  user = RailsJwtAuth.model.find_by!(reset_password_token: params[:reset_password_token])

  if user.update_attributes(update_password_params)
    render json: {}, status: 204
  else
    render json: update_error_response(user), status: 422
  end
end