Auth: Only migrate non-empty legacy user fields #98
Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
parent
ef9b76a54a
commit
36298b39d7
1 changed files with 12 additions and 4 deletions
|
@ -66,10 +66,18 @@ func CreateDefaultUsers() {
|
|||
// Set legacy values.
|
||||
if leg := FindLegacyUser(Admin); leg != nil {
|
||||
Admin.UserUID = leg.UserUID
|
||||
Admin.UserName = leg.UserName
|
||||
Admin.UserEmail = leg.PrimaryEmail
|
||||
Admin.DisplayName = leg.FullName
|
||||
Admin.LoginAt = leg.LoginAt
|
||||
if leg.UserName != "" {
|
||||
Admin.UserName = leg.UserName
|
||||
}
|
||||
if leg.PrimaryEmail != "" {
|
||||
Admin.UserEmail = leg.PrimaryEmail
|
||||
}
|
||||
if leg.FullName != "" {
|
||||
Admin.DisplayName = leg.FullName
|
||||
}
|
||||
if leg.LoginAt != nil {
|
||||
Admin.LoginAt = leg.LoginAt
|
||||
}
|
||||
log.Infof("users: migrating %s account", Admin.UserName)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue