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

feat: Remove name and firstname from API key creation #602

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 0 additions & 8 deletions exodus/trackers/templates/new_api_key.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ <h2>New API key</h2>
<label for="email">Email address</label>
<input type="email" class="form-control" name="email" id="email" placeholder="Enter email" required>
</div>
<div class="form-group">
<label for="first-name">First name</label>
<input type="type" class="form-control" name="first-name" id="first-name" placeholder="Enter first name" required>
</div>
<div class="form-group">
<label for="last-name">Last name</label>
<input type="type" class="form-control" name="last-name" id="last-name" placeholder="Enter last name" required>
</div>
<button type="submit" class="btn btn-primary mt-2">Create new API key</button>
</form>
<div class="mt-4">
Expand Down
5 changes: 1 addition & 4 deletions exodus/trackers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,15 @@ def new_api_key(request):
if request.method == 'POST':
try:
password = ''.join(random.choice(string.ascii_lowercase) for i in range(24))
third_parties_group = Group.objects.get(name='third-parties')

new_user = User.objects.create_user(
username=request.POST.get('username'),
password=password,
email=request.POST.get('email'),
first_name=request.POST.get('first-name'),
last_name=request.POST.get('last-name')
)

third_parties_group = Group.objects.get(name='third-parties')
third_parties_group.user_set.add(new_user)

api_key = Token.objects.get(user=new_user)

data['api_key'] = api_key
Expand Down
Loading