Skip to content

Commit 730d418

Browse files
committed
allow signout respnse processing to parse query string (instead of hash fragment)
1 parent c72605b commit 730d418

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎src/SigninResponse.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ErrorResponse from './ErrorResponse';
55
export default class SigninResponse {
66
constructor(url) {
77

8-
var values = UrlUtility.parseUrlFragment(url);
8+
var values = UrlUtility.parseUrlFragment(url, "#");
99

1010
if (values.error){
1111
return new ErrorResponse(values);

‎src/SignoutResponse.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ErrorResponse from './ErrorResponse';
55
export default class SignoutResponse {
66
constructor(url) {
77

8-
var values = UrlUtility.parseUrlFragment(url);
8+
var values = UrlUtility.parseUrlFragment(url, "?");
99

1010
if (values.error){
1111
return new ErrorResponse(values);

‎src/UrlUtility.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export default class UrlUtility {
1818
return url;
1919
}
2020

21-
static parseUrlFragment(value, window = Window) {
21+
static parseUrlFragment(value, delimiter = "#", window = Window) {
2222
Log.info("UrlUtility.parseUrlFragment");
2323

2424
if (typeof value !== 'string'){
25-
value = window.location.hash;
25+
value = window.location.href;
2626
}
2727

28-
var idx = value.lastIndexOf("#");
28+
var idx = value.lastIndexOf(delimiter);
2929
if (idx >= 0) {
3030
value = value.substr(idx + 1);
3131
}

‎test/UrlUtility.spec.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ describe("UrlUtility", function() {
4747
result.should.have.property('error');
4848
});
4949

50-
it("should use window.location.hash when no value is passed", function() {
50+
it("should use window.location when no value is passed", function() {
5151
let w = {
5252
location: {
53-
hash: "a=apple&b=banana&c=carrot"
53+
href : "a=apple&b=banana&c=carrot"
5454
}
5555
};
56-
let result = UrlUtility.parseUrlFragment(null, w);
56+
let result = UrlUtility.parseUrlFragment(null, "#", w);
5757
result.should.deep.equal({ a: "apple", b: "banana", c: "carrot" });
5858
});
5959

0 commit comments

Comments
 (0)