]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ask-password: prefix password questions with lock and key emoji
authorLennart Poettering <lennart@poettering.net>
Wed, 15 Apr 2020 09:59:30 +0000 (11:59 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 15 Apr 2020 10:04:23 +0000 (12:04 +0200)
It's pretty, and it highlights that the pw prompt is kinda special and
needs user input.

We suppress the emoji entirel if there's no emoji support (i.e. this
means we suppress the ASCII replacement), since it carries no additional
information, it is just decoration to highlight a line.

src/shared/ask-password-api.c

index b64663bd1e03e22329bced834196fab4edc2fb27..3a76ea4f67036108d5d12ce833a43470ef81687c 100644 (file)
@@ -27,6 +27,7 @@
 #include "format-util.h"
 #include "fs-util.h"
 #include "io-util.h"
+#include "locale-util.h"
 #include "log.h"
 #include "macro.h"
 #include "memory-util.h"
@@ -430,6 +431,9 @@ int ask_password_tty(
         if (!message)
                 message = "Password:";
 
+        if (emoji_enabled())
+                message = strjoina(special_glyph(SPECIAL_GLYPH_LOCK_AND_KEY), " ", message);
+
         if (flag_file || ((flags & ASK_PASSWORD_ACCEPT_CACHED) && keyname)) {
                 notify = inotify_init1(IN_CLOEXEC|IN_NONBLOCK);
                 if (notify < 0)