This commit is contained in:
@@ -64,23 +64,29 @@ export function processLogin(response) {
|
||||
//response.data.token
|
||||
//store token in central store
|
||||
//todo: put token into localstorage later once this validation is worked out
|
||||
logger.log("auth::processLogin called");
|
||||
|
||||
//is token present?
|
||||
if (!response || !response.data || !response.data.token) {
|
||||
logger.log("auth::processLogin -> token empty");
|
||||
return Promise.resolve(false);
|
||||
return Promise.reject();
|
||||
}
|
||||
const token = decode(response.data.token);
|
||||
|
||||
if (!token || !token.iss) {
|
||||
logger.log("auth::processLogin -> token empty");
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
const token = decode(response.data.token);
|
||||
if (!token || !token.iss || token.iss != "ayanova.com") {
|
||||
logger.log("auth::processLogin -> token empty or invalid ");
|
||||
return Promise.resolve(false);
|
||||
if (token.iss != "ayanova.com") {
|
||||
logger.log("auth::processLogin -> token invalid (iss)", token.iss);
|
||||
return Promise.reject();
|
||||
}
|
||||
//debugger;
|
||||
|
||||
config.apiToken = response.data.token;
|
||||
config.userId = Number(token.id);
|
||||
config.roles = token["ayanova/roles"];
|
||||
|
||||
logger.log("User " + token.id + " logged in");
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
|
||||
@@ -89,7 +95,7 @@ export function processLogin(response) {
|
||||
// });
|
||||
|
||||
export function processLogout() {
|
||||
logger.log("util\\auth.js->ProcessLogout called!");
|
||||
logger.log("Logout");
|
||||
clearToken();
|
||||
//router.go('/');
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/* eslint-disable */
|
||||
//////////////////////////////////////////////////////
|
||||
//in-memory log, keeps up to 100 of the past log items
|
||||
//
|
||||
import cbuffer from "./cbuffer";
|
||||
|
||||
const buffer = new cbuffer(10);
|
||||
const buffer = new cbuffer(100);
|
||||
export default {
|
||||
log(msg, obj) {
|
||||
if (obj) {
|
||||
|
||||
@@ -23,7 +23,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
login() {
|
||||
logger.log("User logging in: " + this.input.username);
|
||||
if (this.input.username != "" && this.input.password != "") {
|
||||
auth
|
||||
.authenticate(this.input.username, this.input.password)
|
||||
|
||||
@@ -30,7 +30,7 @@ refs:
|
||||
WEEK OF 2018-11-05 - RAVEN shell start work. YAY!
|
||||
|
||||
NEXT: Test authorization code to login even if just doing it from code for now to ensure that roles enum stuff works and payload is properly verified and decoded
|
||||
|
||||
/* eslint-disable */
|
||||
- Stage 1:
|
||||
- Make a rough but relevent shell with the idea of this being the actual release shell (Refine on the fly rather than re-do)
|
||||
- Proper graphics all over
|
||||
|
||||
Reference in New Issue
Block a user