Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid empty credentials #423

Merged
merged 23 commits into from
Apr 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix precommit
  • Loading branch information
alejandroroiz committed Apr 4, 2024
commit e04726fbe340e454f74b966eb9d86baf1a7eeba8
11 changes: 6 additions & 5 deletions confidant/routes/credentials.py
Original file line number Diff line number Diff line change
@@ -627,13 +627,13 @@ def create_credential():
for key, value in credential_pairs.items():
value = escape(value)
credential_pairs[key] = value

# Verify this credential is not a duplicate of an existing credential
is_duplicate, duplicate_id = credentialmanager.is_key_value_pair_duplicate(
credential_pairs
)
if is_duplicate:
msg = '''Credential with the same key value pairs already exists.
msg = '''Credential with the same key value pairs already exists.
See id: {0}'''.format(duplicate_id)
return jsonify({'error': msg, 'reference': duplicate_id}), 409

@@ -881,9 +881,10 @@ def update_credential(id):
update['last_rotation_date'] = misc.utcnow()

# Verify if after update the credential will not be a duplicate
is_duplicate, duplicate_id = credentialmanager.is_key_value_pair_duplicate(
credential_pairs
)
is_duplicate, duplicate_id = \
credentialmanager.is_key_value_pair_duplicate(
credential_pairs
)
if is_duplicate:
msg = '''Credential with the same key value pairs already exists.
See id: {0}'''.format(duplicate_id)
Loading