mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 19:27:36 +00:00
LibCore: Use StringView
instead of char *
in Account
This commit is contained in:
parent
0396b6da82
commit
507cb411c2
10 changed files with 33 additions and 36 deletions
|
@ -80,7 +80,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto fail_message = "Can't log in: invalid username or password."sv;
|
||||
|
||||
auto account = Core::Account::from_name(username.characters());
|
||||
auto account = Core::Account::from_name(username);
|
||||
if (account.is_error()) {
|
||||
window->set_fail_message(fail_message);
|
||||
dbgln("failed graphical login for user {}: {}", username, account.error());
|
||||
|
@ -99,13 +99,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
login(account.value(), *window);
|
||||
};
|
||||
|
||||
char const* auto_login = nullptr;
|
||||
StringView auto_login;
|
||||
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(auto_login, "automatically log in with no prompt", "auto-login", 'a', "username");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
if (!auto_login) {
|
||||
if (auto_login.is_empty()) {
|
||||
window->show();
|
||||
} else {
|
||||
auto account = Core::Account::from_name(auto_login);
|
||||
|
|
|
@ -299,7 +299,7 @@ Service::Service(Core::ConfigFile const& config, StringView name)
|
|||
|
||||
m_user = config.read_entry(name, "User");
|
||||
if (!m_user.is_null()) {
|
||||
auto result = Core::Account::from_name(m_user.characters(), Core::Account::Read::PasswdOnly);
|
||||
auto result = Core::Account::from_name(m_user, Core::Account::Read::PasswdOnly);
|
||||
if (result.is_error())
|
||||
warnln("Failed to resolve user {}: {}", m_user, result.error());
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue