Commit bf2b364e authored by Sandro Lutz's avatar Sandro Lutz Committed by lic
Browse files

Remove token parameter from url after login (Resolves #51)

parent 920c29cc
...@@ -108,26 +108,23 @@ export async function checkLogin() { ...@@ -108,26 +108,23 @@ export async function checkLogin() {
try { try {
const response = await m.request({ const response = await m.request({
method: 'GET', method: 'GET',
url: `${apiUrl}/sessions?where={"token":"${params.access_token}"}`, url: `${apiUrl}/sessions/${params.access_token}`,
headers: { headers: {
Authorization: params.access_token, Authorization: params.access_token,
}, },
}); });
if (response._items.length === 1) { const dt2 = new Date();
const dt2 = new Date(); session = {
session = { userId: response.user,
userId: response._items[0].user, token: params.access_token,
token: params.access_token, etag: response._etag,
etag: response._items[0]._etag, id: response._id,
id: response._items[0]._id, state: undefined,
state: undefined, lastChecked: dt2.getTime(),
lastChecked: dt2.getTime(), };
}; saveSession();
saveSession(); window.history.replaceState({}, document.title, window.location.pathname);
log('User logged in!'); log('User logged in!');
} else {
throw new Error({ _error: { code: 500 } });
}
} catch ({ _error: { code } }) { } catch ({ _error: { code } }) {
session = {}; session = {};
saveSession(); saveSession();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment