1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 17:17:45 +00:00

LibCore: Use StringView instead of char * in Account

This commit is contained in:
Lucas CHOLLET 2022-06-10 20:06:06 +02:00 committed by Sam Atkins
parent 0396b6da82
commit 507cb411c2
10 changed files with 33 additions and 36 deletions

View file

@ -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);

View file

@ -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