mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:07:44 +00:00
LoginServer: Add --auto-login switch
Auto login will automatically log in a user without prompting for a password, but will still allow logouts and subsequent password logins.
This commit is contained in:
parent
c19d868a3e
commit
b77dad5ba3
2 changed files with 21 additions and 7 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/Account.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <Services/LoginServer/LoginWindow.h>
|
||||
#include <errno.h>
|
||||
|
@ -113,7 +114,23 @@ int main(int argc, char** argv)
|
|||
login(account.value(), *window);
|
||||
};
|
||||
|
||||
window->show();
|
||||
char const* auto_login = nullptr;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(auto_login, "automatically log in with no prompt", "auto-login", 'a', "userame");
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
if (!auto_login) {
|
||||
window->show();
|
||||
} else {
|
||||
auto account = Core::Account::from_name(auto_login);
|
||||
if (account.is_error()) {
|
||||
dbgln("failed auto-login for user {}: {}", auto_login, account.error());
|
||||
return 1;
|
||||
}
|
||||
|
||||
login(account.value(), *window);
|
||||
}
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue