Skip to content

Commit

Permalink
feat: Remove name and firstname from API key creation (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnu-s authored Jan 18, 2024
1 parent da5e08a commit 4069aad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
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

0 comments on commit 4069aad

Please sign in to comment.