@@ -31,7 +31,7 @@ goog.require('firebaseui.auth.ui.page.Base');
31
31
/**
32
32
* Password sign-up UI component.
33
33
* @param {?string } tosUrl The ToS URL.
34
- * @param {bool } showDisplayName Whether to show the display name.
34
+ * @param {boolean } showDisplayName Whether to show the display name.
35
35
* @param {function() } onSubmitClick Callback to invoke when the submit button
36
36
* is clicked.
37
37
* @param {function()= } opt_onCancelClick Callback to invoke when the cancel
@@ -65,6 +65,7 @@ firebaseui.auth.ui.page.PasswordSignUp = function(
65
65
'passwordSignUp' ) ;
66
66
this . onSubmitClick_ = onSubmitClick ;
67
67
this . onCancelClick_ = opt_onCancelClick ;
68
+ this . showDisplayName_ = showDisplayName ;
68
69
} ;
69
70
goog . inherits ( firebaseui . auth . ui . page . PasswordSignUp ,
70
71
firebaseui . auth . ui . page . Base ) ;
@@ -73,7 +74,9 @@ goog.inherits(firebaseui.auth.ui.page.PasswordSignUp,
73
74
/** @override */
74
75
firebaseui . auth . ui . page . PasswordSignUp . prototype . enterDocument = function ( ) {
75
76
this . initEmailElement ( ) ;
76
- this . initNameElement ( ) ;
77
+ if ( this . showDisplayName_ ) {
78
+ this . initNameElement ( ) ;
79
+ }
77
80
this . initNewPasswordElement ( ) ;
78
81
this . initFormElement ( this . onSubmitClick_ , this . onCancelClick_ ) ;
79
82
this . setupFocus_ ( ) ;
@@ -95,8 +98,12 @@ firebaseui.auth.ui.page.PasswordSignUp.prototype.disposeInternal = function() {
95
98
*/
96
99
firebaseui . auth . ui . page . PasswordSignUp . prototype . setupFocus_ = function ( ) {
97
100
// Focus order.
98
- this . focusToNextOnEnter ( this . getEmailElement ( ) , this . getNameElement ( ) ) ;
99
- this . focusToNextOnEnter ( this . getNameElement ( ) , this . getNewPasswordElement ( ) ) ;
101
+ if ( this . showDisplayName_ ) {
102
+ this . focusToNextOnEnter ( this . getEmailElement ( ) , this . getNameElement ( ) ) ;
103
+ this . focusToNextOnEnter ( this . getNameElement ( ) , this . getNewPasswordElement ( ) ) ;
104
+ } else {
105
+ this . focusToNextOnEnter ( this . getEmailElement ( ) , this . getNewPasswordElement ( ) ) ;
106
+ }
100
107
101
108
// On enter in password element.
102
109
// TODO: Investigate why the compiler complains about onSubmitClick_ being
@@ -108,7 +115,8 @@ firebaseui.auth.ui.page.PasswordSignUp.prototype.setupFocus_ = function() {
108
115
// Auto focus.
109
116
if ( ! firebaseui . auth . ui . element . getInputValue ( this . getEmailElement ( ) ) ) {
110
117
this . getEmailElement ( ) . focus ( ) ;
111
- } else if ( ! firebaseui . auth . ui . element . getInputValue ( this . getNameElement ( ) ) ) {
118
+ } else if ( this . showDisplayName_ &&
119
+ ! firebaseui . auth . ui . element . getInputValue ( this . getNameElement ( ) ) ) {
112
120
this . getNameElement ( ) . focus ( ) ;
113
121
} else {
114
122
this . getNewPasswordElement ( ) . focus ( ) ;
0 commit comments