Skip to content

Commit a10edb2

Browse files
prakhar1989bojeil-google
authored andcommitted
initial implementation for providing a configuration value for display name
1 parent dffd851 commit a10edb2

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

demo/public/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ var uiConfig = {
4747
firebase.auth.EmailAuthProvider.PROVIDER_ID
4848
],
4949
// Terms of service url.
50-
'tosUrl': 'https://www.google.com'
50+
'tosUrl': 'https://www.google.com',
51+
'shouldDisplayName': false
5152
};
5253

5354
// Initialize the FirebaseUI Widget using Firebase.

javascript/ui/page/passwordsignup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ goog.require('firebaseui.auth.ui.page.Base');
3131
/**
3232
* Password sign-up UI component.
3333
* @param {?string} tosUrl The ToS URL.
34+
* @param {bool} showDisplayName Whether to show the display name.
3435
* @param {function()} onSubmitClick Callback to invoke when the submit button
3536
* is clicked.
3637
* @param {function()=} opt_onCancelClick Callback to invoke when the cancel
@@ -43,6 +44,7 @@ goog.require('firebaseui.auth.ui.page.Base');
4344
*/
4445
firebaseui.auth.ui.page.PasswordSignUp = function(
4546
tosUrl,
47+
showDisplayName,
4648
onSubmitClick,
4749
opt_onCancelClick,
4850
opt_email,
@@ -54,6 +56,7 @@ firebaseui.auth.ui.page.PasswordSignUp = function(
5456
firebaseui.auth.soy2.page.passwordSignUp,
5557
{
5658
email: opt_email,
59+
showDisplayName: showDisplayName,
5760
name: opt_name,
5861
tosUrl: tosUrl,
5962
allowCancel: !!opt_onCancelClick

javascript/widgets/config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ firebaseui.auth.widget.Config = function() {
6868
this.config_.define('siteName');
6969
this.config_.define('tosUrl');
7070
this.config_.define('widgetUrl');
71+
/**
72+
* Determines whether the user is asked for entering display name
73+
* while going through the email/password signup flow.
74+
*/
75+
this.config_.define('shouldDisplayName', true);
7176
};
7277

7378

@@ -290,6 +295,12 @@ firebaseui.auth.widget.Config.prototype.getTosUrl = function() {
290295
};
291296

292297

298+
/** @return {bool} Whether the display name should be displayed. */
299+
firebaseui.auth.widget.Config.prototype.getShouldDisplayName = function() {
300+
return /** @type {bool} */ (this.config_.get('shouldDisplayName'));
301+
};
302+
303+
293304
/** @return {boolean} Whether to prefer popup mode. */
294305
firebaseui.auth.widget.Config.prototype.getPopupMode = function() {
295306
return !!this.config_.get('popupMode');

javascript/widgets/handler/passwordsignup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ firebaseui.auth.widget.handler.handlePasswordSignUp = function(
4848
// Render the UI.
4949
var component = new firebaseui.auth.ui.page.PasswordSignUp(
5050
app.getConfig().getTosUrl(),
51+
app.getConfig().getShouldDisplayName(),
5152
// On submit.
5253
function() {
5354
firebaseui.auth.widget.handler.onSignUpSubmit_(app, component);

soy/pages.soy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
*/
7777
{template .passwordSignUp}
7878
{@param? email: string} /** The email address to prefill. */
79+
{@param? showDisplayName: bool} /** Whether to show the display name. */
7980
{@param? name: string} /** The name to prefill. */
8081
{@param? tosUrl: string} /** The Terms of Service URL. */
8182
{@param? allowCancel: bool} /** Whether to show the cancel link. */
@@ -89,7 +90,9 @@
8990
</div>
9091
<div class="{css firebaseui-card-content}">
9192
{call firebaseui.auth.soy2.element.email data="all" /}
92-
{call firebaseui.auth.soy2.element.name data="all" /}
93+
{if $showDisplayName}
94+
{call firebaseui.auth.soy2.element.name data="all" /}
95+
{/if}
9396
{call firebaseui.auth.soy2.element.newPassword}
9497
{param choose: true /}
9598
{/call}

0 commit comments

Comments
 (0)