Skip to content
Merged
Changes from all commits
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
11 changes: 7 additions & 4 deletions helios_auth/auth_systems/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@

def create_user(username, password, name = None):
from helios_auth.models import User

user = User.get_by_type_and_id('password', username)
if user:
raise Exception('user exists')

try:
User.get_by_type_and_id('password', username)
Copy link

Copilot AI Jan 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of User.get_by_type_and_id is not assigned to any variable. While the current code works correctly for checking existence, it would be more idiomatic to assign it to a variable (e.g., user = User.get_by_type_and_id('password', username)) for consistency with other usages in the codebase (see lines 65 and 90).

Suggested change
User.get_by_type_and_id('password', username)
user = User.get_by_type_and_id('password', username)

Copilot uses AI. Check for mistakes.
except User.DoesNotExist:
pass
else:
raise ValueError(f"user '{username}' already exists")

info = {'password' : password, 'name': name}
user = User.update_or_create(user_type='password', user_id=username, info = info)
Expand Down