mirror of
https://github.com/simple-login/app.git
synced 2024-11-10 17:35:27 +08:00
handle name can be None in get_name_initial()
This commit is contained in:
parent
f4218a0693
commit
4bfe6d1ac9
1 changed files with 2 additions and 0 deletions
|
@ -524,6 +524,8 @@ class User(db.Model, ModelMixin, UserMixin):
|
|||
return self.name, [other_name, "Anonymous", "whoami"]
|
||||
|
||||
def get_name_initial(self) -> str:
|
||||
if not self.name:
|
||||
return ""
|
||||
names = self.name.split(" ")
|
||||
return "".join([n[0].upper() for n in names if n])
|
||||
|
||||
|
|
Loading…
Reference in a new issue