Skip to content

Commit c71fdd7

Browse files
prakhar1989bojeil-google
authored andcommitted
Updated README with new api, added testAuth process for correctly asserting requests
1 parent 4407bd8 commit c71fdd7

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,21 @@ ui.start('#firebaseui-auth-container', {
385385
});
386386
```
387387

388+
### Configure Email Provider
389+
390+
The `EmailAuthProvider` can be configured to require the user to enter a display name (defaults to `true`).
391+
392+
```javascript
393+
ui.start('#firebaseui-auth-container', {
394+
signInOptions = [
395+
{
396+
provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
397+
requireDisplayName: false
398+
}
399+
]
400+
});
401+
```
402+
388403
### Sign In Flows
389404

390405
Two sign in flows are available:
@@ -469,7 +484,11 @@ FirebaseUI is displayed.
469484
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
470485
firebase.auth.FacebookAuthProvider.PROVIDER_ID,
471486
firebase.auth.TwitterAuthProvider.PROVIDER_ID,
472-
firebase.auth.EmailAuthProvider.PROVIDER_ID
487+
{
488+
provider: firebase.auth.EmailAuthProvider.PROVIDER_ID,
489+
// Whether the display name should be displayed in the Sign Up page.
490+
requireDisplayName: true
491+
}
473492
],
474493
// Terms of service url.
475494
tosUrl: '<your-tos-url>'

javascript/ui/page/passwordsignup_test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ function testFocusOnEmailEnter_nameIsNotRequired() {
167167
// When name is not present, the focus should move to
168168
// password field on pressing enter.
169169
goog.testing.events.fireKeySequence(
170-
component.getEmailElement(), goog.events.KeyCodes.ENTER);
170+
component.getEmailElement(), goog.events.KeyCodes.ENTER);
171171
assertEquals(
172-
component.getNewPasswordElement(),
173-
goog.dom.getActiveElement(document));
172+
component.getNewPasswordElement(),
173+
goog.dom.getActiveElement(document));
174174
}
175175

176176

javascript/widgets/handler/passwordsignup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ firebaseui.auth.widget.handler.onSignUpSubmit_ = function(app, component) {
116116
}));
117117
} else {
118118
return firebaseui.auth.widget.handler.common.setLoggedIn(
119-
app, component, emailPassCred);
119+
app, component, emailPassCred);
120120
}
121121
},
122122
function(error) {

javascript/widgets/handler/passwordsignup_test.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ function testHandlePasswordSignUp_withoutDisplayName() {
103103
goog.dom.forms.setValue(getNewPasswordElement(), '123123');
104104
submitForm();
105105

106-
// assert successful sign up without the updateProfile
107-
// being called
106+
// assert successful sign up without updateProfile being called
108107
testAuth.assertCreateUserWithEmailAndPassword(
109108
[passwordAccount.getEmail(), '123123'], function() {
110109
testAuth.setUser({
@@ -113,7 +112,18 @@ function testHandlePasswordSignUp_withoutDisplayName() {
113112
});
114113
return testAuth.currentUser;
115114
});
116-
testAuth.assertSignOut([]);
115+
return testAuth.process().then(function() {
116+
testAuth.assertSignOut([]);
117+
return testAuth.process();
118+
}).then(function() {
119+
externalAuth.setUser(testAuth.currentUser);
120+
var cred = new firebase.auth.EmailAuthProvider.credential(
121+
passwordAccount.getEmail(), '123123');
122+
externalAuth.assertSignInWithCredential([cred], externalAuth.currentUser);
123+
return externalAuth.process();
124+
}).then(function() {
125+
testUtil.assertGoTo('http://localhost/home');
126+
});
117127
}
118128

119129

0 commit comments

Comments
 (0)