feat: remove remaining use of session.toml
This commit is contained in:
1 parent
e87bd358a6
commit
14c7099e3b
7 files changed
+5
-42
No files matched your search
@@ -328,22 +328,7 @@ namespace user {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---- Session state and current user helpers ----
|
||||
|
||||
// Persist login session state after successful login.
|
||||
// Current processes should use getuser() for their active username.
|
||||
inline void set_session(const char* username) {
|
||||
montauk::toml::Doc doc;
|
||||
doc.init();
|
||||
config::set_string(&doc, "session.username", username);
|
||||
config::save("session", &doc);
|
||||
doc.destroy();
|
||||
}
|
||||
|
||||
// Clear the session (on logout).
|
||||
inline void clear_session() {
|
||||
montauk::fdelete("0:/config/session.toml");
|
||||
}
|
||||
// ---- Current user helpers ----
|
||||
|
||||
// Read the current process username into buf. Returns true if one is set.
|
||||
inline bool get_session_username(char* buf, int bufSz) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* a raw PSK). Anyone who can read 0:/config can read the keys.
|
||||
*
|
||||
* No default copy of this file ships in the image, deliberately. Every other
|
||||
* config an app writes (bluetooth.toml, display.toml, session.toml) is
|
||||
* config an app writes (bluetooth.toml, display.toml) is
|
||||
* created on demand for the same reason: a shipped copy is laid down again
|
||||
* by anything that refreshes the system files, and it would overwrite the
|
||||
* networks the user had saved.
|
||||
|
||||
@@ -25,7 +25,6 @@ void transition_to_login_mode(LoginState* ls) {
|
||||
}
|
||||
|
||||
void finish_desktop_session(LoginState* ls) {
|
||||
montauk::user::clear_session();
|
||||
montauk::memset(ls->password, 0, sizeof(ls->password));
|
||||
ls->password_len = 0;
|
||||
gui::mtk::text_input_reset(ls->password_input);
|
||||
@@ -196,7 +195,6 @@ bool try_login(LoginState* ls) {
|
||||
return false;
|
||||
}
|
||||
|
||||
montauk::user::set_session(ls->username);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ static void maybe_run_setup_session() {
|
||||
|
||||
montauk::fmkdir("0:/users");
|
||||
montauk::user::create_user(user, display, "", role);
|
||||
montauk::user::set_session(user);
|
||||
doc.destroy();
|
||||
|
||||
montauk::abi::SpawnCapabilities caps{};
|
||||
@@ -41,8 +40,6 @@ static void maybe_run_setup_session() {
|
||||
montauk::waitpid(pid);
|
||||
terminate_desktop_session(pid);
|
||||
}
|
||||
|
||||
montauk::user::clear_session();
|
||||
}
|
||||
|
||||
static void initialize_login_mode(LoginState* ls) {
|
||||
|
||||
Reference in new issue
Block a user