@@ -60,7 +60,10 @@ function getUiConfig() {
60
60
provider : firebase . auth . EmailAuthProvider . PROVIDER_ID ,
61
61
// Whether the display name should be displayed in Sign Up page.
62
62
requireDisplayName : true ,
63
- signInMethod : getEmailSignInMethod ( )
63
+ signInMethod : getEmailSignInMethod ( ) ,
64
+ disableSignUp : {
65
+ status : getDisableSignUpStatus ( )
66
+ }
64
67
} ,
65
68
{
66
69
provider : firebase . auth . PhoneAuthProvider . PROVIDER_ID ,
@@ -183,17 +186,20 @@ var deleteAccount = function() {
183
186
184
187
185
188
/**
186
- * Handles when the user changes the reCAPTCHA or email signInMethod config.
189
+ * Handles when the user changes the reCAPTCHA, email signInMethod or email
190
+ * disableSignUp config.
187
191
*/
188
192
function handleConfigChange ( ) {
189
193
var newRecaptchaValue = document . querySelector (
190
194
'input[name="recaptcha"]:checked' ) . value ;
191
195
var newEmailSignInMethodValue = document . querySelector (
192
196
'input[name="emailSignInMethod"]:checked' ) . value ;
197
+ var currentDisableSignUpStatus =
198
+ document . getElementById ( "email-disableSignUp-status" ) . checked ;
193
199
location . replace (
194
200
location . pathname + '#recaptcha=' + newRecaptchaValue +
195
- '&emailSignInMethod=' + newEmailSignInMethodValue ) ;
196
-
201
+ '&emailSignInMethod=' + newEmailSignInMethodValue +
202
+ '&disableEmailSignUpStatus=' + currentDisableSignUpStatus ) ;
197
203
// Reset the inline widget so the config changes are reflected.
198
204
ui . reset ( ) ;
199
205
ui . start ( '#firebaseui-container' , getUiConfig ( ) ) ;
@@ -233,6 +239,10 @@ var initApp = function() {
233
239
document . querySelector (
234
240
'input[name="emailSignInMethod"][value="' + getEmailSignInMethod ( ) + '"]' )
235
241
. checked = true ;
242
+ document . getElementById ( 'email-disableSignUp-status' ) . addEventListener (
243
+ 'change' , handleConfigChange ) ;
244
+ document . getElementById ( "email-disableSignUp-status" ) . checked =
245
+ getDisableSignUpStatus ( ) ;
236
246
} ;
237
247
238
248
window . addEventListener ( 'load' , initApp ) ;
0 commit comments