@@ -17,8 +17,8 @@ export function initAdminCommon() {
17
17
if ( $ ( this ) . val ( ) . substring ( 0 , 1 ) === '0' ) {
18
18
$ ( '#user_name' ) . removeAttr ( 'disabled' ) ;
19
19
$ ( '#login_name' ) . removeAttr ( 'required' ) ;
20
- hideElem ( $ ( '.non-local' ) ) ;
21
- showElem ( $ ( '.local' ) ) ;
20
+ hideElem ( '.non-local' ) ;
21
+ showElem ( '.local' ) ;
22
22
$ ( '#user_name' ) . trigger ( 'focus' ) ;
23
23
24
24
if ( $ ( this ) . data ( 'password' ) === 'required' ) {
@@ -29,8 +29,8 @@ export function initAdminCommon() {
29
29
$ ( '#user_name' ) . attr ( 'disabled' , 'disabled' ) ;
30
30
}
31
31
$ ( '#login_name' ) . attr ( 'required' , 'required' ) ;
32
- showElem ( $ ( '.non-local' ) ) ;
33
- hideElem ( $ ( '.local' ) ) ;
32
+ showElem ( '.non-local' ) ;
33
+ hideElem ( '.local' ) ;
34
34
$ ( '#login_name' ) . trigger ( 'focus' ) ;
35
35
36
36
$ ( '#password' ) . removeAttr ( 'required' ) ;
@@ -40,9 +40,9 @@ export function initAdminCommon() {
40
40
41
41
function onSecurityProtocolChange ( ) {
42
42
if ( $ ( '#security_protocol' ) . val ( ) > 0 ) {
43
- showElem ( $ ( '.has-tls' ) ) ;
43
+ showElem ( '.has-tls' ) ;
44
44
} else {
45
- hideElem ( $ ( '.has-tls' ) ) ;
45
+ hideElem ( '.has-tls' ) ;
46
46
}
47
47
}
48
48
@@ -57,29 +57,29 @@ export function initAdminCommon() {
57
57
}
58
58
59
59
function onOAuth2Change ( applyDefaultValues ) {
60
- hideElem ( $ ( '.open_id_connect_auto_discovery_url, .oauth2_use_custom_url' ) ) ;
60
+ hideElem ( '.open_id_connect_auto_discovery_url, .oauth2_use_custom_url' ) ;
61
61
$ ( '.open_id_connect_auto_discovery_url input[required]' ) . removeAttr ( 'required' ) ;
62
62
63
63
const provider = $ ( '#oauth2_provider' ) . val ( ) ;
64
64
switch ( provider ) {
65
65
case 'openidConnect' :
66
66
$ ( '.open_id_connect_auto_discovery_url input' ) . attr ( 'required' , 'required' ) ;
67
- showElem ( $ ( '.open_id_connect_auto_discovery_url' ) ) ;
67
+ showElem ( '.open_id_connect_auto_discovery_url' ) ;
68
68
break ;
69
69
default :
70
70
if ( $ ( `#${ provider } _customURLSettings` ) . data ( 'required' ) ) {
71
71
$ ( '#oauth2_use_custom_url' ) . attr ( 'checked' , 'checked' ) ;
72
72
}
73
73
if ( $ ( `#${ provider } _customURLSettings` ) . data ( 'available' ) ) {
74
- showElem ( $ ( '.oauth2_use_custom_url' ) ) ;
74
+ showElem ( '.oauth2_use_custom_url' ) ;
75
75
}
76
76
}
77
77
onOAuth2UseCustomURLChange ( applyDefaultValues ) ;
78
78
}
79
79
80
80
function onOAuth2UseCustomURLChange ( applyDefaultValues ) {
81
81
const provider = $ ( '#oauth2_provider' ) . val ( ) ;
82
- hideElem ( $ ( '.oauth2_use_custom_url_field' ) ) ;
82
+ hideElem ( '.oauth2_use_custom_url_field' ) ;
83
83
$ ( '.oauth2_use_custom_url_field input[required]' ) . removeAttr ( 'required' ) ;
84
84
85
85
if ( document . getElementById ( 'oauth2_use_custom_url' ) ?. checked ) {
@@ -102,38 +102,38 @@ export function initAdminCommon() {
102
102
// New authentication
103
103
if ( $ ( '.admin.new.authentication' ) . length > 0 ) {
104
104
$ ( '#auth_type' ) . on ( 'change' , function ( ) {
105
- hideElem ( $ ( '.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls, .search-page-size, .sspi' ) ) ;
105
+ hideElem ( '.ldap, .dldap, .smtp, .pam, .oauth2, .has-tls, .search-page-size, .sspi' ) ;
106
106
107
107
$ ( '.ldap input[required], .binddnrequired input[required], .dldap input[required], .smtp input[required], .pam input[required], .oauth2 input[required], .has-tls input[required], .sspi input[required]' ) . removeAttr ( 'required' ) ;
108
108
$ ( '.binddnrequired' ) . removeClass ( 'required' ) ;
109
109
110
110
const authType = $ ( this ) . val ( ) ;
111
111
switch ( authType ) {
112
112
case '2' : // LDAP
113
- showElem ( $ ( '.ldap' ) ) ;
113
+ showElem ( '.ldap' ) ;
114
114
$ ( '.binddnrequired input, .ldap div.required:not(.dldap) input' ) . attr ( 'required' , 'required' ) ;
115
115
$ ( '.binddnrequired' ) . addClass ( 'required' ) ;
116
116
break ;
117
117
case '3' : // SMTP
118
- showElem ( $ ( '.smtp' ) ) ;
119
- showElem ( $ ( '.has-tls' ) ) ;
118
+ showElem ( '.smtp' ) ;
119
+ showElem ( '.has-tls' ) ;
120
120
$ ( '.smtp div.required input, .has-tls' ) . attr ( 'required' , 'required' ) ;
121
121
break ;
122
122
case '4' : // PAM
123
- showElem ( $ ( '.pam' ) ) ;
123
+ showElem ( '.pam' ) ;
124
124
$ ( '.pam input' ) . attr ( 'required' , 'required' ) ;
125
125
break ;
126
126
case '5' : // LDAP
127
- showElem ( $ ( '.dldap' ) ) ;
127
+ showElem ( '.dldap' ) ;
128
128
$ ( '.dldap div.required:not(.ldap) input' ) . attr ( 'required' , 'required' ) ;
129
129
break ;
130
130
case '6' : // OAuth2
131
- showElem ( $ ( '.oauth2' ) ) ;
131
+ showElem ( '.oauth2' ) ;
132
132
$ ( '.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input' ) . attr ( 'required' , 'required' ) ;
133
133
onOAuth2Change ( true ) ;
134
134
break ;
135
135
case '7' : // SSPI
136
- showElem ( $ ( '.sspi' ) ) ;
136
+ showElem ( '.sspi' ) ;
137
137
$ ( '.sspi div.required input' ) . attr ( 'required' , 'required' ) ;
138
138
break ;
139
139
}
0 commit comments