@@ -272,6 +272,7 @@ function getNewLoginShell() {
272
272
}
273
273
return $("#customLoginBox").val();
274
274
}
275
+
275
276
function isLoginShellValid(x) {
276
277
if (x.trim().length === 0) {
277
278
return false;
@@ -282,21 +283,31 @@ function isLoginShellValid(x) {
282
283
}
283
284
return true;
284
285
}
286
+
287
+ function enableOrDisableCustomLoginBoxHighlight() {
288
+ if (
289
+ ($("#loginSelector").val() == "Custom") &&
290
+ !isLoginShellValid($("#customLoginBox").val())
291
+ ) {
292
+ $("#customLoginBox").css("box-shadow", "0 0 0 0.3rem rgba(220, 53, 69, 0.25)");
293
+ } else {
294
+ $("#customLoginBox").css("box-shadow", "none");
295
+ }
296
+ }
297
+ $("#customLoginBox").on("input", enableOrDisableCustomLoginBoxHighlight);
298
+ enableOrDisableCustomLoginBoxHighlight();
299
+
285
300
function enableOrDisableSubmitLoginShell() {
286
- var submitLoginShell = $("#submitLoginShell");
287
301
var newLoginShell = getNewLoginShell();
288
302
if (!isLoginShellValid(newLoginShell)) {
289
- submitLoginShell.attr("disabled", true);
290
- $("#customLoginBox").css("box-shadow", "0 0 0 0.3rem rgba(220, 53, 69, 0.25)");
303
+ $("#submitLoginShell").attr("disabled", true);
291
304
return;
292
- } else {
293
- $("#customLoginBox").css("box-shadow", "none");
294
305
}
295
306
if (newLoginShell == ldapLoginShell) {
296
- submitLoginShell.attr("disabled", true);
307
+ $("# submitLoginShell") .attr("disabled", true);
297
308
return;
298
309
}
299
- submitLoginShell.attr("disabled", false);
310
+ $("# submitLoginShell") .attr("disabled", false);
300
311
}
301
312
$("#customLoginBox").on("input", enableOrDisableSubmitLoginShell);
302
313
$("#loginSelector").change(enableOrDisableSubmitLoginShell);
0 commit comments