Commit 083a9ce33dc9fb92ae0a3b449a20c7be48e77cf3
1 parent
f4a1f9e4
Exists in
master
and in
5 other branches
Add some alternatives to catch usernames on callback OAuth (issue #347)
Showing
1 changed file
with
10 additions
and
1 deletions
Show diff stats
js/main.js
| ... | ... | @@ -239,6 +239,10 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 239 | 239 | $('.login .message').text(''); |
| 240 | 240 | var requireLoginContainer = loginButton.closest('.require-login-container'); |
| 241 | 241 | |
| 242 | + if(user && !Main.getUser()) { | |
| 243 | + Main.setUser(user); | |
| 244 | + } | |
| 245 | + | |
| 242 | 246 | if(logged_in) { |
| 243 | 247 | Main.showLogout(); |
| 244 | 248 | if(token){ |
| ... | ... | @@ -696,7 +700,12 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
| 696 | 700 | var name = ''; |
| 697 | 701 | var user = Main.getUser(); |
| 698 | 702 | if(user){ |
| 699 | - name = user.person.name + ' - '; | |
| 703 | + if(user.person && user.person.name){ | |
| 704 | + name = user.person.name + ' - '; | |
| 705 | + }else{ | |
| 706 | + name = user.login + ' - '; | |
| 707 | + } | |
| 708 | + | |
| 700 | 709 | } |
| 701 | 710 | $('#logout-button .name').text(name); |
| 702 | 711 | $('#logout-button').show(); | ... | ... |