mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 23:48:12 +00:00
make signidentity dialog nicer
This commit is contained in:
parent
1272046375
commit
d1c62659f7
@ -19,6 +19,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "layout2.h"
|
||||
#include "storage.h"
|
||||
@ -264,11 +265,41 @@ void layoutAddress(const char *address, const char *desc)
|
||||
|
||||
void layoutSignIdentity(const IdentityType *identity, const char *challenge)
|
||||
{
|
||||
char row_proto[8 + 8 + 1];
|
||||
char row_hostport[64 + 6 + 1];
|
||||
char row_user[64 + 8 + 1];
|
||||
|
||||
if (identity->has_proto && identity->proto[0]) {
|
||||
strlcpy(row_proto, identity->proto, sizeof(row_proto));
|
||||
char *p = row_proto;
|
||||
while (*p) { *p = toupper((int)*p); p++; }
|
||||
strlcat(row_proto, " login:", sizeof(row_proto));
|
||||
} else {
|
||||
strlcpy(row_proto, "Login:", sizeof(row_proto));
|
||||
}
|
||||
|
||||
if (identity->has_host && identity->host[0]) {
|
||||
strlcpy(row_hostport, identity->host, sizeof(row_hostport));
|
||||
if (identity->has_port && identity->port[0]) {
|
||||
strlcat(row_hostport, ":", sizeof(row_hostport));
|
||||
strlcat(row_hostport, identity->user, sizeof(row_hostport));
|
||||
}
|
||||
} else {
|
||||
row_hostport[0] = 0;
|
||||
}
|
||||
|
||||
if (identity->has_user && identity->user[0]) {
|
||||
strlcpy(row_user, "user: ", sizeof(row_user));
|
||||
strlcat(row_user, identity->user, sizeof(row_user));
|
||||
} else {
|
||||
row_user[0] = 0;
|
||||
}
|
||||
|
||||
layoutDialogSwipe(DIALOG_ICON_QUESTION, "Cancel", "Confirm",
|
||||
"Sign in using this identity?",
|
||||
identity->has_proto ? identity->proto : NULL,
|
||||
identity->has_user ? identity->user : NULL,
|
||||
identity->has_host ? identity->host : NULL,
|
||||
row_proto[0] ? row_proto : NULL,
|
||||
row_hostport[0] ? row_hostport : NULL,
|
||||
row_user[0] ? row_user : NULL,
|
||||
challenge,
|
||||
NULL,
|
||||
NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user