Skip to content

Commit

Permalink
sign out view added
Browse files Browse the repository at this point in the history
  • Loading branch information
mh-malekpour committed May 22, 2020
1 parent 7a2121b commit cf371ec
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
20 changes: 20 additions & 0 deletions api-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,26 @@ or

----------

### `/users/log_out`

method: `PATCH`

*input*:
Authorization Header:

- Bearer \<access token>

Body:

- None

*output*:

response code will be **204**

- The server successfully processed the request and is not returning any content.

----------

### `/users/get_user`

Expand Down
12 changes: 10 additions & 2 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def login():
@jwt_refresh_token_required
def get_new_access_token():
identity = get_jwt_identity()
return {'access_token': f'{create_access_token(identity=identity)}'}
return {'access_token': f'{create_access_token(identity=identity)}'}, 200


@users.route('/signup/resendConfrimation', methods=['GET'])
Expand Down Expand Up @@ -99,6 +99,14 @@ def change_password():
db.session.commit()
return {}, 204


@users.route('/signout', methods=['PATCH'])
def log_out():
identity = get_jwt_identity()
user = User.query.filter_by(Email=identity).first()
return {}, 204


@users.route('/get_user', methods=['GET'])
@jwt_required
def get_user():
Expand All @@ -107,4 +115,4 @@ def get_user():
return {'full_name': f'{user.FullName}',
'email': f'{user.Email}',
'confirmed': f'{user.Confirmed}'}

0 comments on commit cf371ec

Please sign in to comment.