fix(controller/user/session): return 401 upon authentication error
This commit is contained in:
parent
b69158241a
commit
a5e61f9c5c
1 changed files with 9 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
"""
|
"""
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
|
|
||||||
from httpaste.helper.http import ForbiddenError
|
from httpaste.helper.http import UnauthorizedError
|
||||||
from httpaste.model.user import authenticate, AuthenticationError
|
from httpaste.model.user import authenticate, AuthenticationError
|
||||||
from httpaste.backend import load_backend
|
from httpaste.backend import load_backend
|
||||||
|
|
||||||
|
|
@ -22,4 +22,11 @@ def post(*args, **kwargs):
|
||||||
return authenticate(user_id, password, backend.user, context)
|
return authenticate(user_id, password, backend.user, context)
|
||||||
except AuthenticationError as e:
|
except AuthenticationError as e:
|
||||||
|
|
||||||
raise ForbiddenError('You shall not pass!') from e
|
raise UnauthorizedError('You shall not pass!') from e
|
||||||
|
|
||||||
|
|
||||||
|
def delete(**kwargs):
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
raise UnauthorizedError('Authentication Rejection requested by client')
|
||||||
Loading…
Add table
Add a link
Reference in a new issue