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

api token page - unable to see generated token key after creation (if no key supplied) #13434

Closed
ITJamie opened this issue Aug 10, 2023 · 3 comments
Assignees
Labels
beta Concerns a bug/feature in a beta release status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@ITJamie
Copy link
Contributor

ITJamie commented Aug 10, 2023

NetBox version

v3.6-beta1

Python version

3.10

Steps to Reproduce

goto admin > api tokens > add api token
select a user,
do not fill in the key field (key will be autogenerated)
after creation there is no way to see/copy the generated key

Expected Behavior

the generated key should be visible after creation
also maybe admins should be able to view full keys?

Observed Behavior

unable to copy / see the generated API key

@ITJamie ITJamie added the type: bug A confirmed report of unexpected behavior in the application label Aug 10, 2023
@jeremystretch jeremystretch added the beta Concerns a bug/feature in a beta release label Aug 10, 2023
@jeremystretch jeremystretch self-assigned this Aug 10, 2023
@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Aug 10, 2023
@jeremystretch
Copy link
Member

jeremystretch commented Aug 10, 2023

@jsenecal suggested reworking the forms a bit so that the token value is generated when the form is rendered, providing the user an opportunity to record it prior to creating the token in the database. I really like this approach because it obviates the need to introduce any complex logic in the views, which now utilize the generic ObjectEditView.

@ITJamie
Copy link
Contributor Author

ITJamie commented Aug 10, 2023

so the field would be prefilled and new validation to require a value to be supplied (and potentially make sure it has a minimum amount of characters and isn't something silly like "password")?

@jeremystretch
Copy link
Member

jeremystretch commented Aug 10, 2023

It means the form field will be pre-populated with a randomly-generated key. No changes to validation are needed, other than the field now being marked as required.

jeremystretch added a commit that referenced this issue Aug 10, 2023
jeremystretch added a commit that referenced this issue Aug 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beta Concerns a bug/feature in a beta release status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants