You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is part of a set of improvements to help improve the way that the Private access (shared password method) works. See #10588
We want to make it easier for users to choose more secure values for this shared password, making it harder to guess and also gain access to easily with over the shoulder viewing of editors.
Describe the solution you'd like
Add the ability to generate a randomized string and also copy the value to the clipboard easily. Example screenshot below.
This would involve;
Enhancing client/src/controllers/ActionController.ts (ActionController) with the ability to create a random value.
Enhancing ActionController to support it's actions targeting a specific element with a custom selector value.
<spanclass="w-text-grey-50 w-absolute w-right-2 w-bg-critical-100 w-p-2 w-rounded-sm">{% trans 'Copying to clipboard failed' %}</span>
</template>
</div>
Important: It may make more sense to add this behaviour to the SlugController and rename that controller to something like CleanController (for cleaning/modifying field input values). Generally the change will be the same, have a read and provide thoughts in the comments.
ActionController - adding a new value
This controller is a bit of a toolkit controller, it let's us perform some kind of simple action on a button or input with Stimulus easily.
We will want to abstract the ability to get the most suitable target element. Read up on Stimulus values and actions if you are not sure what's happening here.
From there, we should really update all other methods to use this. e.g.
click(){this.element.click();}// would be replaced with.click(event){this.getTarget(event).click();}
The other methods will be a bit more complex but not too much more.
ActionController - Add a unique method.
This would be very similar to reset on the ActionController but use a way to generate a set of unique values and output them as a string.
We would want to dispatch a change event also.
unique(event){constcount=5constarray=newUint32Array(5);// get the count from params/detail if possible.constnewValue=[...window.crypto.getRandomValues(array)].map(val=>val.toString(36)).join('-');// update the this.getTarget().value to the new value}
If we're going to include a password generator, we should make sure it works and is secure. window.crypto tends to only work in secure contexts (eg HTTPS and localhost), which might be an issue for some. Also, it would need to interact with Django's password validator framework, which is going to be quite complex.
Is your proposal related to a problem?
This is part of a set of improvements to help improve the way that the Private access (shared password method) works. See #10588
We want to make it easier for users to choose more secure values for this shared password, making it harder to guess and also gain access to easily with over the shoulder viewing of editors.
Describe the solution you'd like
Add the ability to generate a randomized string and also copy the value to the clipboard easily. Example screenshot below.
This would involve;
client/src/controllers/ActionController.ts
(ActionController) with the ability to create a random value.ActionController
to support it's actions targeting a specific element with a custom selector value.ClipboardController
for this field to support easy copy to clipboard behaviour. You can see how this is used in Feature/3683 url generator add copy button #11317 & Image URL generator is confusing for end users #3683 & the code snippet below.wagtail/wagtail/images/templates/wagtailimages/images/url_generator.html
Lines 34 to 48 in 54802ab
Important: It may make more sense to add this behaviour to the
SlugController
and rename that controller to something likeCleanController
(for cleaning/modifying field input values). Generally the change will be the same, have a read and provide thoughts in the comments.ActionController
- adding a new valueThis controller is a bit of a toolkit controller, it let's us perform some kind of simple action on a button or input with Stimulus easily.
We will want to abstract the ability to get the most suitable target element. Read up on Stimulus values and actions if you are not sure what's happening here.
From there, we should really update all other methods to use this. e.g.
The other methods will be a bit more complex but not too much more.
ActionController
- Add aunique
method.This would be very similar to
reset
on the ActionController but use a way to generate a set of unique values and output them as a string.We would want to dispatch a change event also.
Describe alternatives you've considered
Multiple discussions have been had on #10588
Additional context
Working on this
The text was updated successfully, but these errors were encountered: