mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 17:08:30 +01:00
Only change the profile picture if data is sent (#2255)
* Only change the profile picture if data is sent * Ensure email is sent * re-use var * Ensure email is given on login * Remove arm from build images * reverted login changes
This commit is contained in:
parent
b269ce81e6
commit
8b5dc9190d
3 changed files with 8 additions and 4 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -163,7 +163,7 @@ jobs:
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,12 @@ def auth_login():
|
||||||
password = data.get("password")
|
password = data.get("password")
|
||||||
device = data.get("device")
|
device = data.get("device")
|
||||||
|
|
||||||
email = sanitize_email(data.get("email"))
|
email = data.get("email")
|
||||||
canonical_email = canonicalize_email(data.get("email"))
|
if not email:
|
||||||
|
LoginEvent(LoginEvent.ActionType.failed, LoginEvent.Source.api).send()
|
||||||
|
return jsonify(error="Email or password incorrect"), 400
|
||||||
|
email = sanitize_email(email)
|
||||||
|
canonical_email = canonicalize_email(email)
|
||||||
|
|
||||||
user = User.get_by(email=email) or User.get_by(email=canonical_email)
|
user = User.get_by(email=email) or User.get_by(email=canonical_email)
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ def update_user_info():
|
||||||
File.delete(file.id)
|
File.delete(file.id)
|
||||||
s3.delete(file.path)
|
s3.delete(file.path)
|
||||||
Session.flush()
|
Session.flush()
|
||||||
else:
|
if data["profile_picture"] is not None:
|
||||||
raw_data = base64.decodebytes(data["profile_picture"].encode())
|
raw_data = base64.decodebytes(data["profile_picture"].encode())
|
||||||
if detect_image_format(raw_data) == ImageFormat.Unknown:
|
if detect_image_format(raw_data) == ImageFormat.Unknown:
|
||||||
return jsonify(error="Unsupported image format"), 400
|
return jsonify(error="Unsupported image format"), 400
|
||||||
|
|
Loading…
Reference in a new issue