diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-26 11:41:15 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-26 11:45:05 -0500 |
commit | 1beada71234ff83d92e6e620edbfab4dcb760df5 (patch) | |
tree | 65f6955757fe9ab2f2a77edd9f5e89f021eb57f7 /teleterm/src/web.rs | |
parent | 46fbf870d65e747787b70cbbd83f21766fed5231 (diff) | |
download | teleterm-1beada71234ff83d92e6e620edbfab4dcb760df5.tar.gz teleterm-1beada71234ff83d92e6e620edbfab4dcb760df5.zip |
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)
Diffstat (limited to 'teleterm/src/web.rs')
-rw-r--r-- | teleterm/src/web.rs | 12 |
1 files changed, 9 insertions, 3 deletions
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<String>, + login: Option<LoginState>, } #[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, |