-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improve API key on user edit page #2243
Conversation
7d7d311
to
8453607
Compare
Previously translations for this page were stored in the solidus_api gem.
These are distructive operations and we don't want admins to accidentally misclick these.
This solves an occasional onboarding usability complaint: that it's hard to find your own API key. Previously you could only find it by viewing the page source or using the rails console, but it makes sense to display it here. API keys for other users remain hidden, regardless of your permissions.
8453607
to
a297480
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love that, but we could allow stores to change the permission if we had one ;)
<div id="current-api-key"><%= t('.key') %>: (<%= Spree.t('.hidden') %>)</div> | ||
<div id="current-api-key"> | ||
<strong><%= t('.key') %>: </strong> | ||
<% if @user == try_spree_current_user %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe for easier customisation we should add a
can? :reveal_api_key, @user
permission?
Somehow my comment is on an outdated commit. Copy that here:
|
Revealing should only be possible for the owner. But I’m fine with Super Admins being able to reset the key. WDYT? |
With the |
Right, the super user thing... Something we should think about changing in the future. Ok, for now we should do what you are proposing in this PR and compare the ownership right inside the view for the revealing. For clearing and resetting I think we could use a permission. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good for me, just a non-blocking comment: maybe we should use another partial for api key management so that it's easier for stores to change its logic if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This improves a few aspects of how API keys are handled and displayed on the user edit page.