From 1beada71234ff83d92e6e620edbfab4dcb760df5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 26 Nov 2019 11:41:15 -0500 Subject: store more information about the login state we need to know both who we are (so that the webface can display it) and also how to log back in as that user (since oauth methods log back in without specifying the username at all) --- teleterm/src/web.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'teleterm/src/web.rs') diff --git a/teleterm/src/web.rs b/teleterm/src/web.rs index cfd33c5..48c8c3c 100644 --- a/teleterm/src/web.rs +++ b/teleterm/src/web.rs @@ -34,9 +34,15 @@ impl Config { } } +#[derive(Debug, serde::Deserialize, serde::Serialize)] +pub(crate) struct LoginState { + auth: crate::protocol::Auth, + username: String, +} + #[derive(Default, serde::Deserialize, serde::Serialize)] struct SessionData { - username: Option, + login: Option, } #[derive(Debug, serde::Serialize)] @@ -62,9 +68,9 @@ impl<'a> WebConfig<'a> { } Ok(Self { username: session - .username + .login .as_ref() - .map(std::string::String::as_str), + .map(|login| login.username.as_str()), public_address: &config.public_address, allowed_login_methods: &config.allowed_login_methods, oauth_login_urls, -- cgit v1.2.3-54-g00ecf