Short-circuit authentication if no command was configured (#140).

This commit is contained in:
Antoine POPINEAU 2024-05-17 12:33:49 +02:00
parent 4ac12261cc
commit e203bee7ec
No known key found for this signature in database
GPG Key ID: E8379674E92D25D2
3 changed files with 34 additions and 18 deletions

View File

@ -21,6 +21,7 @@ new_command = New command:
shutdown = Shut down
reboot = Reboot
command_missing = No command configured
command_exited = Command exited with
command_failed = Command failed

View File

@ -21,6 +21,7 @@ command = Nouvelle commande :
shutdown = Éteindre
reboot = Redémarrer
command_missing = Aucune commande configurée
command_exited = La commande a retourné
command_failed = Échec de la commande

View File

@ -148,9 +148,22 @@ impl Ipc {
} else {
tracing::info!("authentication successful, starting session");
let command = greeter.session_source.command(greeter).map(str::to_string);
match greeter.session_source.command(greeter).map(str::to_string) {
None => {
Ipc::cancel(greeter).await;
if let Some(command) = command {
greeter.message = Some(fl!("command_missing"));
greeter.reset(false).await;
}
Some(command) if command.is_empty() => {
Ipc::cancel(greeter).await;
greeter.message = Some(fl!("command_missing"));
greeter.reset(false).await;
}
Some(command) => {
greeter.done = true;
greeter.mode = Mode::Processing;
@ -175,6 +188,7 @@ impl Ipc {
}
}
}
}
Response::Error { error_type, description } => {
tracing::info!("received an error from greetd: {error_type:?} - {description}");