Problem/Motivation
Labels entered for custom AAGUIDs ("Additional AAGUIDs" textarea, format aaguid|Label) are lost the next time the settings form is saved. The AAGUIDs stay allowed, but they are displayed as "Unknown" in the user's passkey list and in the [wa:key:authenticator] token of the notification email.
Cause: PasskeyLabeler::buildProviderMap() adds every entry of custom_aaguid_labels to the provider map, so on the next form build those AAGUIDs are rendered as checkboxes in "Allowed authenticators" instead of in the textarea. PasskeySettingsForm::submitForm() then rebuilds custom_aaguid_labels only from the textarea (parsed_custom), so the labels of the checked custom AAGUIDs are discarded.
Steps to reproduce
- Go to /admin/config/people/wa.
- In "Additional AAGUIDs", enter
531126d6-e717-415c-9320-3d9aa6981239|Dashlaneand save. - Reload the form: "Dashlane" now appears as a checked checkbox in "Allowed authenticators", the textarea is empty.
- Save the form again without changing anything.
drush cget wa.settings custom_aaguid_labelsis now empty; the AAGUID is still inallowed_aaguidsbut labelled "Unknown".
Proposed resolution
In submitForm(), keep the existing label of every checked AAGUID that comes from custom_aaguid_labels, for example:
$previous = $this->config('wa.settings')->get('custom_aaguid_labels') ?? [];
$customLabels = array_intersect_key($previous, array_flip($allowedKnown));
foreach ($parsedCustom as $pair) {
if ($pair['label'] !== '') {
$customLabels[$pair['aaguid']] = $pair['label'];
}
}
Alternatively, keep custom AAGUIDs in the textarea (with their labels) instead of turning them into checkboxes.
Issue fork wa-3641545
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
vinodhini.e commentedComment #8
mingsongFixed with 2.1.0-beta4.
Thanks.