@@ -60,7 +60,10 @@ function getUiConfig() {
6060 provider : firebase . auth . EmailAuthProvider . PROVIDER_ID ,
6161 // Whether the display name should be displayed in Sign Up page.
6262 requireDisplayName : true ,
63- signInMethod : getEmailSignInMethod ( )
63+ signInMethod : getEmailSignInMethod ( ) ,
64+ disableSignUp : {
65+ status : getDisableSignUpStatus ( )
66+ }
6467 } ,
6568 {
6669 provider : firebase . auth . PhoneAuthProvider . PROVIDER_ID ,
@@ -183,17 +186,20 @@ var deleteAccount = function() {
183186
184187
185188/**
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.
187191 */
188192function handleConfigChange ( ) {
189193 var newRecaptchaValue = document . querySelector (
190194 'input[name="recaptcha"]:checked' ) . value ;
191195 var newEmailSignInMethodValue = document . querySelector (
192196 'input[name="emailSignInMethod"]:checked' ) . value ;
197+ var currentDisableSignUpStatus =
198+ document . getElementById ( "email-disableSignUp-status" ) . checked ;
193199 location . replace (
194200 location . pathname + '#recaptcha=' + newRecaptchaValue +
195- '&emailSignInMethod=' + newEmailSignInMethodValue ) ;
196-
201+ '&emailSignInMethod=' + newEmailSignInMethodValue +
202+ '&disableEmailSignUpStatus=' + currentDisableSignUpStatus ) ;
197203 // Reset the inline widget so the config changes are reflected.
198204 ui . reset ( ) ;
199205 ui . start ( '#firebaseui-container' , getUiConfig ( ) ) ;
@@ -233,6 +239,10 @@ var initApp = function() {
233239 document . querySelector (
234240 'input[name="emailSignInMethod"][value="' + getEmailSignInMethod ( ) + '"]' )
235241 . checked = true ;
242+ document . getElementById ( 'email-disableSignUp-status' ) . addEventListener (
243+ 'change' , handleConfigChange ) ;
244+ document . getElementById ( "email-disableSignUp-status" ) . checked =
245+ getDisableSignUpStatus ( ) ;
236246} ;
237247
238248window . addEventListener ( 'load' , initApp ) ;
0 commit comments