add flash message
This commit is contained in:
@@ -52,8 +52,13 @@ def add(
|
||||
)
|
||||
|
||||
with dyn.transact_writer() as transact:
|
||||
transact.condition(
|
||||
transact.update(
|
||||
key=KeyPair(user_id, '0'),
|
||||
# Makes the email searchable
|
||||
update_expr='ADD emails :email',
|
||||
expr_attr_values={
|
||||
':email': {email},
|
||||
},
|
||||
cond_expr='attribute_exists(sk)',
|
||||
exc_cls=UserNotFoundError,
|
||||
)
|
||||
@@ -75,6 +80,7 @@ def add(
|
||||
'sk': email,
|
||||
'created_at': now_,
|
||||
},
|
||||
# Prevent duplicate emails
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
exc_cls=EmailConflictError,
|
||||
)
|
||||
@@ -172,7 +178,7 @@ def verify(user_id: str, code: str):
|
||||
exc_cls=UserNotFoundError,
|
||||
)
|
||||
|
||||
return JSONResponse(status_code=HTTPStatus.NO_CONTENT)
|
||||
return JSONResponse(status_code=HTTPStatus.OK, body={'email_verified': email})
|
||||
|
||||
|
||||
@router.patch('/<user_id>/emails/primary')
|
||||
@@ -213,13 +219,11 @@ def primary(
|
||||
)
|
||||
transact.update(
|
||||
key=KeyPair(user_id, '0'),
|
||||
update_expr='DELETE emails :email_set \
|
||||
SET email = :email, \
|
||||
update_expr='SET email = :email, \
|
||||
email_verified = :email_verified, \
|
||||
updated_at = :now',
|
||||
expr_attr_values={
|
||||
':email': new_email,
|
||||
':email_set': {new_email},
|
||||
':email_verified': email_verified,
|
||||
':now': now_,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user