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
@@ -568,7 +568,7 @@ montauk::config::save("desktop", &doc);
|
||||
|
||||
Header: `montauk/user.h`
|
||||
|
||||
User authentication and session management with SHA-256 password hashing.
|
||||
User authentication and current-user helpers with SHA-256 password hashing.
|
||||
|
||||
```cpp
|
||||
bool user::authenticate(const char* username, const char* password);
|
||||
@@ -577,8 +577,6 @@ bool user::create_user(const char* username, const char* display_name,
|
||||
bool user::delete_user(const char* username);
|
||||
bool user::change_password(const char* username, const char* new_password);
|
||||
|
||||
void user::set_session(const char* username); // Log in
|
||||
void user::clear_session(); // Log out
|
||||
bool user::get_session_username(char* buf, int sz); // Get current process user
|
||||
bool user::get_home_dir(char* buf, int sz); // Get current process home directory
|
||||
```
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user