mirror of
https://github.com/kanidm/kanidm.git
synced 2025-05-20 16:03:55 +02:00
20221121 debug webui (#1217)
* Fixes for sessions/debug * Fix up debug levels
This commit is contained in:
parent
a8cc14217b
commit
9a9f61ff2b
kanidmd/core/src/https
kanidmd_web_ui
|
@ -384,7 +384,10 @@ pub fn create_https_server(
|
|||
tserver.with(
|
||||
// We do not force a session ttl, because we validate this elsewhere in usage.
|
||||
tide::sessions::SessionMiddleware::new(tide::sessions::CookieStore::new(), cookie_key)
|
||||
.with_session_ttl(None)
|
||||
.with_cookie_name("kanidm-session")
|
||||
// Im not sure if we need Lax here, I don't think we do because on the first get
|
||||
// we don't need the cookie since wasm drives the fetches.
|
||||
.with_same_site_policy(tide::http::cookies::SameSite::Strict),
|
||||
);
|
||||
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
#!/bin/sh
|
||||
|
||||
BUILD_FLAGS="--dev" ./build_wasm.sh
|
||||
|
|
|
@ -233,7 +233,7 @@ function addBorrowedObject(obj) {
|
|||
}
|
||||
function __wbg_adapter_48(arg0, arg1, arg2) {
|
||||
try {
|
||||
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2f44da981a3bd620(arg0, arg1, addBorrowedObject(arg2));
|
||||
wasm._dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h871c42aaca1d3703(arg0, arg1, addBorrowedObject(arg2));
|
||||
} finally {
|
||||
heap[stack_pointer++] = undefined;
|
||||
}
|
||||
|
@ -261,11 +261,11 @@ function makeClosure(arg0, arg1, dtor, f) {
|
|||
return real;
|
||||
}
|
||||
function __wbg_adapter_51(arg0, arg1, arg2) {
|
||||
wasm._dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h10a3687bc3b2a4bb(arg0, arg1, addHeapObject(arg2));
|
||||
wasm._dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6073fca8e152ad8e(arg0, arg1, addHeapObject(arg2));
|
||||
}
|
||||
|
||||
function __wbg_adapter_54(arg0, arg1, arg2) {
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h6d8a3152557e4ad6(arg0, arg1, addHeapObject(arg2));
|
||||
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h501c623b6f23b8ff(arg0, arg1, addHeapObject(arg2));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1040,16 +1040,16 @@ function getImports() {
|
|||
const ret = wasm.memory;
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper4818 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 1018, __wbg_adapter_48);
|
||||
imports.wbg.__wbindgen_closure_wrapper4814 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 1014, __wbg_adapter_48);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper5002 = function(arg0, arg1, arg2) {
|
||||
const ret = makeClosure(arg0, arg1, 1042, __wbg_adapter_51);
|
||||
imports.wbg.__wbindgen_closure_wrapper5000 = function(arg0, arg1, arg2) {
|
||||
const ret = makeClosure(arg0, arg1, 1041, __wbg_adapter_51);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper5660 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 1291, __wbg_adapter_54);
|
||||
imports.wbg.__wbindgen_closure_wrapper5658 = function(arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 1290, __wbg_adapter_54);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
|
||||
|
|
Binary file not shown.
|
@ -262,7 +262,9 @@ impl Component for AdminListAccounts {
|
|||
match msg {
|
||||
AdminListAccountsMsg::Responded { response } => {
|
||||
// TODO: do we paginate here?
|
||||
#[cfg(debug)]
|
||||
/*
|
||||
// Seems broken
|
||||
#[cfg(debug_assertions)]
|
||||
for key in response.keys() {
|
||||
#[allow(clippy::unwrap_used)]
|
||||
console::log!(
|
||||
|
@ -270,6 +272,7 @@ impl Component for AdminListAccounts {
|
|||
serde_json::to_string(response.get(key).unwrap()).unwrap()
|
||||
);
|
||||
}
|
||||
*/
|
||||
self.state = ViewState::Responded { response };
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ impl Component for AdminListOAuth2 {
|
|||
match msg {
|
||||
AdminListOAuth2Msg::Responded { response } => {
|
||||
// TODO: do we paginate here?
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
for key in response.keys() {
|
||||
console::log!(
|
||||
"response: {:?}",
|
||||
|
@ -377,13 +377,16 @@ impl Component for AdminViewOAuth2 {
|
|||
match msg {
|
||||
AdminViewOAuth2Msg::Responded { response } => {
|
||||
// TODO: do we paginate here?
|
||||
#[cfg(debug)]
|
||||
/*
|
||||
// Seems broken
|
||||
#[cfg(debug_assertions)]
|
||||
for key in response.keys() {
|
||||
console::log!(
|
||||
"response: {:?}",
|
||||
serde_json::to_string(response.get(key).unwrap()).unwrap()
|
||||
);
|
||||
}
|
||||
*/
|
||||
self.state = ViewState::Responded { response };
|
||||
}
|
||||
AdminViewOAuth2Msg::Failed { emsg, kopid } => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
use gloo::console;
|
||||
use kanidm_proto::v1::{CURequest, CUSessionToken, CUStatus};
|
||||
use wasm_bindgen::{JsCast, JsValue, UnwrapThrowExt};
|
||||
|
@ -89,20 +89,20 @@ impl Component for DeleteApp {
|
|||
type Properties = ModalProps;
|
||||
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("delete modal create");
|
||||
|
||||
DeleteApp { state: State::Init }
|
||||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("delete modal::change");
|
||||
false
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("delete modal::update");
|
||||
let token_c = ctx.props().token.clone();
|
||||
match msg {
|
||||
|
@ -132,17 +132,17 @@ impl Component for DeleteApp {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("delete modal::rendered");
|
||||
}
|
||||
|
||||
fn destroy(&mut self, _ctx: &Context<Self>) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("delete modal::destroy");
|
||||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("delete modal::view");
|
||||
|
||||
let submit_enabled = matches!(&self.state, State::Init);
|
||||
|
|
|
@ -308,7 +308,7 @@ impl Component for PasskeyModalApp {
|
|||
<>
|
||||
<form class="row needs-validation" novalidate=true
|
||||
onsubmit={ ctx.link().callback(move |e: FocusEvent| {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("passkey modal::on form submit prevent default");
|
||||
e.prevent_default();
|
||||
if submit_enabled {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
use gloo::console;
|
||||
use kanidm_proto::v1::{CURegState, CURequest, CUSessionToken, CUStatus};
|
||||
use uuid::Uuid;
|
||||
|
@ -124,7 +124,7 @@ impl Component for PasskeyRemoveModalApp {
|
|||
type Properties = PasskeyRemoveModalProps;
|
||||
|
||||
fn create(ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("passkey remove modal create");
|
||||
|
||||
let tag = ctx.props().tag.clone();
|
||||
|
@ -140,13 +140,13 @@ impl Component for PasskeyRemoveModalApp {
|
|||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("passkey remove modal::change");
|
||||
false
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("passkey remove modal::update");
|
||||
match msg {
|
||||
Msg::Submit => {
|
||||
|
@ -179,17 +179,17 @@ impl Component for PasskeyRemoveModalApp {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("passkey remove modal::rendered");
|
||||
}
|
||||
|
||||
fn destroy(&mut self, _ctx: &Context<Self>) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("passkey remove modal::destroy");
|
||||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("passkey remove modal::view");
|
||||
|
||||
let remove_tgt = self.target.clone();
|
||||
|
|
|
@ -114,7 +114,7 @@ impl Component for PwModalApp {
|
|||
type Properties = ModalProps;
|
||||
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("pw modal create");
|
||||
|
||||
PwModalApp {
|
||||
|
@ -126,13 +126,13 @@ impl Component for PwModalApp {
|
|||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("pw modal::change");
|
||||
false
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("pw modal::update");
|
||||
match msg {
|
||||
Msg::PasswordCheck => {
|
||||
|
@ -184,17 +184,17 @@ impl Component for PwModalApp {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("pw modal::rendered");
|
||||
}
|
||||
|
||||
fn destroy(&mut self, _ctx: &Context<Self>) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("pw modal::destroy");
|
||||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("pw modal::view");
|
||||
|
||||
let (pw_class, pw_feedback) = match &self.state {
|
||||
|
|
|
@ -90,7 +90,7 @@ impl Component for CredentialResetApp {
|
|||
type Properties = ();
|
||||
|
||||
fn create(ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("credential::reset::create");
|
||||
|
||||
// On a page refresh/reload, should we restart a session that *may* have existed?
|
||||
|
@ -150,13 +150,13 @@ impl Component for CredentialResetApp {
|
|||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("credential::reset::change");
|
||||
false
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("credential::reset::update");
|
||||
let next_state = match (msg, &self.state) {
|
||||
(Msg::Ignore, _) => None,
|
||||
|
@ -175,12 +175,12 @@ impl Component for CredentialResetApp {
|
|||
Some(State::WaitingForStatus)
|
||||
}
|
||||
(Msg::BeginSession { token, status }, State::WaitingForStatus) => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("begin session {:?}", status).as_str());
|
||||
Some(State::Main { token, status })
|
||||
}
|
||||
(Msg::UpdateSession { status }, State::Main { token, status: _ }) => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("{:?}", status).as_str());
|
||||
Some(State::Main {
|
||||
token: token.clone(),
|
||||
|
@ -201,7 +201,7 @@ impl Component for CredentialResetApp {
|
|||
Some(State::WaitingForCommit)
|
||||
}
|
||||
(Msg::Cancel, State::Main { token, status: _ }) => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("msg::cancel");
|
||||
let token_c = token.clone();
|
||||
|
||||
|
@ -216,7 +216,7 @@ impl Component for CredentialResetApp {
|
|||
}
|
||||
(Msg::Success, State::WaitingForCommit) => {
|
||||
let loc = models::pop_return_location();
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("Going to -> {:?}", loc));
|
||||
loc.goto(&ctx.link().history().expect_throw("failed to read history"));
|
||||
|
||||
|
@ -238,14 +238,14 @@ impl Component for CredentialResetApp {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("credential::reset::rendered");
|
||||
// because sometimes bootstrap doesn't catch it, which is annoying.
|
||||
crate::utils::autofocus("token");
|
||||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("credential::reset::view");
|
||||
match &self.state {
|
||||
State::TokenInput => self.view_token_input(ctx),
|
||||
|
@ -256,7 +256,7 @@ impl Component for CredentialResetApp {
|
|||
}
|
||||
|
||||
fn destroy(&mut self, _ctx: &Context<Self>) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("credential::reset::destroy");
|
||||
remove_body_form_classes!();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
use gloo::console;
|
||||
use kanidm_proto::v1::{CURegState, CURequest, CUSessionToken, CUStatus, TotpSecret};
|
||||
use qrcode::render::svg;
|
||||
|
@ -124,7 +124,7 @@ impl Component for TotpModalApp {
|
|||
type Properties = ModalProps;
|
||||
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("totp modal create");
|
||||
|
||||
TotpModalApp {
|
||||
|
@ -135,13 +135,13 @@ impl Component for TotpModalApp {
|
|||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("totp modal::change");
|
||||
false
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("totp modal::update");
|
||||
let token_c = ctx.props().token.clone();
|
||||
match msg {
|
||||
|
@ -237,17 +237,17 @@ impl Component for TotpModalApp {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("totp modal::rendered");
|
||||
}
|
||||
|
||||
fn destroy(&mut self, _ctx: &Context<Self>) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("totp modal::destroy");
|
||||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("totp modal::view");
|
||||
|
||||
let totp_class = match &self.check {
|
||||
|
|
|
@ -253,7 +253,7 @@ impl LoginApp {
|
|||
<label for="username" class="form-label">{ "Username" }</label>
|
||||
<form
|
||||
onsubmit={ ctx.link().callback(|e: FocusEvent| {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("login::view_state -> Init - prevent_default()".to_string());
|
||||
e.prevent_default();
|
||||
LoginAppMsg::Begin
|
||||
|
@ -507,7 +507,7 @@ impl LoginApp {
|
|||
LoginState::Authenticated => {
|
||||
let loc = models::pop_return_location();
|
||||
// redirect
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("authenticated, try going to -> {:?}", loc));
|
||||
loc.goto(&ctx.link().history().expect_throw("failed to read history"));
|
||||
html! {
|
||||
|
@ -547,7 +547,7 @@ impl Component for LoginApp {
|
|||
type Properties = ();
|
||||
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("create".to_string());
|
||||
// Assume we are here for a good reason.
|
||||
// -- clear the bearer to prevent conflict
|
||||
|
@ -555,7 +555,7 @@ impl Component for LoginApp {
|
|||
// Do we have a login hint?
|
||||
let inputvalue = models::pop_login_hint().unwrap_or_else(|| "".to_string());
|
||||
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
let document = utils::document();
|
||||
let html_document = document
|
||||
|
@ -599,7 +599,7 @@ impl Component for LoginApp {
|
|||
true
|
||||
}
|
||||
LoginAppMsg::Begin => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("begin -> {:?}", self.inputvalue));
|
||||
// Disable the button?
|
||||
let username = self.inputvalue.clone();
|
||||
|
@ -613,7 +613,7 @@ impl Component for LoginApp {
|
|||
true
|
||||
}
|
||||
LoginAppMsg::PasswordSubmit => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("At password step".to_string());
|
||||
// Disable the button?
|
||||
self.state = LoginState::Password(false);
|
||||
|
@ -632,7 +632,7 @@ impl Component for LoginApp {
|
|||
true
|
||||
}
|
||||
LoginAppMsg::BackupCodeSubmit => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("backupcode".to_string());
|
||||
// Disable the button?
|
||||
self.state = LoginState::BackupCode(false);
|
||||
|
@ -651,7 +651,7 @@ impl Component for LoginApp {
|
|||
true
|
||||
}
|
||||
LoginAppMsg::TotpSubmit => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("totp".to_string());
|
||||
// Disable the button?
|
||||
match self.inputvalue.parse::<u32>() {
|
||||
|
@ -679,7 +679,7 @@ impl Component for LoginApp {
|
|||
true
|
||||
}
|
||||
LoginAppMsg::SecurityKeySubmit(resp) => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("At securitykey step".to_string());
|
||||
let authreq = AuthRequest {
|
||||
step: AuthStep::Cred(AuthCredential::SecurityKey(resp)),
|
||||
|
@ -695,7 +695,7 @@ impl Component for LoginApp {
|
|||
false
|
||||
}
|
||||
LoginAppMsg::PasskeySubmit(resp) => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("At passkey step".to_string());
|
||||
let authreq = AuthRequest {
|
||||
step: AuthStep::Cred(AuthCredential::Passkey(resp)),
|
||||
|
@ -713,7 +713,7 @@ impl Component for LoginApp {
|
|||
LoginAppMsg::Start(session_id, resp) => {
|
||||
// Clear any leftover input
|
||||
self.inputvalue = "".to_string();
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("start -> {:?} : {:?}", resp, session_id));
|
||||
match resp.state {
|
||||
AuthState::Choose(mut mechs) => {
|
||||
|
@ -734,14 +734,14 @@ impl Component for LoginApp {
|
|||
// We do NOT need to change state or redraw
|
||||
false
|
||||
} else {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("multiple mechs exist".to_string());
|
||||
self.state = LoginState::Select(mechs);
|
||||
true
|
||||
}
|
||||
}
|
||||
AuthState::Denied(reason) => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("denied -> {:?}", reason));
|
||||
self.state = LoginState::Denied(reason);
|
||||
true
|
||||
|
@ -757,7 +757,7 @@ impl Component for LoginApp {
|
|||
}
|
||||
}
|
||||
LoginAppMsg::Select(idx) => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("chose -> {:?}", idx));
|
||||
match &self.state {
|
||||
LoginState::Select(allowed) => match allowed.get(idx) {
|
||||
|
@ -794,7 +794,7 @@ impl Component for LoginApp {
|
|||
LoginAppMsg::Next(resp) => {
|
||||
// Clear any leftover input
|
||||
self.inputvalue = "".to_string();
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("next -> {:?}", resp));
|
||||
|
||||
// Based on the state we have, we need to chose our steps.
|
||||
|
@ -833,7 +833,7 @@ impl Component for LoginApp {
|
|||
}
|
||||
} else {
|
||||
// Else, present the options in a choice.
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("multiple choices exist".to_string());
|
||||
self.state = LoginState::Continue(allowed);
|
||||
}
|
||||
|
@ -865,7 +865,7 @@ impl Component for LoginApp {
|
|||
}
|
||||
LoginAppMsg::Continue(idx) => {
|
||||
// Are we in the correct internal state?
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("chose -> {:?}", idx));
|
||||
match &self.state {
|
||||
LoginState::Continue(allowed) => {
|
||||
|
@ -926,7 +926,7 @@ impl Component for LoginApp {
|
|||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("login::view".to_string());
|
||||
// How do we add a top level theme?
|
||||
/*
|
||||
|
@ -965,13 +965,13 @@ impl Component for LoginApp {
|
|||
}
|
||||
|
||||
fn destroy(&mut self, _ctx: &Context<Self>) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("login::destroy".to_string());
|
||||
remove_body_form_classes!();
|
||||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("login::rendered".to_string());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ fn landing() -> Html {
|
|||
}
|
||||
|
||||
fn switch(route: &Route) -> Html {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("manager::switch");
|
||||
match route {
|
||||
#[allow(clippy::let_unit_value)]
|
||||
|
@ -92,25 +92,25 @@ impl Component for ManagerApp {
|
|||
type Properties = ();
|
||||
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("manager::create");
|
||||
ManagerApp {}
|
||||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("manager::change");
|
||||
false
|
||||
}
|
||||
|
||||
fn update(&mut self, _ctx: &Context<Self>, _msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("manager::update");
|
||||
true
|
||||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("manager::rendered");
|
||||
// Can only access the current_route AFTER it renders.
|
||||
// console::debug!(format!("{:?}", yew_router::current_route::<Route>()).as_str())
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
use gloo::console;
|
||||
use gloo::storage::{
|
||||
LocalStorage as PersistentStorage, SessionStorage as TemporaryStorage, Storage,
|
||||
|
@ -38,7 +38,7 @@ pub fn push_return_location(l: Location) {
|
|||
|
||||
pub fn pop_return_location() -> Location {
|
||||
let l: Result<Location, _> = TemporaryStorage::get("return_location");
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("return_location -> {:?}", l).as_str());
|
||||
TemporaryStorage::delete("return_location");
|
||||
l.unwrap_or(Location::Manager(Route::Landing))
|
||||
|
@ -51,7 +51,7 @@ pub fn push_oauth2_authorisation_request(r: AuthorisationRequest) {
|
|||
|
||||
pub fn pop_oauth2_authorisation_request() -> Option<AuthorisationRequest> {
|
||||
let l: Result<AuthorisationRequest, _> = TemporaryStorage::get("oauth2_authorisation_request");
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("oauth2_authorisation_request -> {:?}", l).as_str());
|
||||
TemporaryStorage::delete("oauth2_authorisation_request");
|
||||
l.ok()
|
||||
|
@ -63,7 +63,7 @@ pub fn push_login_hint(r: String) {
|
|||
|
||||
pub fn pop_login_hint() -> Option<String> {
|
||||
let l: Result<String, _> = TemporaryStorage::get("login_hint");
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("login_hint::pop_login_hint -> {:?}", l).as_str());
|
||||
TemporaryStorage::delete("login_hint");
|
||||
l.ok()
|
||||
|
|
|
@ -211,7 +211,7 @@ impl Component for Oauth2App {
|
|||
type Properties = ();
|
||||
|
||||
fn create(ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("oauth2::create");
|
||||
|
||||
// Do we have a query here?
|
||||
|
@ -271,13 +271,13 @@ impl Component for Oauth2App {
|
|||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("oauth2::change");
|
||||
false
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("oauth2::update");
|
||||
|
||||
match msg {
|
||||
|
@ -372,7 +372,7 @@ impl Component for Oauth2App {
|
|||
true
|
||||
}
|
||||
Oauth2Msg::Redirect(loc) => {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!(format!("Redirecting to {}", loc).as_str());
|
||||
// Send the location here, and then update will trigger the redir via
|
||||
// https://docs.rs/web-sys/0.3.51/web_sys/struct.Location.html#method.replace
|
||||
|
@ -395,12 +395,12 @@ impl Component for Oauth2App {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("oauth2::rendered");
|
||||
}
|
||||
|
||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("oauth2::view");
|
||||
|
||||
let body_content = match &self.state {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
use gloo::console;
|
||||
use yew::prelude::*;
|
||||
|
||||
|
@ -41,7 +41,7 @@ impl Component for AppsApp {
|
|||
type Properties = ();
|
||||
|
||||
fn create(ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::apps::create");
|
||||
|
||||
ctx.link().send_future(async {
|
||||
|
@ -57,13 +57,13 @@ impl Component for AppsApp {
|
|||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::apps::changed");
|
||||
false
|
||||
}
|
||||
|
||||
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::apps::update");
|
||||
match msg {
|
||||
Msg::Ready { apps } => self.state = State::Ready { apps },
|
||||
|
@ -74,7 +74,7 @@ impl Component for AppsApp {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::apps::rendered");
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ impl Component for ViewsApp {
|
|||
type Properties = ();
|
||||
|
||||
fn create(ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::create");
|
||||
|
||||
// Ensure the token is valid before we proceed. Could be
|
||||
|
@ -126,13 +126,13 @@ impl Component for ViewsApp {
|
|||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::changed");
|
||||
false
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::update");
|
||||
match msg {
|
||||
ViewsMsg::Verified => {
|
||||
|
@ -171,7 +171,7 @@ impl Component for ViewsApp {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::rendered");
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,11 @@ impl ViewsApp {
|
|||
.expect_throw("failed to set header");
|
||||
|
||||
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
|
||||
.map_err(|e| {
|
||||
console::error!(&format!("fetch request failed {:?}", e));
|
||||
e
|
||||
})?;
|
||||
let resp: Response = resp_value.dyn_into().expect_throw("Invalid response type");
|
||||
let status = resp.status();
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ impl Component for ProfileApp {
|
|||
type Properties = ViewProps;
|
||||
|
||||
fn create(ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::profile::create");
|
||||
|
||||
ctx.link().send_future(async {
|
||||
|
@ -117,7 +117,7 @@ impl Component for ProfileApp {
|
|||
}
|
||||
|
||||
fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("profile::update");
|
||||
match msg {
|
||||
Msg::Profile { entry } => {
|
||||
|
@ -135,7 +135,7 @@ impl Component for ProfileApp {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::profile::rendered");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
use gloo::console;
|
||||
use kanidm_proto::v1::{CUSessionToken, CUStatus, UiHint};
|
||||
use wasm_bindgen::{JsCast, UnwrapThrowExt};
|
||||
|
@ -53,19 +53,19 @@ impl Component for SecurityApp {
|
|||
type Properties = ViewProps;
|
||||
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::security::create");
|
||||
SecurityApp { state: State::Init }
|
||||
}
|
||||
|
||||
fn changed(&mut self, _ctx: &Context<Self>) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::security::changed");
|
||||
true
|
||||
}
|
||||
|
||||
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::security::update");
|
||||
match msg {
|
||||
Msg::RequestCredentialUpdate => {
|
||||
|
@ -106,7 +106,7 @@ impl Component for SecurityApp {
|
|||
}
|
||||
|
||||
fn rendered(&mut self, _ctx: &Context<Self>, _first_render: bool) {
|
||||
#[cfg(debug)]
|
||||
#[cfg(debug_assertions)]
|
||||
console::debug!("views::security::rendered");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue