Skip to content

Commit

Permalink
Merge pull request #715 from EvanBldy/master
Browse files Browse the repository at this point in the history
various improvements
  • Loading branch information
EvanBldy authored Oct 2, 2023
2 parents 91e6c32 + bf9d2be commit 35931f1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Vagrantfile
/previews/
/thumbnails/
/indexes/
release.sh

tmp
restore.sh
7 changes: 7 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
git pull --rebase origin master
last_release_number=$(python -c "from zou import __version__; print(__version__)")
release_number=$(echo ${last_release_number} | awk -F. -v OFS=. '{$NF += 1 ; print}')
echo "__version__ = \"$release_number\"" > zou/__init__.py
git commit zou/__init__.py -m $release_number
git tag v$release_number
git push origin master --tag
10 changes: 5 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ install_requires =
flask_principal==0.4.0
flask_restful==0.3.10
flask_sqlalchemy==3.1.1
flask-fs2[swift, s3]==0.7.19
flask-fs2[swift, s3]==0.7.20
flask-jwt-extended==4.5.2
flask-migrate==4.0.5
flask-socketio==5.3.6
flask==2.3.3
gazu==0.9.11
gazu==0.9.12
gevent-websocket==0.10.1
gevent==23.9.1
gunicorn==21.2.0
Expand All @@ -59,14 +59,14 @@ install_requires =
orjson==3.9.7
pillow==10.0.1
psutil==5.9.5
psycopg[binary]==3.1.11
psycopg[binary]==3.1.12
pygelf==0.4.2
pyotp==2.9.0
python-nomad==2.0.0
python-slugify==8.0.1
python-socketio==5.9.0
pytz==2023.3.post1
redis==5.0.0
redis==5.0.1
requests==2.31.0
rq==1.15.1
slackclient==2.9.4
Expand All @@ -91,7 +91,7 @@ dev =
wheel

test =
fakeredis==2.18.1
fakeredis==2.19.0
mixer==7.2.2
pytest-cov==4.1.0
pytest==7.4.2
Expand Down
21 changes: 15 additions & 6 deletions zou/app/blueprints/auth/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ def post(self):
set_access_cookies(response, access_token)
set_refresh_cookies(response, refresh_token)
events_service.create_login_log(user["id"], ip_address, "web")

else:
events_service.create_login_log(
user["id"], ip_address, "script"
Expand All @@ -324,13 +323,13 @@ def post(self):
"access_token": access_token,
"refresh_token": refresh_token,
}

current_app.logger.info(f"User {email} is logged in.")
return response
except WrongUserException:
current_app.logger.info("User %s is not registered." % email)
current_app.logger.info(f"User {email} is not registered.")
return {"login": False}, 400
except WrongPasswordException:
current_app.logger.info("User %s gave a wrong password." % email)
current_app.logger.info(f"User {email} gave a wrong password.")
return {"login": False}, 400
except NoAuthStrategyConfigured:
current_app.logger.info(
Expand All @@ -339,22 +338,26 @@ def post(self):
return {"login": False}, 409
except UserCantConnectDueToNoFallback:
current_app.logger.info(
"User %s can't login due to no fallback from LDAP." % email
f"User {email} can't login due to no fallback from LDAP."
)
return {"login": False}, 400
except TimeoutError:
current_app.logger.info("Timeout occurs while logging in.")
return {"login": False}, 400
except UnactiveUserException:
current_app.logger.info(f"User {email} is unactive.")
return (
{
"error": True,
"login": False,
"message": "User is inactive, he cannot log in.",
"message": "User is unactive, he cannot log in.",
},
400,
)
except TooMuchLoginFailedAttemps:
current_app.logger.info(
f"User {email} can't log in due to too much login failed attemps."
)
return (
{
"error": True,
Expand All @@ -364,6 +367,9 @@ def post(self):
400,
)
except MissingOTPException as e:
current_app.logger.info(
f"User {email} can't log in due to missing OTP."
)
return (
{
"error": True,
Expand All @@ -375,6 +381,9 @@ def post(self):
400,
)
except WrongOTPException:
current_app.logger.info(
f"User {email} can't log in due to wrong OTP."
)
return (
{
"error": True,
Expand Down

0 comments on commit 35931f1

Please sign in to comment.