Making the login path nicer, dev scripting (#721)

* making username-not-found messages nicer
* adds a script to run a dev server easier
This commit is contained in:
James Hodgkinson 2022-04-29 10:44:57 +10:00 committed by GitHub
parent d6cb21eb82
commit 5eb9fa604e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 516 additions and 563 deletions

View file

@ -122,6 +122,8 @@ Record the password above, then run the server start command:
cd kanidmd/daemon cd kanidmd/daemon
cargo run --bin kanidmd server -c ../../examples/insecure_server.toml cargo run --bin kanidmd server -c ../../examples/insecure_server.toml
(The server start command is also a script in `kanidmd/daemon/run_insecure_dev_server.sh`)
In a new terminal, you can now build and run the client tools with: In a new terminal, you can now build and run the client tools with:
cargo run --bin kanidm -- --help cargo run --bin kanidm -- --help

View file

@ -0,0 +1,22 @@
#!/bin/bash
# This script based on the developer readme and allows you to run a test server.
CONFIG_FILE="../../examples/insecure_server.toml"
if [ ! -f "${CONFIG_FILE}" ]; then
SCRIPT_DIR="$(dirname -a "$0")"
echo "Couldn't find configuration file at ${CONFIG_FILE}, please ensure you're running this script from its base directory (${SCRIPT_DIR})."
exit 1
fi
if [ ! -f "/tmp/kanidm/chain.pem" ]; then
echo "Couldn't find certificate at /tmp/kanidm/chain.pem, quitting"
exit 1
fi
if [ ! -f "/tmp/kanidm/key.pem" ]; then
echo "Couldn't find key file at /tmp/kanidm/key.pem, quitting"
exit 1
fi
cargo run --bin kanidmd server -c "${CONFIG_FILE}"

View file

@ -1058,17 +1058,11 @@ impl ValueSet {
I::Utf8(set) => set.iter().cloned().collect(), I::Utf8(set) => set.iter().cloned().collect(),
I::Iutf8(set) => set.iter().cloned().collect(), I::Iutf8(set) => set.iter().cloned().collect(),
I::Iname(set) => set.iter().cloned().collect(), I::Iname(set) => set.iter().cloned().collect(),
I::Uuid(set) => set I::Uuid(set) => set.iter().map(|u| u.as_hyphenated().to_string()).collect(),
.iter()
.map(|u| u.as_hyphenated().to_string())
.collect(),
I::Bool(set) => set.iter().map(|u| u.to_string()).collect(), I::Bool(set) => set.iter().map(|u| u.to_string()).collect(),
I::Syntax(set) => set.iter().map(|u| u.to_string()).collect(), I::Syntax(set) => set.iter().map(|u| u.to_string()).collect(),
I::Index(set) => set.iter().map(|u| u.to_string()).collect(), I::Index(set) => set.iter().map(|u| u.to_string()).collect(),
I::Refer(set) => set I::Refer(set) => set.iter().map(|u| u.as_hyphenated().to_string()).collect(),
.iter()
.map(|u| u.as_hyphenated().to_string())
.collect(),
I::JsonFilt(set) => set I::JsonFilt(set) => set
.iter() .iter()
.map(|s| { .map(|s| {
@ -1100,25 +1094,15 @@ impl ValueSet {
// Should we index this? // Should we index this?
// I::OauthScope(set) => set.iter().map(|u| u.to_string()).collect(), // I::OauthScope(set) => set.iter().map(|u| u.to_string()).collect(),
I::OauthScope(_set) => vec![], I::OauthScope(_set) => vec![],
I::OauthScopeMap(map) => map I::OauthScopeMap(map) => map.keys().map(|u| u.as_hyphenated().to_string()).collect(),
.keys()
.map(|u| u.as_hyphenated().to_string())
.collect(),
I::PrivateBinary(_set) => vec![], I::PrivateBinary(_set) => vec![],
I::PublicBinary(map) => map.keys().cloned().collect(), I::PublicBinary(map) => map.keys().cloned().collect(),
I::RestrictedString(set) => set.iter().cloned().collect(), I::RestrictedString(set) => set.iter().cloned().collect(),
I::IntentToken(map) => map I::IntentToken(map) => map.keys().map(|u| u.as_hyphenated().to_string()).collect(),
.keys() I::TrustedDeviceEnrollment(map) => {
.map(|u| u.as_hyphenated().to_string()) map.keys().map(|u| u.as_hyphenated().to_string()).collect()
.collect(), }
I::TrustedDeviceEnrollment(map) => map I::AuthSession(map) => map.keys().map(|u| u.as_hyphenated().to_string()).collect(),
.keys()
.map(|u| u.as_hyphenated().to_string())
.collect(),
I::AuthSession(map) => map
.keys()
.map(|u| u.as_hyphenated().to_string())
.collect(),
} }
} }

View file

@ -18,12 +18,13 @@ treated as such.
## Documentation / Getting Started / Install ## Documentation / Getting Started / Install
If you want to deploy Kanidm to see what it can do, you should read the [kanidm book] If you want to deploy Kanidm to see what it can do, you should read the kanidm book.
We also publish limited [support guidelines]. - [Kanidm book (Latest commit)](https://kanidm.github.io/kanidm/master/)
- [Kanidm book (Latest stable)](https://kanidm.github.io/kanidm/stable/)
[kanidm book]: https://kanidm.github.io/kanidm/
[support guidelines]: https://github.com/kanidm/kanidm/blob/master/project_docs/RELEASE_AND_SUPPORT.md We also publish limited [support guidelines](https://github.com/kanidm/kanidm/blob/master/project_docs/RELEASE_AND_SUPPORT.md)).
## Code of Conduct / Ethics ## Code of Conduct / Ethics
@ -47,14 +48,14 @@ If you want to develop on the server, there is a getting started [guide for deve
is a diverse topic and we encourage contributions of many kinds in the project, from people of is a diverse topic and we encourage contributions of many kinds in the project, from people of
all backgrounds. all backgrounds.
[guide for developers]: https://github.com/kanidm/kanidm/blob/master/DEVELOPER_README.md [guide for developers]: https://kanidm.github.io/kanidm/master/DEVELOPER_README.html
## Features ## Features
### Implemented ### Implemented
* SSH key distribution for servers * SSH key distribution for servers
* Pam/nsswitch clients (with limited offline auth) * PAM/nsswitch clients (with limited offline auth)
* MFA - TOTP * MFA - TOTP
* Highly concurrent design (MVCC, COW) * Highly concurrent design (MVCC, COW)
* RADIUS integration * RADIUS integration

View file

@ -1,31 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
*/
export function run_app(): void;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly run_app: (a: number) => void;
readonly __wbindgen_malloc: (a: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
readonly __wbindgen_export_2: WebAssembly.Table;
readonly _dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h82f2f6511a22593f: (a: number, b: number, c: number) => void;
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h62c0974bc69b817a: (a: number, b: number, c: number) => void;
readonly _dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd28867f91ff91e2f: (a: number, b: number, c: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_free: (a: number, b: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
}
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;

View file

@ -34,8 +34,6 @@ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
function passStringToWasm0(arg, malloc, realloc) { function passStringToWasm0(arg, malloc, realloc) {
if (typeof(arg) !== 'string') throw new Error('expected a string argument');
if (realloc === undefined) { if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg); const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length); const ptr = malloc(buf.length);
@ -64,7 +62,7 @@ function passStringToWasm0(arg, malloc, realloc) {
ptr = realloc(ptr, len, len = offset + arg.length * 3); ptr = realloc(ptr, len, len = offset + arg.length * 3);
const view = getUint8Memory0().subarray(ptr + offset, ptr + len); const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view); const ret = encodeString(arg, view);
if (ret.read !== arg.length) throw new Error('failed to pass whole string');
offset += ret.written; offset += ret.written;
} }
@ -72,6 +70,10 @@ function passStringToWasm0(arg, malloc, realloc) {
return ptr; return ptr;
} }
function isLikeNone(x) {
return x === undefined || x === null;
}
let cachegetInt32Memory0 = null; let cachegetInt32Memory0 = null;
function getInt32Memory0() { function getInt32Memory0() {
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) { if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
@ -80,49 +82,8 @@ function getInt32Memory0() {
return cachegetInt32Memory0; return cachegetInt32Memory0;
} }
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}
let heap_next = heap.length; let heap_next = heap.length;
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
if (typeof(heap_next) !== 'number') throw new Error('corrupt heap');
heap[idx] = obj;
return idx;
}
function isLikeNone(x) {
return x === undefined || x === null;
}
function _assertNum(n) {
if (typeof(n) !== 'number') throw new Error('expected a number argument');
}
function _assertBoolean(n) {
if (typeof(n) !== 'boolean') {
throw new Error('expected a boolean argument');
}
}
let cachegetFloat64Memory0 = null;
function getFloat64Memory0() {
if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {
cachegetFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return cachegetFloat64Memory0;
}
function dropObject(idx) { function dropObject(idx) {
if (idx < 36) return; if (idx < 36) return;
heap[idx] = heap_next; heap[idx] = heap_next;
@ -135,6 +96,31 @@ function takeObject(idx) {
return ret; return ret;
} }
const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
cachedTextDecoder.decode();
function getStringFromWasm0(ptr, len) {
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
}
function addHeapObject(obj) {
if (heap_next === heap.length) heap.push(heap.length + 1);
const idx = heap_next;
heap_next = heap[idx];
heap[idx] = obj;
return idx;
}
let cachegetFloat64Memory0 = null;
function getFloat64Memory0() {
if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {
cachegetFloat64Memory0 = new Float64Array(wasm.memory.buffer);
}
return cachegetFloat64Memory0;
}
function debugString(val) { function debugString(val) {
// primitive types // primitive types
const type = typeof val; const type = typeof val;
@ -200,49 +186,6 @@ function debugString(val) {
return className; return className;
} }
function makeClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
try {
return f(state.a, state.b, ...args);
} finally {
if (--state.cnt === 0) {
wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b);
state.a = 0;
}
}
};
real.original = state;
return real;
}
function logError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
let error = (function () {
try {
return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
} catch(_) {
return "<failed to stringify thrown value>";
}
}());
console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
throw e;
}
}
function __wbg_adapter_30(arg0, arg1, arg2) {
_assertNum(arg0);
_assertNum(arg1);
wasm._dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h82f2f6511a22593f(arg0, arg1, addHeapObject(arg2));
}
function makeMutClosure(arg0, arg1, dtor, f) { function makeMutClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor }; const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => { const real = (...args) => {
@ -267,11 +210,6 @@ function makeMutClosure(arg0, arg1, dtor, f) {
return real; return real;
} }
function __wbg_adapter_33(arg0, arg1, arg2) {
_assertNum(arg0);
_assertNum(arg1);
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h62c0974bc69b817a(arg0, arg1, addHeapObject(arg2));
}
let stack_pointer = 32; let stack_pointer = 32;
@ -280,16 +218,43 @@ function addBorrowedObject(obj) {
heap[--stack_pointer] = obj; heap[--stack_pointer] = obj;
return stack_pointer; return stack_pointer;
} }
function __wbg_adapter_36(arg0, arg1, arg2) { function __wbg_adapter_30(arg0, arg1, arg2) {
try { try {
_assertNum(arg0); wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hdc06bd2245c7ddcf(arg0, arg1, addBorrowedObject(arg2));
_assertNum(arg1);
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd28867f91ff91e2f(arg0, arg1, addBorrowedObject(arg2));
} finally { } finally {
heap[stack_pointer++] = undefined; heap[stack_pointer++] = undefined;
} }
} }
function makeClosure(arg0, arg1, dtor, f) {
const state = { a: arg0, b: arg1, cnt: 1, dtor };
const real = (...args) => {
// First up with a closure we increment the internal reference
// count. This ensures that the Rust closure environment won't
// be deallocated while we're invoking it.
state.cnt++;
try {
return f(state.a, state.b, ...args);
} finally {
if (--state.cnt === 0) {
wasm.__wbindgen_export_2.get(state.dtor)(state.a, state.b);
state.a = 0;
}
}
};
real.original = state;
return real;
}
function __wbg_adapter_33(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0dfc6f9ce2f175a5(arg0, arg1, addHeapObject(arg2));
}
function __wbg_adapter_36(arg0, arg1, arg2) {
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h8177d5e6251572e3(arg0, arg1, addHeapObject(arg2));
}
/** /**
*/ */
export function run_app() { export function run_app() {
@ -369,18 +334,6 @@ async function init(input) {
} }
const imports = {}; const imports = {};
imports.wbg = {}; imports.wbg = {};
imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = JSON.stringify(obj === undefined ? null : obj);
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_string_get = function(arg0, arg1) { imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
const obj = getObject(arg1); const obj = getObject(arg1);
const ret = typeof(obj) === 'string' ? obj : undefined; const ret = typeof(obj) === 'string' ? obj : undefined;
@ -389,58 +342,24 @@ async function init(input) {
getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0; getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}; };
imports.wbg.__wbindgen_object_clone_ref = function(arg0) { imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
const ret = getObject(arg0); takeObject(arg0);
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
const ret = getStringFromWasm0(arg0, arg1);
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_json_parse = function(arg0, arg1) { imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
};
imports.wbg.__wbindgen_boolean_get = function(arg0) {
const v = getObject(arg0);
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
_assertNum(ret);
return ret;
};
imports.wbg.__wbindgen_is_undefined = function(arg0) {
const ret = getObject(arg0) === undefined;
_assertBoolean(ret);
return ret;
};
imports.wbg.__wbindgen_number_new = function(arg0) {
const ret = arg0;
return addHeapObject(ret);
};
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1); const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined; const ret = JSON.stringify(obj === undefined ? null : obj);
if (!isLikeNone(ret)) {
_assertNum(ret);
}
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
imports.wbg.__wbg_error_09919627ac0992f5 = function() { return logError(function (arg0, arg1) {
try {
console.error(getStringFromWasm0(arg0, arg1));
} finally {
wasm.__wbindgen_free(arg0, arg1);
}
}, arguments) };
imports.wbg.__wbg_new_693216e109162396 = function() { return logError(function () {
const ret = new Error();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_stack_0ddaca5d1abfb52f = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).stack;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN; const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0; getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0; getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) }; };
imports.wbg.__wbindgen_object_drop_ref = function(arg0) { imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
takeObject(arg0); const ret = getObject(arg0);
return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_cb_drop = function(arg0) { imports.wbg.__wbindgen_cb_drop = function(arg0) {
const obj = takeObject(arg0).original; const obj = takeObject(arg0).original;
@ -449,40 +368,79 @@ async function init(input) {
return true; return true;
} }
const ret = false; const ret = false;
_assertBoolean(ret);
return ret; return ret;
}; };
imports.wbg.__wbg_log_06b7ffc63a0f8bee = function() { return logError(function (arg0, arg1) { imports.wbg.__wbindgen_boolean_get = function(arg0) {
const v = getObject(arg0);
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
return ret;
};
imports.wbg.__wbindgen_is_undefined = function(arg0) {
const ret = getObject(arg0) === undefined;
return ret;
};
imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
};
imports.wbg.__wbindgen_number_new = function(arg0) {
const ret = arg0;
return addHeapObject(ret);
};
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'number' ? obj : undefined;
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
};
imports.wbg.__wbg_new_693216e109162396 = function() {
const ret = new Error();
return addHeapObject(ret);
};
imports.wbg.__wbg_stack_0ddaca5d1abfb52f = function(arg0, arg1) {
const ret = getObject(arg1).stack;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_error_09919627ac0992f5 = function(arg0, arg1) {
try {
console.error(getStringFromWasm0(arg0, arg1));
} finally {
wasm.__wbindgen_free(arg0, arg1);
}
};
imports.wbg.__wbg_log_06b7ffc63a0f8bee = function(arg0, arg1) {
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice(); var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
wasm.__wbindgen_free(arg0, arg1 * 4); wasm.__wbindgen_free(arg0, arg1 * 4);
console.log(...v0); console.log(...v0);
}, arguments) }; };
imports.wbg.__wbg_warn_2aa0e7178e1d35f6 = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_warn_2aa0e7178e1d35f6 = function(arg0, arg1) {
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice(); var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
wasm.__wbindgen_free(arg0, arg1 * 4); wasm.__wbindgen_free(arg0, arg1 * 4);
console.warn(...v0); console.warn(...v0);
}, arguments) }; };
imports.wbg.__wbg_instanceof_Window_0e6c0f1096d66c3c = function() { return logError(function (arg0) { imports.wbg.__wbg_instanceof_Window_0e6c0f1096d66c3c = function(arg0) {
const ret = getObject(arg0) instanceof Window; const ret = getObject(arg0) instanceof Window;
_assertBoolean(ret);
return ret; return ret;
}, arguments) }; };
imports.wbg.__wbg_document_99eddbbc11ec831e = function() { return logError(function (arg0) { imports.wbg.__wbg_document_99eddbbc11ec831e = function(arg0) {
const ret = getObject(arg0).document; const ret = getObject(arg0).document;
return isLikeNone(ret) ? 0 : addHeapObject(ret); return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_location_fa9019d2eb2195e8 = function() { return logError(function (arg0) { imports.wbg.__wbg_location_fa9019d2eb2195e8 = function(arg0) {
const ret = getObject(arg0).location; const ret = getObject(arg0).location;
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_history_dd96d7b18f9170a6 = function() { return handleError(function (arg0) { imports.wbg.__wbg_history_dd96d7b18f9170a6 = function() { return handleError(function (arg0) {
const ret = getObject(arg0).history; const ret = getObject(arg0).history;
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_navigator_1f72d7edb7b4c387 = function() { return logError(function (arg0) { imports.wbg.__wbg_navigator_1f72d7edb7b4c387 = function(arg0) {
const ret = getObject(arg0).navigator; const ret = getObject(arg0).navigator;
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_localStorage_6e9ba4e9a3771427 = function() { return handleError(function (arg0) { imports.wbg.__wbg_localStorage_6e9ba4e9a3771427 = function() { return handleError(function (arg0) {
const ret = getObject(arg0).localStorage; const ret = getObject(arg0).localStorage;
return isLikeNone(ret) ? 0 : addHeapObject(ret); return isLikeNone(ret) ? 0 : addHeapObject(ret);
@ -491,14 +449,14 @@ async function init(input) {
const ret = getObject(arg0).sessionStorage; const ret = getObject(arg0).sessionStorage;
return isLikeNone(ret) ? 0 : addHeapObject(ret); return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_fetch_ef7a6623d1fcd3b8 = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_fetch_ef7a6623d1fcd3b8 = function(arg0, arg1) {
const ret = getObject(arg0).fetch(getObject(arg1)); const ret = getObject(arg0).fetch(getObject(arg1));
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_body_2a1ff14b05042a51 = function() { return logError(function (arg0) { imports.wbg.__wbg_body_2a1ff14b05042a51 = function(arg0) {
const ret = getObject(arg0).body; const ret = getObject(arg0).body;
return isLikeNone(ret) ? 0 : addHeapObject(ret); return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_createElement_3c9b5f3aa42457a1 = function() { return handleError(function (arg0, arg1, arg2) { imports.wbg.__wbg_createElement_3c9b5f3aa42457a1 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2)); const ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2));
return addHeapObject(ret); return addHeapObject(ret);
@ -507,21 +465,185 @@ async function init(input) {
const ret = getObject(arg0).createElementNS(arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); const ret = getObject(arg0).createElementNS(arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_createTextNode_72cf3c22f1eed9ee = function() { return logError(function (arg0, arg1, arg2) { imports.wbg.__wbg_createTextNode_72cf3c22f1eed9ee = function(arg0, arg1, arg2) {
const ret = getObject(arg0).createTextNode(getStringFromWasm0(arg1, arg2)); const ret = getObject(arg0).createTextNode(getStringFromWasm0(arg1, arg2));
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_getElementById_f83c5de20dc455d6 = function() { return logError(function (arg0, arg1, arg2) { imports.wbg.__wbg_getElementById_f83c5de20dc455d6 = function(arg0, arg1, arg2) {
const ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2)); const ret = getObject(arg0).getElementById(getStringFromWasm0(arg1, arg2));
return isLikeNone(ret) ? 0 : addHeapObject(ret); return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_querySelector_c03126fc82664294 = function() { return handleError(function (arg0, arg1, arg2) { imports.wbg.__wbg_querySelector_c03126fc82664294 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).querySelector(getStringFromWasm0(arg1, arg2)); const ret = getObject(arg0).querySelector(getStringFromWasm0(arg1, arg2));
return isLikeNone(ret) ? 0 : addHeapObject(ret); return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_get_85a5f49f8e22030b = function() { return handleError(function (arg0, arg1, arg2, arg3) {
const ret = getObject(arg1).get(getStringFromWasm0(arg2, arg3));
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_set_6884dcc6cdd65022 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_pathname_704bbbf916a0727d = function(arg0, arg1) {
const ret = getObject(arg1).pathname;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_new_25e89e4c66f17ba3 = function() { return handleError(function (arg0, arg1) {
const ret = new URL(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_value_f232184bd0e27b00 = function(arg0, arg1) {
const ret = getObject(arg1).value;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_setvalue_8efcd1f77232ee9b = function(arg0, arg1, arg2) {
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
};
imports.wbg.__wbg_headers_0a71906114661592 = function(arg0) {
const ret = getObject(arg0).headers;
return addHeapObject(ret);
};
imports.wbg.__wbg_newwithstrandinit_fd99688f189f053e = function() { return handleError(function (arg0, arg1, arg2) {
const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_add_0e4449143d6e7625 = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).add(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_remove_90cd0eb3c01b4900 = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_get_63177ea11cf74f5a = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).get(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_href_fbf5127aa00a8b86 = function(arg0, arg1) {
const ret = getObject(arg1).href;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_instanceof_HtmlInputElement_750fccab172eab35 = function(arg0) {
const ret = getObject(arg0) instanceof HTMLInputElement;
return ret;
};
imports.wbg.__wbg_setchecked_e37cbc4fab363e71 = function(arg0, arg1) {
getObject(arg0).checked = arg1 !== 0;
};
imports.wbg.__wbg_value_14b43f7df5bd6160 = function(arg0, arg1) {
const ret = getObject(arg1).value;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_setvalue_649eb7de76d4a493 = function(arg0, arg1, arg2) {
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
};
imports.wbg.__wbg_getClientExtensionResults_8400549e426a9259 = function(arg0) {
const ret = getObject(arg0).getClientExtensionResults();
return addHeapObject(ret);
};
imports.wbg.__wbg_instanceof_Element_4fafc1ceb4cdee77 = function(arg0) {
const ret = getObject(arg0) instanceof Element;
return ret;
};
imports.wbg.__wbg_namespaceURI_3bb5841c365214c8 = function(arg0, arg1) {
const ret = getObject(arg1).namespaceURI;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbg_classList_557a7b717387d03d = function(arg0) {
const ret = getObject(arg0).classList;
return addHeapObject(ret);
};
imports.wbg.__wbg_removeAttribute_8a8f459a4b627ec4 = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).removeAttribute(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_setAttribute_8d90e00d652037be = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlElement_806c643943ab20c1 = function(arg0) {
const ret = getObject(arg0) instanceof HTMLElement;
return ret;
};
imports.wbg.__wbg_focus_42ad8e77a7a0b22a = function() { return handleError(function (arg0) {
getObject(arg0).focus();
}, arguments) };
imports.wbg.__wbg_instanceof_Event_2311550b7d159b6e = function(arg0) {
const ret = getObject(arg0) instanceof Event;
return ret;
};
imports.wbg.__wbg_target_46fd3a29f64b0e43 = function(arg0) {
const ret = getObject(arg0).target;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_cancelBubble_7446704fccad1780 = function(arg0) {
const ret = getObject(arg0).cancelBubble;
return ret;
};
imports.wbg.__wbg_preventDefault_747982fd5fe3b6d0 = function(arg0) {
getObject(arg0).preventDefault();
};
imports.wbg.__wbg_credentials_f81f9e33f9789a54 = function(arg0) {
const ret = getObject(arg0).credentials;
return addHeapObject(ret);
};
imports.wbg.__wbg_addEventListener_be0c061a1359c1dd = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), getObject(arg4));
}, arguments) };
imports.wbg.__wbg_removeEventListener_3e7319b5d7c8be8f = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), arg4 !== 0);
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlDocument_a4a9eb971e2c2b02 = function(arg0) {
const ret = getObject(arg0) instanceof HTMLDocument;
return ret;
};
imports.wbg.__wbg_cookie_4b5805da6b19c329 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg1).cookie;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_pushState_b0c96c33f80b8f64 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) { imports.wbg.__wbg_pushState_b0c96c33f80b8f64 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
getObject(arg0).pushState(getObject(arg1), getStringFromWasm0(arg2, arg3), arg4 === 0 ? undefined : getStringFromWasm0(arg4, arg5)); getObject(arg0).pushState(getObject(arg1), getStringFromWasm0(arg2, arg3), arg4 === 0 ? undefined : getStringFromWasm0(arg4, arg5));
}, arguments) }; }, arguments) };
imports.wbg.__wbg_parentElement_d078cf0bd5c4b641 = function(arg0) {
const ret = getObject(arg0).parentElement;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_lastChild_84687239bfef7d2f = function(arg0) {
const ret = getObject(arg0).lastChild;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
};
imports.wbg.__wbg_setnodeValue_77a78d32cf9e9152 = function(arg0, arg1, arg2) {
getObject(arg0).nodeValue = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2);
};
imports.wbg.__wbg_appendChild_a86c0da8d152eae4 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).appendChild(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_insertBefore_4df558a2aa0435c1 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).insertBefore(getObject(arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_removeChild_b4ce6c8d6e5d47be = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).removeChild(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_pathname_805641640383ca79 = function() { return handleError(function (arg0, arg1) { imports.wbg.__wbg_pathname_805641640383ca79 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg1).pathname; const ret = getObject(arg1).pathname;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@ -539,20 +661,18 @@ async function init(input) {
imports.wbg.__wbg_replace_345170f940d047af = function() { return handleError(function (arg0, arg1, arg2) { imports.wbg.__wbg_replace_345170f940d047af = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).replace(getStringFromWasm0(arg1, arg2)); getObject(arg0).replace(getStringFromWasm0(arg1, arg2));
}, arguments) }; }, arguments) };
imports.wbg.__wbg_instanceof_Response_ccfeb62399355bcd = function() { return logError(function (arg0) { imports.wbg.__wbg_instanceof_Response_ccfeb62399355bcd = function(arg0) {
const ret = getObject(arg0) instanceof Response; const ret = getObject(arg0) instanceof Response;
_assertBoolean(ret);
return ret; return ret;
}, arguments) }; };
imports.wbg.__wbg_status_600fd8b881393898 = function() { return logError(function (arg0) { imports.wbg.__wbg_status_600fd8b881393898 = function(arg0) {
const ret = getObject(arg0).status; const ret = getObject(arg0).status;
_assertNum(ret);
return ret; return ret;
}, arguments) }; };
imports.wbg.__wbg_headers_9e7f2c05a9b962ea = function() { return logError(function (arg0) { imports.wbg.__wbg_headers_9e7f2c05a9b962ea = function(arg0) {
const ret = getObject(arg0).headers; const ret = getObject(arg0).headers;
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_json_df9259ba758ea2fe = function() { return handleError(function (arg0) { imports.wbg.__wbg_json_df9259ba758ea2fe = function() { return handleError(function (arg0) {
const ret = getObject(arg0).json(); const ret = getObject(arg0).json();
return addHeapObject(ret); return addHeapObject(ret);
@ -574,239 +694,66 @@ async function init(input) {
imports.wbg.__wbg_setItem_ed2ea572329ab721 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) { imports.wbg.__wbg_setItem_ed2ea572329ab721 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4)); getObject(arg0).setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) }; }, arguments) };
imports.wbg.__wbg_get_85a5f49f8e22030b = function() { return handleError(function (arg0, arg1, arg2, arg3) { imports.wbg.__wbg_new_94fb1279cf6afea5 = function() {
const ret = getObject(arg1).get(getStringFromWasm0(arg2, arg3));
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_set_6884dcc6cdd65022 = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_headers_0a71906114661592 = function() { return logError(function (arg0) {
const ret = getObject(arg0).headers;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_newwithstrandinit_fd99688f189f053e = function() { return handleError(function (arg0, arg1, arg2) {
const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_pathname_704bbbf916a0727d = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).pathname;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_new_25e89e4c66f17ba3 = function() { return handleError(function (arg0, arg1) {
const ret = new URL(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_get_63177ea11cf74f5a = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).get(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_add_0e4449143d6e7625 = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).add(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_remove_90cd0eb3c01b4900 = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_href_fbf5127aa00a8b86 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).href;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_value_f232184bd0e27b00 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).value;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_setvalue_8efcd1f77232ee9b = function() { return logError(function (arg0, arg1, arg2) {
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
}, arguments) };
imports.wbg.__wbg_instanceof_Element_4fafc1ceb4cdee77 = function() { return logError(function (arg0) {
const ret = getObject(arg0) instanceof Element;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_namespaceURI_3bb5841c365214c8 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).namespaceURI;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_classList_557a7b717387d03d = function() { return logError(function (arg0) {
const ret = getObject(arg0).classList;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_removeAttribute_8a8f459a4b627ec4 = function() { return handleError(function (arg0, arg1, arg2) {
getObject(arg0).removeAttribute(getStringFromWasm0(arg1, arg2));
}, arguments) };
imports.wbg.__wbg_setAttribute_8d90e00d652037be = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).setAttribute(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlElement_806c643943ab20c1 = function() { return logError(function (arg0) {
const ret = getObject(arg0) instanceof HTMLElement;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_focus_42ad8e77a7a0b22a = function() { return handleError(function (arg0) {
getObject(arg0).focus();
}, arguments) };
imports.wbg.__wbg_instanceof_Event_2311550b7d159b6e = function() { return logError(function (arg0) {
const ret = getObject(arg0) instanceof Event;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_target_46fd3a29f64b0e43 = function() { return logError(function (arg0) {
const ret = getObject(arg0).target;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_cancelBubble_7446704fccad1780 = function() { return logError(function (arg0) {
const ret = getObject(arg0).cancelBubble;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_preventDefault_747982fd5fe3b6d0 = function() { return logError(function (arg0) {
getObject(arg0).preventDefault();
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlInputElement_750fccab172eab35 = function() { return logError(function (arg0) {
const ret = getObject(arg0) instanceof HTMLInputElement;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_setchecked_e37cbc4fab363e71 = function() { return logError(function (arg0, arg1) {
getObject(arg0).checked = arg1 !== 0;
}, arguments) };
imports.wbg.__wbg_value_14b43f7df5bd6160 = function() { return logError(function (arg0, arg1) {
const ret = getObject(arg1).value;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_setvalue_649eb7de76d4a493 = function() { return logError(function (arg0, arg1, arg2) {
getObject(arg0).value = getStringFromWasm0(arg1, arg2);
}, arguments) };
imports.wbg.__wbg_getClientExtensionResults_8400549e426a9259 = function() { return logError(function (arg0) {
const ret = getObject(arg0).getClientExtensionResults();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_addEventListener_be0c061a1359c1dd = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).addEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), getObject(arg4));
}, arguments) };
imports.wbg.__wbg_removeEventListener_3e7319b5d7c8be8f = function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
getObject(arg0).removeEventListener(getStringFromWasm0(arg1, arg2), getObject(arg3), arg4 !== 0);
}, arguments) };
imports.wbg.__wbg_credentials_f81f9e33f9789a54 = function() { return logError(function (arg0) {
const ret = getObject(arg0).credentials;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_instanceof_HtmlDocument_a4a9eb971e2c2b02 = function() { return logError(function (arg0) {
const ret = getObject(arg0) instanceof HTMLDocument;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_cookie_4b5805da6b19c329 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg1).cookie;
const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
}, arguments) };
imports.wbg.__wbg_parentElement_d078cf0bd5c4b641 = function() { return logError(function (arg0) {
const ret = getObject(arg0).parentElement;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_lastChild_84687239bfef7d2f = function() { return logError(function (arg0) {
const ret = getObject(arg0).lastChild;
return isLikeNone(ret) ? 0 : addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_setnodeValue_77a78d32cf9e9152 = function() { return logError(function (arg0, arg1, arg2) {
getObject(arg0).nodeValue = arg1 === 0 ? undefined : getStringFromWasm0(arg1, arg2);
}, arguments) };
imports.wbg.__wbg_appendChild_a86c0da8d152eae4 = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).appendChild(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_insertBefore_4df558a2aa0435c1 = function() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).insertBefore(getObject(arg1), getObject(arg2));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_removeChild_b4ce6c8d6e5d47be = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).removeChild(getObject(arg1));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_new_94fb1279cf6afea5 = function() { return logError(function () {
const ret = new Array(); const ret = new Array();
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_push_40c6a90f1805aa90 = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_newnoargs_e23b458e372830de = function(arg0, arg1) {
const ret = getObject(arg0).push(getObject(arg1));
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_instanceof_Error_b074c76f6096db9b = function() { return logError(function (arg0) {
const ret = getObject(arg0) instanceof Error;
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_message_dcca38fbff239fbf = function() { return logError(function (arg0) {
const ret = getObject(arg0).message;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_name_642dd84602f48d65 = function() { return logError(function (arg0) {
const ret = getObject(arg0).name;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_toString_eec28c54c24b830b = function() { return logError(function (arg0) {
const ret = getObject(arg0).toString();
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_newnoargs_e23b458e372830de = function() { return logError(function (arg0, arg1) {
const ret = new Function(getStringFromWasm0(arg0, arg1)); const ret = new Function(getStringFromWasm0(arg0, arg1));
return addHeapObject(ret); return addHeapObject(ret);
};
imports.wbg.__wbg_get_a9cab131e3152c49 = function() { return handleError(function (arg0, arg1) {
const ret = Reflect.get(getObject(arg0), getObject(arg1));
return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_call_ae78342adc33730a = function() { return handleError(function (arg0, arg1) { imports.wbg.__wbg_call_ae78342adc33730a = function() { return handleError(function (arg0, arg1) {
const ret = getObject(arg0).call(getObject(arg1)); const ret = getObject(arg0).call(getObject(arg1));
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_valueOf_a08afc4df5d92043 = function() { return logError(function (arg0) { imports.wbg.__wbg_new_36359baae5a47e27 = function() {
const ret = getObject(arg0).valueOf();
return ret;
}, arguments) };
imports.wbg.__wbg_is_40969b082b54c84d = function() { return logError(function (arg0, arg1) {
const ret = Object.is(getObject(arg0), getObject(arg1));
_assertBoolean(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_new_36359baae5a47e27 = function() { return logError(function () {
const ret = new Object(); const ret = new Object();
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function() { return logError(function (arg0) { imports.wbg.__wbg_push_40c6a90f1805aa90 = function(arg0, arg1) {
const ret = getObject(arg0).push(getObject(arg1));
return ret;
};
imports.wbg.__wbg_instanceof_Error_b074c76f6096db9b = function(arg0) {
const ret = getObject(arg0) instanceof Error;
return ret;
};
imports.wbg.__wbg_message_dcca38fbff239fbf = function(arg0) {
const ret = getObject(arg0).message;
return addHeapObject(ret);
};
imports.wbg.__wbg_name_642dd84602f48d65 = function(arg0) {
const ret = getObject(arg0).name;
return addHeapObject(ret);
};
imports.wbg.__wbg_toString_eec28c54c24b830b = function(arg0) {
const ret = getObject(arg0).toString();
return addHeapObject(ret);
};
imports.wbg.__wbg_valueOf_a08afc4df5d92043 = function(arg0) {
const ret = getObject(arg0).valueOf();
return ret;
};
imports.wbg.__wbg_is_40969b082b54c84d = function(arg0, arg1) {
const ret = Object.is(getObject(arg0), getObject(arg1));
return ret;
};
imports.wbg.__wbg_resolve_a9a87bdd64e9e62c = function(arg0) {
const ret = Promise.resolve(getObject(arg0)); const ret = Promise.resolve(getObject(arg0));
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_then_ce526c837d07b68f = function() { return logError(function (arg0, arg1) { imports.wbg.__wbg_then_ce526c837d07b68f = function(arg0, arg1) {
const ret = getObject(arg0).then(getObject(arg1)); const ret = getObject(arg0).then(getObject(arg1));
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_then_842e65b843962f56 = function() { return logError(function (arg0, arg1, arg2) { imports.wbg.__wbg_then_842e65b843962f56 = function(arg0, arg1, arg2) {
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2)); const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() { return handleError(function () { imports.wbg.__wbg_self_99737b4dcdf6f0d8 = function() { return handleError(function () {
const ret = self.self; const ret = self.self;
return addHeapObject(ret); return addHeapObject(ret);
@ -815,37 +762,35 @@ async function init(input) {
const ret = window.window; const ret = window.window;
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_globalThis_8e275ef40caea3a3 = function() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_global_5de1e0f82bddcd27 = function() { return handleError(function () { imports.wbg.__wbg_global_5de1e0f82bddcd27 = function() { return handleError(function () {
const ret = global.global; const ret = global.global;
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; }, arguments) };
imports.wbg.__wbg_new_cc9018bd6f283b6f = function() { return logError(function (arg0) { imports.wbg.__wbg_buffer_7af23f65f6c64548 = function(arg0) {
const ret = new Uint8Array(getObject(arg0));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function() { return logError(function (arg0, arg1, arg2) {
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function() { return logError(function (arg0) {
const ret = getObject(arg0).length;
_assertNum(ret);
return ret;
}, arguments) };
imports.wbg.__wbg_set_f25e869e4565d2a2 = function() { return logError(function (arg0, arg1, arg2) {
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
}, arguments) };
imports.wbg.__wbg_buffer_7af23f65f6c64548 = function() { return logError(function (arg0) {
const ret = getObject(arg0).buffer; const ret = getObject(arg0).buffer;
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_get_a9cab131e3152c49 = function() { return handleError(function (arg0, arg1) { imports.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974 = function(arg0, arg1, arg2) {
const ret = Reflect.get(getObject(arg0), getObject(arg1)); const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbg_new_cc9018bd6f283b6f = function(arg0) {
const ret = new Uint8Array(getObject(arg0));
return addHeapObject(ret);
};
imports.wbg.__wbg_set_f25e869e4565d2a2 = function(arg0, arg1, arg2) {
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
};
imports.wbg.__wbg_length_0acb1cf9bbaf8519 = function(arg0) {
const ret = getObject(arg0).length;
return ret;
};
imports.wbg.__wbg_set_93b1c87ee2af852e = function() { return handleError(function (arg0, arg1, arg2) { imports.wbg.__wbg_set_93b1c87ee2af852e = function() { return handleError(function (arg0, arg1, arg2) {
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2)); const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
_assertBoolean(ret);
return ret; return ret;
}, arguments) }; }, arguments) };
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
@ -862,18 +807,18 @@ async function init(input) {
const ret = wasm.memory; const ret = wasm.memory;
return addHeapObject(ret); return addHeapObject(ret);
}; };
imports.wbg.__wbindgen_closure_wrapper12105 = function() { return logError(function (arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper1347 = function(arg0, arg1, arg2) {
const ret = makeClosure(arg0, arg1, 848, __wbg_adapter_30); const ret = makeMutClosure(arg0, arg1, 554, __wbg_adapter_30);
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbindgen_closure_wrapper15823 = function() { return logError(function (arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper1587 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 885, __wbg_adapter_33); const ret = makeClosure(arg0, arg1, 604, __wbg_adapter_33);
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
imports.wbg.__wbindgen_closure_wrapper16232 = function() { return logError(function (arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper1715 = function(arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 904, __wbg_adapter_36); const ret = makeMutClosure(arg0, arg1, 647, __wbg_adapter_36);
return addHeapObject(ret); return addHeapObject(ret);
}, arguments) }; };
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
input = fetch(input); input = fetch(input);

View file

@ -1,13 +0,0 @@
/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function run_app(a: number): void;
export function __wbindgen_malloc(a: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number): number;
export const __wbindgen_export_2: WebAssembly.Table;
export function _dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h82f2f6511a22593f(a: number, b: number, c: number): void;
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h62c0974bc69b817a(a: number, b: number, c: number): void;
export function _dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd28867f91ff91e2f(a: number, b: number, c: number): void;
export function __wbindgen_add_to_stack_pointer(a: number): number;
export function __wbindgen_free(a: number, b: number): void;
export function __wbindgen_exn_store(a: number): void;

View file

@ -14,11 +14,9 @@
"files": [ "files": [
"kanidmd_web_ui_bg.wasm", "kanidmd_web_ui_bg.wasm",
"kanidmd_web_ui.js", "kanidmd_web_ui.js",
"kanidmd_web_ui.d.ts",
"LICENSE.md" "LICENSE.md"
], ],
"module": "kanidmd_web_ui.js", "module": "kanidmd_web_ui.js",
"homepage": "https://github.com/kanidm/kanidm/", "homepage": "https://github.com/kanidm/kanidm/",
"types": "kanidmd_web_ui.d.ts",
"sideEffects": false "sideEffects": false
} }

View file

@ -43,6 +43,7 @@ enum LoginState {
Totp(TotpState), Totp(TotpState),
Webauthn(web_sys::CredentialRequestOptions), Webauthn(web_sys::CredentialRequestOptions),
Error { emsg: String, kopid: Option<String> }, Error { emsg: String, kopid: Option<String> },
UnknownUser,
Denied(String), Denied(String),
Authenticated, Authenticated,
} }
@ -59,6 +60,7 @@ pub enum LoginAppMsg {
Next(AuthResponse), Next(AuthResponse),
Continue(usize), Continue(usize),
// DoNothing, // DoNothing,
UnknownUser,
Error { emsg: String, kopid: Option<String> }, Error { emsg: String, kopid: Option<String> },
} }
@ -107,6 +109,14 @@ impl LoginApp {
let jsval = JsFuture::from(resp.json()?).await?; let jsval = JsFuture::from(resp.json()?).await?;
let state: AuthResponse = jsval.into_serde().expect_throw("Invalid response type"); let state: AuthResponse = jsval.into_serde().expect_throw("Invalid response type");
Ok(LoginAppMsg::Start(session_id, state)) Ok(LoginAppMsg::Start(session_id, state))
} else if status == 404 {
let kopid = headers.get("x-kanidm-opid").ok().flatten();
let text = JsFuture::from(resp.text()?).await?;
console::log!(format!(
"User not found: {:?}. Operation ID: {:?}",
text, kopid
));
Ok(LoginAppMsg::UnknownUser)
} else { } else {
let kopid = headers.get("x-kanidm-opid").ok().flatten(); let kopid = headers.get("x-kanidm-opid").ok().flatten();
let text = JsFuture::from(resp.text()?).await?; let text = JsFuture::from(resp.text()?).await?;
@ -133,11 +143,11 @@ impl LoginApp {
request request
.headers() .headers()
.set("content-type", "application/json") .set("content-type", "application/json")
.expect_throw("failed to set header"); .expect_throw("failed to set content-type header");
request request
.headers() .headers()
.set("x-kanidm-auth-session-id", session_id.as_str()) .set("x-kanidm-auth-session-id", session_id.as_str())
.expect_throw("failed to set header"); .expect_throw("failed to set x-kanidm-auth-session-id header");
let window = utils::window(); let window = utils::window();
let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?; let resp_value = JsFuture::from(window.fetch_with_request(&request)).await?;
@ -147,12 +157,13 @@ impl LoginApp {
if status == 200 { if status == 200 {
let jsval = JsFuture::from(resp.json()?).await?; let jsval = JsFuture::from(resp.json()?).await?;
let state: AuthResponse = jsval.into_serde().expect_throw("Invalid response type"); let state: AuthResponse = jsval.into_serde().expect_throw("Invalid response type.");
Ok(LoginAppMsg::Next(state)) Ok(LoginAppMsg::Next(state))
} else { } else {
let kopid = headers.get("x-kanidm-opid").ok().flatten(); let kopid = headers.get("x-kanidm-opid").ok().flatten();
let text = JsFuture::from(resp.text()?).await?; let text = JsFuture::from(resp.text()?).await?;
let emsg = text.as_string().unwrap_or_else(|| "".to_string()); let emsg = text.as_string()
.unwrap_or_else(|| "Unhandled error, please report this along with the operation ID below to your administrator. 😔".to_string());
Ok(LoginAppMsg::Error { emsg, kopid }) Ok(LoginAppMsg::Error { emsg, kopid })
} }
} }
@ -176,19 +187,16 @@ impl LoginApp {
html! { html! {
<> <>
<div class="container"> <div class="container">
<p> <label for="autofocus" class="form-label">{ " Username " }</label>
{" Username: "}
</p>
</div>
<div class="container">
<form <form
onsubmit={ ctx.link().callback(|e: FocusEvent| { onsubmit={ ctx.link().callback(|e: FocusEvent| {
console::log!("login::view_state -> Init - prevent_default()"); console::log!("login::view_state -> Init - prevent_default()".to_string());
e.prevent_default(); e.prevent_default();
LoginAppMsg::Begin LoginAppMsg::Begin
} ) } } ) }
action="javascript:void(0);" action="javascript:void(0);"
> >
<div class="input-group mb-3">
<input id="autofocus" <input id="autofocus"
type="text" type="text"
class="form-control" class="form-control"
@ -196,11 +204,15 @@ impl LoginApp {
disabled={ !enable } disabled={ !enable }
oninput={ ctx.link().callback(|e: InputEvent| LoginAppMsg::Input(utils::get_value_from_input_event(e))) } oninput={ ctx.link().callback(|e: InputEvent| LoginAppMsg::Input(utils::get_value_from_input_event(e))) }
/> />
</div>
<div class="input-group mb-3 justify-content-md-center">
<button <button
type="submit" type="submit"
class="btn btn-dark" class="btn btn-dark"
disabled={ !enable } disabled={ !enable }
>{" Begin "}</button> >{" Begin "}</button>
</div>
</form> </form>
</div> </div>
</> </>
@ -235,7 +247,7 @@ impl LoginApp {
<div class="container"> <div class="container">
<form <form
onsubmit={ ctx.link().callback(|e: FocusEvent| { onsubmit={ ctx.link().callback(|e: FocusEvent| {
console::log!("login::view_state -> Password - prevent_default()"); console::log!("login::view_state -> Password - prevent_default()".to_string());
e.prevent_default(); e.prevent_default();
LoginAppMsg::PasswordSubmit LoginAppMsg::PasswordSubmit
} ) } } ) }
@ -266,7 +278,7 @@ impl LoginApp {
<div class="container"> <div class="container">
<form <form
onsubmit={ ctx.link().callback(|e: FocusEvent| { onsubmit={ ctx.link().callback(|e: FocusEvent| {
console::log!("login::view_state -> BackupCode - prevent_default()"); console::log!("login::view_state -> BackupCode - prevent_default()".to_string());
e.prevent_default(); e.prevent_default();
LoginAppMsg::BackupCodeSubmit LoginAppMsg::BackupCodeSubmit
} ) } } ) }
@ -298,7 +310,7 @@ impl LoginApp {
<div class="container"> <div class="container">
<form <form
onsubmit={ ctx.link().callback(|e: FocusEvent| { onsubmit={ ctx.link().callback(|e: FocusEvent| {
console::log!("login::view_state -> Totp - prevent_default()"); console::log!("login::view_state -> Totp - prevent_default()".to_string());
e.prevent_default(); e.prevent_default();
LoginAppMsg::TotpSubmit LoginAppMsg::TotpSubmit
} ) } } ) }
@ -374,15 +386,35 @@ impl LoginApp {
} }
} }
LoginState::Denied(msg) => { LoginState::Denied(msg) => {
html! {
<div class="container">
<div class="row justify-content-md-center">
<div class="alert alert-danger" role="alert">
<p><strong>{ "Authentication Denied" }</strong></p>
<p>{ msg.as_str() }</p>
</div>
<div class="col-md-auto">
<button type="button" class="btn btn-dark" onclick={ ctx.link().callback(|_| LoginAppMsg::Restart) } >{" Start Again "}</button>
</div>
</div>
</div>
}
}
LoginState::UnknownUser => {
html! { html! {
<div class="container"> <div class="container">
<p> <div class="row justify-content-md-center">
{ "Authentication Denied" } <div class="alert alert-danger" role="alert">
</p> { "That username was not found. Please try again!" }
<p> </div>
{ msg.as_str() } <div class="col-md-auto">
</p> <button type="button"
<button type="button" class="btn btn-dark" onclick={ ctx.link().callback(|_| LoginAppMsg::Restart) } >{" Start Again "}</button> class="btn btn-dark"
onclick={ ctx.link().callback(|_| LoginAppMsg::Restart) }
>
{" Start Again "}</button>
</div>
</div>
</div> </div>
} }
} }
@ -396,7 +428,13 @@ impl LoginApp {
{ emsg.as_str() } { emsg.as_str() }
</p> </p>
<p> <p>
{ if let Some(opid) = kopid.as_ref() { opid.clone() } else { "Local Error".to_string() } } {
if let Some(opid) = kopid.as_ref() {
format!("Operation ID: {}", opid.clone())
}
else {
"Local Error".to_string() }
}
</p> </p>
</div> </div>
} }
@ -410,8 +448,7 @@ impl Component for LoginApp {
type Properties = (); type Properties = ();
fn create(_ctx: &Context<Self>) -> Self { fn create(_ctx: &Context<Self>) -> Self {
console::log!("create"); console::log!("create".to_string());
// Assume we are here for a good reason. // Assume we are here for a good reason.
models::clear_bearer_token(); models::clear_bearer_token();
// Do we have a login hint? // Do we have a login hint?
@ -425,14 +462,14 @@ impl Component for LoginApp {
let cookie = html_document let cookie = html_document
.cookie() .cookie()
.expect_throw("failed to access page cookies"); .expect_throw("failed to access page cookies");
console::log!("cookies"); console::log!("cookies".to_string());
console::log!(cookie.as_str()); console::log!(cookie.to_string());
let state = LoginState::Init(true); let state = LoginState::Init(true);
// startConfetti(); // startConfetti();
if let Err(e) = crate::utils::body().class_list().add_1("form-signin-body") { if let Err(e) = crate::utils::body().class_list().add_1("form-signin-body") {
console::log!(format!("class_list add error -> {:?}", e).as_str()); console::log!(format!("class_list add error -> {:?}", e));
}; };
LoginApp { LoginApp {
@ -460,7 +497,7 @@ impl Component for LoginApp {
true true
} }
LoginAppMsg::Begin => { LoginAppMsg::Begin => {
console::log!(format!("begin -> {:?}", self.inputvalue).as_str()); console::log!(format!("begin -> {:?}", self.inputvalue));
// Disable the button? // Disable the button?
let username = self.inputvalue.clone(); let username = self.inputvalue.clone();
ctx.link().send_future(async { ctx.link().send_future(async {
@ -473,7 +510,7 @@ impl Component for LoginApp {
true true
} }
LoginAppMsg::PasswordSubmit => { LoginAppMsg::PasswordSubmit => {
console::log!("password"); console::log!("At password step".to_string());
// Disable the button? // Disable the button?
self.state = LoginState::Password(false); self.state = LoginState::Password(false);
let authreq = AuthRequest { let authreq = AuthRequest {
@ -491,7 +528,7 @@ impl Component for LoginApp {
true true
} }
LoginAppMsg::BackupCodeSubmit => { LoginAppMsg::BackupCodeSubmit => {
console::log!("backupcode"); console::log!("backupcode".to_string());
// Disable the button? // Disable the button?
self.state = LoginState::BackupCode(false); self.state = LoginState::BackupCode(false);
let authreq = AuthRequest { let authreq = AuthRequest {
@ -509,7 +546,7 @@ impl Component for LoginApp {
true true
} }
LoginAppMsg::TotpSubmit => { LoginAppMsg::TotpSubmit => {
console::log!("totp"); console::log!("totp".to_string());
// Disable the button? // Disable the button?
match self.inputvalue.parse::<u32>() { match self.inputvalue.parse::<u32>() {
Ok(totp) => { Ok(totp) => {
@ -536,7 +573,7 @@ impl Component for LoginApp {
true true
} }
LoginAppMsg::WebauthnSubmit(resp) => { LoginAppMsg::WebauthnSubmit(resp) => {
console::log!("webauthn"); console::log!("At webauthn step".to_string());
let authreq = AuthRequest { let authreq = AuthRequest {
step: AuthStep::Cred(AuthCredential::Webauthn(resp)), step: AuthStep::Cred(AuthCredential::Webauthn(resp)),
}; };
@ -553,7 +590,7 @@ impl Component for LoginApp {
LoginAppMsg::Start(session_id, resp) => { LoginAppMsg::Start(session_id, resp) => {
// Clear any leftover input // Clear any leftover input
self.inputvalue = "".to_string(); self.inputvalue = "".to_string();
console::log!(format!("start -> {:?} : {:?}", resp, session_id).as_str()); console::log!(format!("start -> {:?} : {:?}", resp, session_id));
match resp.state { match resp.state {
AuthState::Choose(mut mechs) => { AuthState::Choose(mut mechs) => {
self.session_id = session_id; self.session_id = session_id;
@ -574,7 +611,7 @@ impl Component for LoginApp {
false false
} else { } else {
// Offer the choices. // Offer the choices.
console::log!("unimplemented"); console::log!("This is currently unimplemented".to_string());
self.state = LoginState::Error { self.state = LoginState::Error {
emsg: "Unimplemented".to_string(), emsg: "Unimplemented".to_string(),
kopid: None, kopid: None,
@ -583,12 +620,12 @@ impl Component for LoginApp {
} }
} }
AuthState::Denied(reason) => { AuthState::Denied(reason) => {
console::log!(format!("denied -> {:?}", reason).as_str()); console::log!(format!("denied -> {:?}", reason));
self.state = LoginState::Denied(reason); self.state = LoginState::Denied(reason);
true true
} }
_ => { _ => {
console::log!("invalid state transition"); console::log!("invalid state transition".to_string());
self.state = LoginState::Error { self.state = LoginState::Error {
emsg: "Invalid UI State Transition".to_string(), emsg: "Invalid UI State Transition".to_string(),
kopid: None, kopid: None,
@ -600,11 +637,12 @@ impl Component for LoginApp {
LoginAppMsg::Next(resp) => { LoginAppMsg::Next(resp) => {
// Clear any leftover input // Clear any leftover input
self.inputvalue = "".to_string(); self.inputvalue = "".to_string();
console::log!(format!("next -> {:?}", resp).as_str()); console::log!(format!("next -> {:?}", resp));
// Based on the state we have, we need to chose our steps. // Based on the state we have, we need to chose our steps.
match resp.state { match resp.state {
AuthState::Choose(_mechs) => { AuthState::Choose(_mechs) => {
console::log!("invalid state transition"); console::log!("invalid state transition".to_string());
self.state = LoginState::Error { self.state = LoginState::Error {
emsg: "Invalid UI State Transition".to_string(), emsg: "Invalid UI State Transition".to_string(),
kopid: None, kopid: None,
@ -634,13 +672,13 @@ impl Component for LoginApp {
} }
} else { } else {
// Else, present the options in a choice. // Else, present the options in a choice.
console::log!("multiple choices exist"); console::log!("multiple choices exist".to_string());
self.state = LoginState::Continue(allowed); self.state = LoginState::Continue(allowed);
} }
true true
} }
AuthState::Denied(reason) => { AuthState::Denied(reason) => {
console::log!(format!("denied -> {:?}", reason).as_str()); console::log!(format!("denied -> {:?}", reason));
self.state = LoginState::Denied(reason); self.state = LoginState::Denied(reason);
true true
} }
@ -654,7 +692,7 @@ impl Component for LoginApp {
} }
LoginAppMsg::Continue(idx) => { LoginAppMsg::Continue(idx) => {
// Are we in the correct internal state? // Are we in the correct internal state?
console::log!(format!("chose -> {:?}", idx).as_str()); console::log!(format!("chose -> {:?}", idx));
match &self.state { match &self.state {
LoginState::Continue(allowed) => { LoginState::Continue(allowed) => {
match allowed.get(idx) { match allowed.get(idx) {
@ -675,7 +713,7 @@ impl Component for LoginApp {
self.state = LoginState::Webauthn(challenge.clone().into()) self.state = LoginState::Webauthn(challenge.clone().into())
} }
None => { None => {
console::log!("invalid allowed mech idx"); console::log!("invalid allowed mech idx".to_string());
self.state = LoginState::Error { self.state = LoginState::Error {
emsg: "Invalid Continue Index".to_string(), emsg: "Invalid Continue Index".to_string(),
kopid: None, kopid: None,
@ -684,7 +722,7 @@ impl Component for LoginApp {
} }
} }
_ => { _ => {
console::log!("invalid state transition"); console::log!("invalid state transition".to_string());
self.state = LoginState::Error { self.state = LoginState::Error {
emsg: "Invalid UI State Transition".to_string(), emsg: "Invalid UI State Transition".to_string(),
kopid: None, kopid: None,
@ -693,10 +731,17 @@ impl Component for LoginApp {
} }
true true
} }
LoginAppMsg::UnknownUser => {
// Clear any leftover input
self.inputvalue = "".to_string();
console::log!("Unknown user".to_string());
self.state = LoginState::UnknownUser;
true
}
LoginAppMsg::Error { emsg, kopid } => { LoginAppMsg::Error { emsg, kopid } => {
// Clear any leftover input // Clear any leftover input
self.inputvalue = "".to_string(); self.inputvalue = "".to_string();
console::log!(format!("error -> {:?}, {:?}", emsg, kopid).as_str()); console::log!(format!("error -> {:?}, {:?}", emsg, kopid));
self.state = LoginState::Error { emsg, kopid }; self.state = LoginState::Error { emsg, kopid };
true true
} }
@ -704,7 +749,7 @@ impl Component for LoginApp {
} }
fn view(&self, ctx: &Context<Self>) -> Html { fn view(&self, ctx: &Context<Self>) -> Html {
console::log!("login::view"); console::log!("login::view".to_string());
// How do we add a top level theme? // How do we add a top level theme?
/* /*
let (width, height): (u32, u32) = if let Some(win) = web_sys::window() { let (width, height): (u32, u32) = if let Some(win) = web_sys::window() {
@ -725,27 +770,27 @@ impl Component for LoginApp {
// May need to set these classes? // May need to set these classes?
// <body class="html-body form-body"> // <body class="html-body form-body">
html! { html! {
<main class="form-signin"> <main class="form-signin">
<div class="container"> <div class="container">
<h2>{ "Kanidm Alpha 🦀 " }</h2> <h2>{ "Kanidm Alpha 🦀" }</h2>
</div> </div>
{ self.view_state(ctx) } { self.view_state(ctx) }
</main> </main>
} }
} }
fn destroy(&mut self, _ctx: &Context<Self>) { fn destroy(&mut self, _ctx: &Context<Self>) {
console::log!("login::destroy"); console::log!("login::destroy".to_string());
if let Err(e) = crate::utils::body() if let Err(e) = crate::utils::body()
.class_list() .class_list()
.remove_1("form-signin-body") .remove_1("form-signin-body")
{ {
console::log!(format!("class_list remove error -> {:?}", e).as_str()); console::log!(format!("class_list remove error -> {:?}", e));
} }
} }
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) { fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
crate::utils::autofocus(); crate::utils::autofocus();
console::log!("login::rendered"); console::log!("login::rendered".to_string());
} }
} }