Authentication result parsing

This commit is contained in:
2023-05-29 18:32:13 -04:00
parent 0f019ebc34
commit 4a3136a766
7 changed files with 26 additions and 26 deletions

View File

@@ -48,6 +48,8 @@ export const d_parse_boolean = data => data != '0';
export const d_parse_text = data => data !== '' ? data.join('\r\n') : data;
export const d_parse_array = data => data !== '' ? data : [];
export const d_parse_authinfo = data => data ? { duz: data[0] != '0' ? data[0] : null, device_lock: data[1] != '0', change_verify: data[2] != '0', message: data[3], reserved: data[4], greeting_lines: data[5], greeting: data.slice(6), success: (data[0] != '0') && (data[2] == '0') } : { success: false }
export const d_parse_orderdialogs = (data, columns=['IEN', 'windowFormId', 'displayGroupId', 'type', 'displayText']) => data.map(function(row) {
row = row.split('^');
row = [...row[0].split(';'), row[1]];
@@ -240,11 +242,11 @@ export function Client(cid, secret) {
return heartbeat = window.setInterval(this.XWB_IM_HERE, interval);
}
this.serverinfo = () => vista.serverinfo(cid);
this.userinfo = () => vista.userinfo(cid);
this.authenticate = (avcode=null) => vista.authenticate(cid, avcode);
this.authinfo = aflow(() => vista.authinfo(cid), d_unwrap, d_parse_authinfo);
this.authenticate = aflow((avcode=null) => vista.authenticate(cid, avcode), d_unwrap, d_parse_authinfo);
if(!localstate.encfs) localstate.encfs = tplfs_randpassword();
this.tplfs = async () => this._tplfs ? this._tplfs : (this._tplfs = await TplFS.fromUser(this, (await this.userinfo()).result[0]));
this.tplfs = async () => this._tplfs ? this._tplfs : (this._tplfs = await TplFS.fromUser(this, (await this.authinfo()).duz));
this.encfs = async () => this._encfs ? this._encfs : (this._encfs = await EncFS.fromPassword(await this.tplfs(), localstate.encfs));
this.remotestate = reactive({});