| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. | 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. | 4 that can be found in the LICENSE file. |
| 5 | 5 |
| 6 The `auth-signin` element displays sign-in/sign-out button, user email and | 6 The `auth-signin` element displays sign-in/sign-out button, user email and |
| 7 avatar. | 7 avatar. |
| 8 It has a google-signin/google-signin-aware element under the hood that handles | 8 It has a google-signin/google-signin-aware element under the hood that handles |
| 9 the actual OAuth logic. | 9 the actual OAuth logic. |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 <link rel="import" href="../../bower_components/google-signin/google-signin-awar
e.html"> | 30 <link rel="import" href="../../bower_components/google-signin/google-signin-awar
e.html"> |
| 31 <link rel="import" href="../../bower_components/polymer/polymer.html"> | 31 <link rel="import" href="../../bower_components/polymer/polymer.html"> |
| 32 | 32 |
| 33 | 33 |
| 34 <dom-module id="auth-signin"> | 34 <dom-module id="auth-signin"> |
| 35 <template> | 35 <template> |
| 36 <style> | 36 <style> |
| 37 #avatar { | 37 #avatar { |
| 38 border-radius: 5px; | 38 border-radius: 5px; |
| 39 } | 39 } |
| 40 #signinContainer { | 40 a { |
| 41 margin-top: 14px; | 41 color: white; |
| 42 } |
| 43 .center { |
| 44 vertical-align: middle; |
| 42 } | 45 } |
| 43 </style> | 46 </style> |
| 44 | 47 |
| 45 <google-signin-aware id="aware" | 48 <google-signin-aware id="aware" |
| 46 client-id="[[clientId]]" | 49 client-id="[[clientId]]" |
| 47 scopes="email" | 50 scopes="email" |
| 48 on-google-signin-aware-success="_onSignin" | 51 on-google-signin-aware-success="_onSignin" |
| 49 on-google-signin-aware-signed-out="_onSignout"> | 52 on-google-signin-aware-signed-out="_onSignout"> |
| 50 </google-signin-aware> | 53 </google-signin-aware> |
| 51 | 54 |
| 52 <template is="dom-if" if="[[!signedIn]]"> | 55 <template is="dom-if" if="[[!signedIn]]"> |
| 53 <div id="signinContainer"> | 56 <div id="signinContainer"> |
| 54 <a on-tap="signIn" href="#">Sign in</a> | 57 <a on-tap="signIn" href="#">Sign in</a> |
| 55 </div> | 58 </div> |
| 56 </template> | 59 </template> |
| 57 | 60 |
| 58 <template is="dom-if" if="[[signedIn]]"> | 61 <template is="dom-if" if="[[signedIn]]"> |
| 59 <img id="avatar" src="[[profile.imageUrl]]" width="30" height="30"> | 62 <img class="center" id="avatar" src="[[profile.imageUrl]]" width="30" heig
ht="30"> |
| 60 <span>[[profile.email]]</span> | 63 <span class="center" >[[profile.email]]</span> |
| 61 <span>|</span> | 64 <span class="center" >|</span> |
| 62 <a on-tap="signOut" href="#">Sign out</a> | 65 <a class="center" on-tap="signOut" href="#">Sign out</a> |
| 63 </template> | 66 </template> |
| 64 </template> | 67 </template> |
| 65 <script> | 68 <script> |
| 66 'use strict'; | 69 'use strict'; |
| 67 Polymer({ | 70 Polymer({ |
| 68 is: 'auth-signin', | 71 is: 'auth-signin', |
| 69 properties: { | 72 properties: { |
| 70 authHeaders: { | 73 authHeaders: { |
| 71 type: Object, | 74 type: Object, |
| 72 computed: "_makeHeader(authResponse)", | 75 computed: "_makeHeader(authResponse)", |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 signIn: function() { | 122 signIn: function() { |
| 120 this.$.aware.signIn(); | 123 this.$.aware.signIn(); |
| 121 }, | 124 }, |
| 122 | 125 |
| 123 signOut: function() { | 126 signOut: function() { |
| 124 this.$.aware.signOut(); | 127 this.$.aware.signOut(); |
| 125 } | 128 } |
| 126 }); | 129 }); |
| 127 </script> | 130 </script> |
| 128 </dom-module> | 131 </dom-module> |
| OLD | NEW |