1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-10-05 05:08:14 +02:00

adjusted token service gets for new claims

This commit is contained in:
Kyle Spearrin 2017-01-24 22:57:21 -05:00
parent 4057c478c6
commit 6c8f2d526c
2 changed files with 14 additions and 6 deletions

View File

@ -1,6 +1,6 @@
function ApiService(tokenService, logoutCallback) {
//this.baseUrl = 'http://localhost:4000';
this.baseUrl = 'https://api.bitwarden.com';
this.baseUrl = 'http://localhost:4000';
//this.baseUrl = 'https://api.bitwarden.com';
this.tokenService = tokenService;
this.logoutCallback = logoutCallback;

View File

@ -221,13 +221,21 @@ function initTokenService() {
TokenService.prototype.getEmail = function () {
var decoded = this.decodeToken();
var email = decoded['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'];
if (typeof email === 'undefined') {
if (typeof decoded.email === 'undefined') {
throw 'No email found';
}
return email;
return decoded.email;
};
TokenService.prototype.getName = function () {
var decoded = this.decodeToken();
if (typeof decoded.name === 'undefined') {
throw 'No name found';
}
return decoded.name;
};
function urlBase64Decode(str) {