| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 client-id="[[client_id]]" | 48 client-id="[[client_id]]" |
| 49 initialized="{{initialized}}" | 49 initialized="{{initialized}}" |
| 50 scopes="email" | 50 scopes="email" |
| 51 on-google-signin-aware-success="_onSignin" | 51 on-google-signin-aware-success="_onSignin" |
| 52 on-google-signin-aware-signed-out="_onSignout"> | 52 on-google-signin-aware-signed-out="_onSignout"> |
| 53 </google-signin-aware> | 53 </google-signin-aware> |
| 54 | 54 |
| 55 <template is="dom-if" if="[[!signed_in]]"> | 55 <template is="dom-if" if="[[!signed_in]]"> |
| 56 <div id="signinContainer"> | 56 <div id="signinContainer"> |
| 57 <!-- TODO(cwpayton): Before official deployment, change href to "/#/" --
> | 57 <!-- TODO(cwpayton): Before official deployment, change href to "/#/" --
> |
| 58 <a class="typeface" on-tap="signIn" href="/#/">Sign in</a> | 58 <a class="typeface" on-tap="signIn" href="[[current_url]]">Sign in</a> |
| 59 </div> | 59 </div> |
| 60 </template> | 60 </template> |
| 61 | 61 |
| 62 <template is="dom-if" if="[[signed_in]]"> | 62 <template is="dom-if" if="[[signed_in]]"> |
| 63 <img class="center" id="avatar" src="[[profile.imageUrl]]" width="30" heig
ht="30"> | 63 <img class="center" id="avatar" src="[[profile.imageUrl]]" width="30" heig
ht="30"> |
| 64 <span class="center typeface">[[profile.email]]</span> | 64 <span class="center typeface">[[profile.email]]</span> |
| 65 <span class="center typeface">|</span> | 65 <span class="center typeface">|</span> |
| 66 <!-- TODO(cwpayton): Before official deployment, change href to "/#/" --> | 66 <!-- TODO(cwpayton): Before official deployment, change href to "/#/" --> |
| 67 <a class="center typeface" on-tap="signOut" href="/#/">Sign out</a> | 67 <a class="center typeface" on-tap="signOut" href="/#/">Sign out</a> |
| 68 </template> | 68 </template> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 81 auth_response: { | 81 auth_response: { |
| 82 type: Object, | 82 type: Object, |
| 83 notify: true, | 83 notify: true, |
| 84 observer: '_makeHeader' | 84 observer: '_makeHeader' |
| 85 }, | 85 }, |
| 86 | 86 |
| 87 client_id: { | 87 client_id: { |
| 88 type: String | 88 type: String |
| 89 }, | 89 }, |
| 90 | 90 |
| 91 current_url: { |
| 92 type: String, |
| 93 value: "/#/" |
| 94 }, |
| 95 |
| 91 initialized: { | 96 initialized: { |
| 92 type: Boolean, | 97 type: Boolean, |
| 93 value: false, | 98 value: false, |
| 94 observer: '_onInitialized' | 99 observer: '_onInitialized' |
| 95 }, | 100 }, |
| 96 | 101 |
| 97 profile: { | 102 profile: { |
| 98 type: Object, | 103 type: Object, |
| 99 notify: true | 104 notify: true |
| 100 }, | 105 }, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 this.set('auth_headers', null); | 163 this.set('auth_headers', null); |
| 159 } | 164 } |
| 160 this.set('auth_headers', | 165 this.set('auth_headers', |
| 161 { | 166 { |
| 162 "authorization": this.auth_response.token_type + " " + | 167 "authorization": this.auth_response.token_type + " " + |
| 163 this.auth_response.access_token | 168 this.auth_response.access_token |
| 164 }); | 169 }); |
| 165 }, | 170 }, |
| 166 | 171 |
| 167 signIn: function() { | 172 signIn: function() { |
| 173 this.current_url = window.location.href; |
| 168 this.$.aware.signIn(); | 174 this.$.aware.signIn(); |
| 169 }, | 175 }, |
| 170 | 176 |
| 171 signOut: function() { | 177 signOut: function() { |
| 172 this.$.aware.signOut(); | 178 this.$.aware.signOut(); |
| 173 window.location.reload(); | 179 window.location.reload(); |
| 174 } | 180 } |
| 175 }); | 181 }); |
| 176 </script> | 182 </script> |
| 177 </dom-module> | 183 </dom-module> |
| OLD | NEW |