Skip to content

Commit fdc680d

Browse files
committed
added overall sign-XXX consistency
title can be customized for both type removed tmp data
1 parent 6c2e99e commit fdc680d

11 files changed

+51
-175
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"authors": [
55
"Pascal Gula aka MeTaNoV"
66
],
7-
"description": "Firebase Register/Login Dialog with Material Design",
7+
"description": "Firebase Sign-Up/Sign-In Dialog with Material Design",
88
"keywords": [
99
"web-component",
1010
"web-components",

demo/index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,19 @@
7474
exit-animation="fade-out-animation"
7575
providers='["facebook", "github", "google"]'
7676
modal>
77-
<h2 title>Register / Login</h2>
77+
<h2 title-sign-up>Sign-Up Dialog</h2>
78+
<h2 title-sign-in>Sign-In Dialog</h2>
7879
<b introduction>-- Welcome to the Firebase Element eXtended Demo: --</b>
79-
<b provider>-- Register/Login with one of the following provider(s): --</b>
80+
<b provider>-- Sign-In with one of the following provider(s): --</b>
8081
<b user>-- or provide your email and password : --</b>
8182
</firebase-auth-dialog>
8283

8384
<firebase-state logged="{{logged}}" user="{{user}}"></firebase-state>
8485

8586
<br>
86-
<span>Simply Register and/or Login and modify dynamically the information of your profile!</span>
87+
<span>Simply Sign-Up and/or Sign-In and modify dynamically the information of your profile!</span>
8788

88-
<h2>Login status:</h2>
89+
<h2>Sign-In status:</h2>
8990
<pre id="login">[[_showStatus(logged)]]</pre>
9091

9192
<div hidden$="{{!logged}}">

firebase-account-menu.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
7575
</paper-menu>
7676
</paper-menu-button>
7777
<div id="signedOut" hidden$="[[logged]]">
78-
<paper-button on-tap="signUpButton">Register</paper-button>
79-
<paper-button on-tap="signInButton">Login</paper-button>
78+
<paper-button on-tap="signUpButton">Sign-Up</paper-button>
79+
<paper-button on-tap="signInButton">Sign-In</paper-button>
8080
</div>
8181
</template>
8282
<script>
@@ -94,7 +94,7 @@
9494

9595
signUpButton: function() {
9696
if (this._firebaseAuthDialog) {
97-
this._firebaseAuthDialog.setAttribute('type', "Register");
97+
this._firebaseAuthDialog.setAttribute('type', "SignUp");
9898
this._firebaseAuthDialog.open();
9999
} else {
100100
console.warn("Missing registered firebaseAuthDialog");
@@ -103,7 +103,7 @@
103103

104104
signInButton: function() {
105105
if (this._firebaseAuthDialog) {
106-
this._firebaseAuthDialog.setAttribute('type', "Login");
106+
this._firebaseAuthDialog.setAttribute('type', "SignIn");
107107
this._firebaseAuthDialog.open();
108108
} else {
109109
console.warn("Missing registered firebaseAuthDialog");

firebase-auth-dialog.html

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<!--
1616
`<firebase-auth-dialog>` is a dialog with Material Design styling and optional animations that leverages firebase authentication in a flexible way. You can:
17-
- setup a 'Register' or 'Login' flavor.
17+
- setup a 'Sign-Up' or 'Sign-In' flavor.
1818
- configure the providers accessible within the dialog.
1919
- configure the Header e.g. a <h2></h2> with a "header" attribute
2020
- configure different sections: "introduction", "provider" and "user" thanks to the corresponding attribute.
@@ -24,12 +24,12 @@
2424
Example:
2525
2626
<firebase-auth-dialog
27-
type="Register"
2827
providers='["facebook", "github", "google"]'
2928
modal with-backdrop>
30-
<h2 header>FBE Demo<h2>
29+
<h2 title-sign-up>Sing-Up Dialog</h2>
30+
<h2 title-sign-in>Sign-In Dialog</h2>
3131
<span introduction>-- Welcome to the FBE Demo: --</span>
32-
<span provider>-- Login with one of the following provider(s): --</span>
32+
<span provider>-- Sign-In with one of the following provider(s): --</span>
3333
<span user>-- or provide your email and password : --</span>
3434
</firebase-auth-dialog>
3535
@@ -105,7 +105,12 @@ <h2 header>FBE Demo<h2>
105105
}
106106
</style>
107107

108-
<content select="[title]"></content>
108+
<template is="dom-if" if="[[_isSignUp(type)]]" restamp>
109+
<content select="[title-sign-up]"></content>
110+
</template>
111+
<template is="dom-if" if="[[_isSignIn(type)]]" restamp>
112+
<content select="[title-sign-in]"></content>
113+
</template>
109114

110115
<div id="introduction-section">
111116
<content select="[introduction]" id="introduction"></content>
@@ -173,8 +178,8 @@ <h2 header>FBE Demo<h2>
173178
* @enum {string}
174179
*/
175180
var DialogTypeValue = {
176-
REGISTER: 'Register',
177-
LOGIN: 'Login'
181+
SIGNUP: 'SignUp',
182+
SIGNIN: 'SignIn'
178183
};
179184

180185
Polymer({
@@ -195,7 +200,7 @@ <h2 header>FBE Demo<h2>
195200
properties: {
196201
/**
197202
* `type` indicates the type of authentication dialog to use. It can hold currently two
198-
* values, namely DialogTypeValue.REGISTER and DialogTypeValue.LOGIN.
203+
* values, namely DialogTypeValue.SIGNUP and DialogTypeValue.SIGNIN.
199204
*
200205
* @type {string}
201206
*/
@@ -205,7 +210,7 @@ <h2 header>FBE Demo<h2>
205210
},
206211

207212
/**
208-
* `providers` set the list of providers accessible for Register/Login.
213+
* `providers` set the list of providers accessible for SignUp/SignIn.
209214
*
210215
* @type {Array}
211216
*/
@@ -254,35 +259,33 @@ <h2 header>FBE Demo<h2>
254259

255260
_typeChanged: function() {
256261
switch(this.type) {
257-
case DialogTypeValue.REGISTER:
262+
case DialogTypeValue.SIGNUP:
258263
this.$.primary.setAttribute('strength-meter', '');
259264
this.$.primary.setAttribute('minlength', '6');
260265
this.$.primary.setAttribute('autocomplete', 'new-password');
261266
this.$.verification.removeAttribute('hidden');
262267
break;
263-
case DialogTypeValue.LOGIN:
268+
case DialogTypeValue.SIGNIN:
264269
this.$.primary.removeAttribute('strength-meter');
265270
this.$.primary.removeAttribute('minlength');
266271
this.$.primary.setAttribute('autocomplete', 'current-password');
267272
this.$.verification.setAttribute('hidden', '');
268273
break;
269274
default:
270-
this.type = DialogTypeValue.REGISTER;
271-
console.warn("invalid type, switching to default: " + DialogTypeValue.REGISTER);
275+
console.error("Invalid dialog type!");
272276
}
273277
},
274278

275279
_providersChanged: function() {
276280
// TODO PG: check the list of provider given and filter only the supported one
277281
},
278282

279-
_computeHeaderLabel: function(type) {
280-
switch(type) {
281-
case DialogTypeValue.REGISTER:
282-
return DialogTypeValue.REGISTER;
283-
case DialogTypeValue.LOGIN:
284-
return DialogTypeValue.LOGIN;
285-
}
283+
_isSignUp: function(type) {
284+
return type === DialogTypeValue.SIGNUP;
285+
},
286+
287+
_isSignIn: function(type) {
288+
return type === DialogTypeValue.SIGNIN;
286289
},
287290

288291
_computeProviderHidden: function(provider) {
@@ -291,21 +294,22 @@ <h2 header>FBE Demo<h2>
291294

292295
_computeConfirm: function(type) {
293296
switch(type) {
294-
case DialogTypeValue.REGISTER:
295-
return DialogTypeValue.REGISTER;
296-
case DialogTypeValue.LOGIN:
297-
return DialogTypeValue.LOGIN;
297+
case DialogTypeValue.SIGNUP:
298+
case DialogTypeValue.SIGNIN:
299+
return type;
300+
default:
301+
console.error("Invalid dialog type!");
298302
}
299303
},
300304

301305
_computeConfirmDisabled: function(type, emailInvalid, primary, primaryInvalid, verificationInvalid) {
302306
switch(type) {
303-
case DialogTypeValue.REGISTER:
307+
case DialogTypeValue.SIGNUP:
304308
if (this.$.verification.value === '' || verificationInvalid) {
305309
return true;
306310
}
307311
break;
308-
case DialogTypeValue.LOGIN:
312+
case DialogTypeValue.SIGNIN:
309313
if (this.$.email.value === '' || emailInvalid) {
310314
return true;
311315
}
@@ -329,10 +333,10 @@ <h2 header>FBE Demo<h2>
329333
params.password = this.$.primary.value;
330334

331335
switch(this.type) {
332-
case DialogTypeValue.REGISTER:
336+
case DialogTypeValue.SIGNUP:
333337
this.fire('sign-up', { params: params} );
334338
break;
335-
case DialogTypeValue.LOGIN:
339+
case DialogTypeValue.SIGNIN:
336340
this.fire('sign-in', { provider: "password", params: params } );
337341
break;
338342
}
@@ -342,13 +346,13 @@ <h2 header>FBE Demo<h2>
342346

343347

344348
/**
345-
Fired when a user confirm a registration.
349+
Fired when a user confirm a Sign-Up.
346350
347351
@event sign-up
348352
@param {{params: Object}} detail Contains user and password info.
349353
*/
350354
/**
351-
Fired when a user confirm a login.
355+
Fired when a user confirm a Sign-In.
352356
353357
@event sign-in
354358
@param {{ provider: string, params: Object}} detail Contains user and password info.

firebase-auth-manager.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@
167167
_userHandler: function(e) {
168168
switch(e.type) {
169169
case "user-created":
170-
this._toastMessage = "Registration ";
170+
this._toastMessage = "Sign-Up ";
171171
break;
172172
case "login":
173-
this._toastMessage = "Login ";
173+
this._toastMessage = "Sign-In ";
174174
break;
175175
case "logout":
176-
this._toastMessage = "Logout ";
176+
this._toastMessage = "Sign-Out ";
177177
break;
178178
}
179179
this._toastMessage += "successful!";

test/basic.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<test-fixture id="basic-register-only-password">
2222
<template>
2323
<firebase-auth-dialog
24-
type="Register"
24+
type="SignUp"
2525
>
2626
</firebase-auth-dialog>
2727
</template>
@@ -30,7 +30,7 @@
3030
<test-fixture id="basic-login-only-password">
3131
<template>
3232
<firebase-auth-dialog
33-
type="Login"
33+
type="SignIn"
3434
>
3535
</firebase-auth-dialog>
3636
</template>
@@ -39,7 +39,7 @@
3939
<test-fixture id="basic-register-with-providers">
4040
<template>
4141
<firebase-auth-dialog
42-
type="Register"
42+
type="SignUp"
4343
providers='["facebook", "github", "google"]'
4444
>
4545
</firebase-auth-dialog>
@@ -49,7 +49,7 @@
4949
<test-fixture id="basic-login-with-providers">
5050
<template>
5151
<firebase-auth-dialog
52-
type="Login"
52+
type="SignIn"
5353
providers='["facebook", "github", "google"]'
5454
>
5555
</firebase-auth-dialog>

tmpData/facebook.json

Lines changed: 0 additions & 35 deletions
This file was deleted.

tmpData/firebase.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

tmpData/github.json

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)