Don't double encrypt when updating/add if not exists
This commit is contained in:
parent
ce5969e9ca
commit
0fa44d3d80
|
@ -43,7 +43,7 @@ def authentication_callback(
|
||||||
"""Authentication_callback."""
|
"""Authentication_callback."""
|
||||||
verify_token(request.args.get("token"), force_run=True)
|
verify_token(request.args.get("token"), force_run=True)
|
||||||
response = request.args["response"]
|
response = request.args["response"]
|
||||||
SecretService().update_secret(
|
SecretService.update_secret(
|
||||||
f"{service}/{auth_method}", response, g.user.id, create_if_not_exists=True
|
f"{service}/{auth_method}", response, g.user.id, create_if_not_exists=True
|
||||||
)
|
)
|
||||||
return redirect(
|
return redirect(
|
||||||
|
|
|
@ -68,9 +68,9 @@ class SecretService:
|
||||||
create_if_not_exists: Optional[bool] = False,
|
create_if_not_exists: Optional[bool] = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Does this pass pre commit?"""
|
"""Does this pass pre commit?"""
|
||||||
value = cls._encrypt(value)
|
|
||||||
secret_model = SecretModel.query.filter(SecretModel.key == key).first()
|
secret_model = SecretModel.query.filter(SecretModel.key == key).first()
|
||||||
if secret_model:
|
if secret_model:
|
||||||
|
value = cls._encrypt(value)
|
||||||
secret_model.value = value
|
secret_model.value = value
|
||||||
db.session.add(secret_model)
|
db.session.add(secret_model)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue