| Index: polymer_1.0.4/bower_components/firebase-element/demo/x-login.html
|
| diff --git a/polymer_1.0.4/bower_components/firebase-element/demo/x-login.html b/polymer_1.0.4/bower_components/firebase-element/demo/x-login.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6b5455b230ff0e98a06552914421a4cd808c3b9d
|
| --- /dev/null
|
| +++ b/polymer_1.0.4/bower_components/firebase-element/demo/x-login.html
|
| @@ -0,0 +1,180 @@
|
| +<!--
|
| +@license
|
| +Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
| +This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
| +The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
| +The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
| +Code distributed by Google as part of the polymer project is also
|
| +subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
| +-->
|
| +<link rel="import" href="../../polymer/polymer.html">
|
| +<link rel="import" href="../firebase-auth.html">
|
| +<dom-module id="x-login">
|
| + <template>
|
| + <firebase-auth id="firebaseLogin" user="{{user}}" status-known="{{statusKnown}}" location="https://polymer-tests.firebaseio.com" provider="{{provider}}" on-error="errorHandler" on-user-created="userSuccessHandler" on-password-changed="userSuccessHandler" on-password-reset="userSuccessHandler" on-user-removed="userSuccessHandler"></firebase-auth>
|
| +
|
| + Firebase location:
|
| + <input value="https://polymer-tests.firebaseio.com" size="40" disabled>
|
| + <br>
|
| +
|
| + Provider type:
|
| + <select value="{{provider::change}}">
|
| + <option>anonymous</option>
|
| + <option>facebook</option>
|
| + <option>github</option>
|
| + <option>google</option>
|
| + <option>twitter</option>
|
| + <option>password</option>
|
| + </select>
|
| + <em>Only 'anonymous', 'google', and 'password' are activated for demo Firebase account</em>
|
| + <br>
|
| +
|
| + Login params (JSON):
|
| + <input value="{{params::input}}" id="params">
|
| + <em>Required by some provider types</em>
|
| + <br>
|
| +
|
| + <div hidden$="{{computePasswordHidden(provider)}}">
|
| + <br><em>Password-specific options:</em><br>
|
| + <input placeholder="email" value="{{email::input}}">
|
| + <input placeholder="password" value="{{password::input}}">
|
| + <button on-tap="createUserHandler" disabled$="{{computeCreateUserDisabled(email, password)}}">Create user</button>
|
| + <br>
|
| + <input placeholder="new password" value="{{newPassword::input}}">
|
| + <button on-tap="changePasswordHandler" disabled$="{{computeChangePasswordDisabled(email, password, newPassword)}}">Change password</button>
|
| + <br>
|
| + <button on-tap="resetPasswordHandler" disabled$="{{computeResetPasswordDisabled(email, password)}}">Reset password</button>
|
| + <button on-tap="removeUserHandler" disabled$="{{computeRemoveUserDisabled(email, password)}}">Remove user</button>
|
| + </div>
|
| + <br>
|
| + <div id="message">[[message]]</div>
|
| + <br>
|
| +
|
| + <button on-tap="login" hidden$="{{computeLoginHidden(statusKnown, user)}}">Login</button>
|
| + <button on-tap="logout" hidden$="{{computeLogoutHidden(statusKnown, user)}}">Logout</button>
|
| +
|
| + <h3>Login status:</h3>
|
| + <p>{{computeLoginStatus(statusKnown, user)}}</p>
|
| +
|
| + <h3>User ID:</h3>
|
| + <pre>{{user.uid}}</pre>
|
| + </template>
|
| +</dom-module>
|
| +<script>
|
| + Polymer({
|
| + is: 'x-login',
|
| +
|
| + properties: {
|
| + provider: {
|
| + type: String,
|
| + value: 'anonymous'
|
| + },
|
| +
|
| + message: {
|
| + type: String,
|
| + value: ''
|
| + },
|
| +
|
| + email: {
|
| + type: String,
|
| + value: ''
|
| + },
|
| +
|
| + password: {
|
| + type: String,
|
| + value: ''
|
| + },
|
| +
|
| + user: {
|
| + type: Object,
|
| + value: null
|
| + },
|
| +
|
| + statusKnown: {
|
| + type: Boolean
|
| + }
|
| + },
|
| +
|
| + login: function() {
|
| + var params;
|
| +
|
| + try {
|
| + params = JSON.parse(this.params);
|
| + } catch (e) {
|
| + params = null;
|
| + }
|
| +
|
| + if (this.provider == 'password') {
|
| + params = params || {};
|
| + params.email = this.email;
|
| + params.password = this.password;
|
| + }
|
| +
|
| + this.$.firebaseLogin.login(params);
|
| + },
|
| +
|
| + logout: function() {
|
| + this.$.firebaseLogin.logout();
|
| + },
|
| +
|
| + errorHandler: function(e) {
|
| + this.message = 'Error: ' + e.detail.message;
|
| + },
|
| +
|
| + userSuccessHandler: function(e) {
|
| + this.message = e.type + ' success!';
|
| + },
|
| +
|
| + createUserHandler: function(e) {
|
| + this.$.firebaseLogin.createUser(this.email, this.password);
|
| + },
|
| +
|
| + changePasswordHandler: function(e) {
|
| + this.$.firebaseLogin.changePassword(this.email, this.password, this.newPassword);
|
| + },
|
| +
|
| + resetPasswordHandler: function(e) {
|
| + this.$.firebaseLogin.sendPasswordResetEmail(this.email);
|
| + },
|
| +
|
| + computePasswordHidden: function(provider) {
|
| + return provider !== 'password';
|
| + },
|
| +
|
| + computeCreateUserDisabled: function(email, password) {
|
| + return !email || !password;
|
| + },
|
| +
|
| + computeChangePasswordDisabled: function(email, password, newPassword) {
|
| + return !email || !password || !newPassword;
|
| + },
|
| +
|
| + computeResetPasswordDisabled: function(email, password) {
|
| + return !email || !password;
|
| + },
|
| +
|
| + computeRemoveUserDisabled: function(email, password) {
|
| + return !email || !password;
|
| + },
|
| +
|
| + computeLoginHidden: function(statusKnown, user) {
|
| + return !statusKnown || !!user;
|
| + },
|
| +
|
| + computeLogoutHidden: function(statusKnown, user) {
|
| + return !statusKnown || !user;
|
| + },
|
| +
|
| + computeLoginStatus: function(statusKnown, user) {
|
| + if (statusKnown && user) {
|
| + return 'Logged in';
|
| + }
|
| +
|
| + if (statusKnown) {
|
| + return 'Logged out';
|
| + }
|
| +
|
| + return 'Unknown (checking status...)';
|
| + }
|
| + });
|
| +</script>
|
|
|