First name from username

This commit is contained in:
M66B 2021-08-27 20:40:24 +02:00
parent 75afa1974f
commit d8987f0125
1 changed files with 13 additions and 0 deletions

View File

@ -118,6 +118,19 @@ public class EntityAnswer implements Serializable {
}
}
if (first == null) {
String username = UriHelper.getEmailUser(email);
if (username != null) {
int dot = username.indexOf('.');
if (dot < 0)
first = username;
else
first = username.substring(0, dot);
if (first.length() > 0)
first = first.substring(0, 1).toUpperCase() + first.substring(1).toLowerCase();
}
}
text = text.replace("$name$", fullName == null ? "" : Html.escapeHtml(fullName));
text = text.replace("$firstname$", first == null ? "" : Html.escapeHtml(first));
text = text.replace("$lastname$", last == null ? "" : Html.escapeHtml(last));