*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit e94ff6c5 authored by Moser, Maximilian's avatar Moser, Maximilian
Browse files

Remember the selected identity provider

parent 26b9db71
No related branches found
No related tags found
1 merge request!3Replace the dropdown list with a combobox
......@@ -44,6 +44,9 @@ $.widget("custom.combobox", {
var logoElement = $("#idp_logo");
logoElement.attr("src", ui.item.option.dataset.logoUrl);
logoElement.attr("alt", "Logo of " + ui.item.option.label);
// Save the selection for next time
localStorage.setItem("selectedIdp", ui.item.option.value);
},
autocompletechange: "_removeIfInvalid",
keydown: function (event) {
......@@ -155,6 +158,12 @@ if (selectionDiv.length) {
name: "idp_entity_id",
});
// check for the saved IdP selection
var selectedIdp = localStorage.getItem("selectedIdp");
if (selectedIdp == null) {
selectedIdp = dataElements.data("default");
}
// translate the datalist values into dropdown options
for (var idpEntry of dataElements.children()) {
var option = $("<option>", {
......@@ -163,7 +172,7 @@ if (selectionDiv.length) {
"data-logo-url": idpEntry.dataset.logoUrl,
});
option.text(idpEntry.text);
if (option.val() == dataElements.data("default")) {
if (option.val() == selectedIdp) {
option.attr("selected", true);
logo.attr("src", option.data("logo-url"));
logo.attr("alt", "Logo of " + option.attr("label"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment