Skip to content

Commit 10034d9

Browse files
committed
release 1.3.5-beta.1
1 parent af8a602 commit 10034d9

7 files changed

+187
-152
lines changed

Diff for: bower.json

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
{
22
"name": "vue-authenticate",
3-
"version": "1.2.7",
3+
"version": "1.3.5-beta.1",
44
"main": "dist/vue-authenticate.js",
55
"homepage": "https://github.com/dgrubelic/vue-authenticate",
6-
"ignore": [
7-
8-
],
9-
"dependencies": {
10-
"vue": "^2.0.0"
11-
}
6+
"ignore": []
127
}

Diff for: dist/vue-authenticate.common.js

+45-34
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-authenticate v1.3.4
2+
* vue-authenticate v1.3.5-beta.1
33
* https://github.com/dgrubelic/vue-authenticate
44
* Released under the MIT License.
55
*/
@@ -480,6 +480,24 @@ Promise$1._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {
480480
Promise$1._unhandledRejectionFn = fn;
481481
};
482482

483+
function getCookieDomainUrl() {
484+
try {
485+
return window.location.hostname
486+
} catch (e) {}
487+
488+
return '';
489+
}
490+
491+
function getRedirectUri(uri) {
492+
try {
493+
return (!isUndefined(uri))
494+
? ("" + (window.location.origin) + uri)
495+
: window.location.origin
496+
} catch (e) {}
497+
498+
return uri || null;
499+
}
500+
483501
/**
484502
* Default configuration
485503
*/
@@ -495,7 +513,7 @@ var defaultOptions = {
495513
storageType: 'localStorage',
496514
storageNamespace: 'vue-authenticate',
497515
cookieStorage: {
498-
domain: window.location.hostname,
516+
domain: getCookieDomainUrl(),
499517
path: '/',
500518
secure: false
501519
},
@@ -521,23 +539,12 @@ var defaultOptions = {
521539
});
522540
},
523541

524-
/**
525-
* Default response interceptor for Axios library
526-
* @contect {VueAuthenticate}
527-
*/
528-
bindResponseInterceptor: function ($auth) {
529-
$auth.$http.interceptors.response.use(function (response) {
530-
$auth.setToken(response);
531-
return response
532-
});
533-
},
534-
535542
providers: {
536543
facebook: {
537544
name: 'facebook',
538545
url: '/auth/facebook',
539546
authorizationEndpoint: 'https://www.facebook.com/v2.5/dialog/oauth',
540-
redirectUri: window.location.origin + '/',
547+
redirectUri: getRedirectUri('/'),
541548
requiredUrlParams: ['display', 'scope'],
542549
scope: ['email'],
543550
scopeDelimiter: ',',
@@ -550,7 +557,7 @@ var defaultOptions = {
550557
name: 'google',
551558
url: '/auth/google',
552559
authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',
553-
redirectUri: window.location.origin,
560+
redirectUri: getRedirectUri(),
554561
requiredUrlParams: ['scope'],
555562
optionalUrlParams: ['display'],
556563
scope: ['profile', 'email'],
@@ -565,7 +572,7 @@ var defaultOptions = {
565572
name: 'github',
566573
url: '/auth/github',
567574
authorizationEndpoint: 'https://github.com/login/oauth/authorize',
568-
redirectUri: window.location.origin,
575+
redirectUri: getRedirectUri(),
569576
optionalUrlParams: ['scope'],
570577
scope: ['user:email'],
571578
scopeDelimiter: ' ',
@@ -577,7 +584,7 @@ var defaultOptions = {
577584
name: 'instagram',
578585
url: '/auth/instagram',
579586
authorizationEndpoint: 'https://api.instagram.com/oauth/authorize',
580-
redirectUri: window.location.origin,
587+
redirectUri: getRedirectUri(),
581588
requiredUrlParams: ['scope'],
582589
scope: ['basic'],
583590
scopeDelimiter: '+',
@@ -589,7 +596,7 @@ var defaultOptions = {
589596
name: 'twitter',
590597
url: '/auth/twitter',
591598
authorizationEndpoint: 'https://api.twitter.com/oauth/authenticate',
592-
redirectUri: window.location.origin,
599+
redirectUri: getRedirectUri(),
593600
oauthType: '1.0',
594601
popupOptions: { width: 495, height: 645 }
595602
},
@@ -598,7 +605,7 @@ var defaultOptions = {
598605
name: 'bitbucket',
599606
url: '/auth/bitbucket',
600607
authorizationEndpoint: 'https://bitbucket.org/site/oauth2/authorize',
601-
redirectUri: window.location.origin + '/',
608+
redirectUri: getRedirectUri('/'),
602609
optionalUrlParams: ['scope'],
603610
scope: ['email'],
604611
scopeDelimiter: ' ',
@@ -610,7 +617,7 @@ var defaultOptions = {
610617
name: 'linkedin',
611618
url: '/auth/linkedin',
612619
authorizationEndpoint: 'https://www.linkedin.com/oauth/v2/authorization',
613-
redirectUri: window.location.origin,
620+
redirectUri: getRedirectUri(),
614621
requiredUrlParams: ['state'],
615622
scope: ['r_emailaddress'],
616623
scopeDelimiter: ' ',
@@ -623,7 +630,7 @@ var defaultOptions = {
623630
name: 'live',
624631
url: '/auth/live',
625632
authorizationEndpoint: 'https://login.live.com/oauth20_authorize.srf',
626-
redirectUri: window.location.origin,
633+
redirectUri: getRedirectUri(),
627634
requiredUrlParams: ['display', 'scope'],
628635
scope: ['wl.emails'],
629636
scopeDelimiter: ' ',
@@ -636,7 +643,7 @@ var defaultOptions = {
636643
name: null,
637644
url: '/auth/oauth1',
638645
authorizationEndpoint: null,
639-
redirectUri: window.location.origin,
646+
redirectUri: getRedirectUri(),
640647
oauthType: '1.0',
641648
popupOptions: null
642649
},
@@ -645,7 +652,7 @@ var defaultOptions = {
645652
name: null,
646653
url: '/auth/oauth2',
647654
clientId: null,
648-
redirectUri: window.location.origin,
655+
redirectUri: getRedirectUri(),
649656
authorizationEndpoint: null,
650657
defaultUrlParams: ['response_type', 'client_id', 'redirect_uri'],
651658
requiredUrlParams: null,
@@ -668,7 +675,7 @@ var defaultOptions = {
668675

669676
var CookieStorage = function CookieStorage(defaultOptions) {
670677
this._defaultOptions = objectExtend({
671-
domain: window.location.hostname,
678+
domain: getCookieDomainUrl(),
672679
expires: null,
673680
path: '/',
674681
secure: false
@@ -697,13 +704,19 @@ CookieStorage.prototype.removeItem = function removeItem (key) {
697704
};
698705

699706
CookieStorage.prototype._getCookie = function _getCookie () {
700-
return typeof document === 'undefined'
701-
? '' : typeof document.cookie === 'undefined'
702-
? '' : document.cookie;
707+
try {
708+
return typeof document === 'undefined'
709+
? '' : typeof document.cookie === 'undefined'
710+
? '' : document.cookie;
711+
} catch (e) {}
712+
713+
return '';
703714
};
704715

705716
CookieStorage.prototype._setCookie = function _setCookie (cookie) {
706-
document.cookie = cookie;
717+
try {
718+
document.cookie = cookie;
719+
} catch (e) {}
707720
};
708721

709722
var LocalStorage = function LocalStorage(namespace) {
@@ -1189,13 +1202,10 @@ var VueAuthenticate = function VueAuthenticate($http, overrideOptions) {
11891202
});
11901203

11911204
// Setup request interceptors
1192-
if (this.options.bindRequestInterceptor && isFunction(this.options.bindRequestInterceptor) &&
1193-
this.options.bindResponseInterceptor && isFunction(this.options.bindResponseInterceptor)) {
1194-
1205+
if (this.options.bindRequestInterceptor && isFunction(this.options.bindRequestInterceptor)) {
11951206
this.options.bindRequestInterceptor.call(this, this);
1196-
this.options.bindResponseInterceptor.call(this, this);
11971207
} else {
1198-
throw new Error('Both request and response interceptors must be functions')
1208+
throw new Error('Request interceptor must be functions')
11991209
}
12001210
};
12011211

@@ -1328,10 +1338,11 @@ VueAuthenticate.prototype.logout = function logout (requestOptions) {
13281338
}
13291339

13301340
requestOptions = requestOptions || {};
1331-
requestOptions.url = requestOptions.logoutUrl || this.options.logoutUrl;
13321341

13331342
if (requestOptions.url) {
1343+
requestOptions.url = requestOptions.url ? requestOptions.url : joinUrl(this.options.baseUrl, this.options.logoutUrl);
13341344
requestOptions.method = requestOptions.method || 'POST';
1345+
requestOptions[this.options.requestDataKey] = requestOptions[this.options.requestDataKey] || undefined;
13351346
requestOptions.withCredentials = requestOptions.withCredentials || this.options.withCredentials;
13361347

13371348
return this.$http(requestOptions).then(function (response) {

0 commit comments

Comments
 (0)