Can login now without auth

This commit is contained in:
2020-06-19 16:55:11 +00:00
parent 527c84a81e
commit c1e688d824
5 changed files with 164 additions and 135 deletions

View File

@@ -11,20 +11,15 @@ export function processLogin(authResponse, loggedInWithKnownPassword) {
return reject();
}
//is there an error?
if (authResponse.error) {
return reject(authResponse.error);
}
//is token present?
if (!authResponse.data || !authResponse.data.token) {
if (!authResponse || !authResponse.token) {
window.$gz.store.commit(
"logItem",
"auth::processLogin -> response contains no data"
);
return reject();
}
const token = decode(authResponse.data.token);
const token = decode(authResponse.token);
if (!token || !token.iss) {
window.$gz.store.commit(
@@ -52,13 +47,13 @@ export function processLogin(authResponse, loggedInWithKnownPassword) {
//Put app relevant items into vuex store so app can use them
window.$gz.store.commit("login", {
apiToken: authResponse.data.token,
apiToken: authResponse.token,
authenticated: true,
userId: Number(token.id),
userName: authResponse.data.name,
roles: authResponse.data.roles,
userType: authResponse.data.usertype,
dlt: authResponse.data.dlt
userName: authResponse.name,
roles: authResponse.roles,
userType: authResponse.usertype,
dlt: authResponse.dlt
});
//log the login
window.$gz.store.commit(
@@ -86,6 +81,7 @@ export function processLogin(authResponse, loggedInWithKnownPassword) {
} catch (err) {
reject(err);
}
resolve();
//-------------------------------------------------
});