| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2017 The LUCI Authors. All rights reserved. | 2 Copyright 2017 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 16 matching lines...) Expand all Loading... |
| 27 auth-signin: Fired when the oauth handshake has completed and a user has log
ged in. | 27 auth-signin: Fired when the oauth handshake has completed and a user has log
ged in. |
| 28 --> | 28 --> |
| 29 | 29 |
| 30 <link rel="import" href="../../common/third_party/google-signin/google-signin-aw
are.html"> | 30 <link rel="import" href="../../common/third_party/google-signin/google-signin-aw
are.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 { border-radius: 5px; } |
| 38 border-radius: 5px; | |
| 39 } | |
| 40 | 38 |
| 41 a { | 39 .center { vertical-align: middle; } |
| 42 color: white; | |
| 43 } | |
| 44 | 40 |
| 45 .center { | 41 .typeface { font-size: 75%; } |
| 46 vertical-align: middle; | |
| 47 } | |
| 48 | |
| 49 .sign-in-font { | |
| 50 color: black; | |
| 51 } | |
| 52 </style> | 42 </style> |
| 53 | 43 |
| 54 <google-signin-aware id="aware" | 44 <google-signin-aware id="aware" |
| 55 client-id="[[client_id]]" | 45 client-id="[[client_id]]" |
| 56 scopes="email" | 46 scopes="email" |
| 57 on-google-signin-aware-success="_onSignin" | 47 on-google-signin-aware-success="_onSignin" |
| 58 on-google-signin-aware-signed-out="_onSignout"> | 48 on-google-signin-aware-signed-out="_onSignout"> |
| 59 </google-signin-aware> | 49 </google-signin-aware> |
| 60 | 50 |
| 61 <template is="dom-if" if="[[!signed_in]]"> | 51 <template is="dom-if" if="[[!signed_in]]"> |
| 62 <div id="signinContainer"> | 52 <div id="signinContainer"> |
| 63 <!-- TODO(cwpayton): Before official deployment, change href to "/#/" --
> | 53 <!-- TODO(cwpayton): Before official deployment, change href to "/#/" --
> |
| 64 <a class="sign-in-font" on-tap="signIn" href="/newui#/">Sign in</a> | 54 <a class="typeface" on-tap="signIn" href="/newui#/">Sign in</a> |
| 65 </div> | 55 </div> |
| 66 </template> | 56 </template> |
| 67 | 57 |
| 68 <template is="dom-if" if="[[signed_in]]"> | 58 <template is="dom-if" if="[[signed_in]]"> |
| 69 <img class="center" id="avatar" src="[[profile.imageUrl]]" width="30" heig
ht="30"> | 59 <img class="center" id="avatar" src="[[profile.imageUrl]]" width="30" heig
ht="30"> |
| 70 <span class="center">[[profile.email]]</span> | 60 <span class="center typeface">[[profile.email]]</span> |
| 71 <span class="center">|</span> | 61 <span class="center typeface">|</span> |
| 72 <!-- TODO(cwpayton): Before official deployment, change href to "/#/" --> | 62 <!-- TODO(cwpayton): Before official deployment, change href to "/#/" --> |
| 73 <a class="center sign-in-font" on-tap="signOut" href="/newui#/">Sign out</
a> | 63 <a class="center typeface" on-tap="signOut" href="/newui#/">Sign out</a> |
| 74 </template> | 64 </template> |
| 75 </template> | 65 </template> |
| 76 <script> | 66 <script> |
| 77 'use strict'; | 67 'use strict'; |
| 78 Polymer({ | 68 Polymer({ |
| 79 is: 'auth-signin', | 69 is: 'auth-signin', |
| 80 properties: { | 70 properties: { |
| 81 auth_headers: { | 71 auth_headers: { |
| 82 type: Object, | 72 type: Object, |
| 83 value: () => {}, | 73 value: () => {}, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 this.$.aware.signIn(); | 161 this.$.aware.signIn(); |
| 172 }, | 162 }, |
| 173 | 163 |
| 174 signOut: function() { | 164 signOut: function() { |
| 175 this.$.aware.signOut(); | 165 this.$.aware.signOut(); |
| 176 window.location.reload(); | 166 window.location.reload(); |
| 177 } | 167 } |
| 178 }); | 168 }); |
| 179 </script> | 169 </script> |
| 180 </dom-module> | 170 </dom-module> |
| OLD | NEW |