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.
|
// Set legacy values.
|
||||||
if leg := FindLegacyUser(Admin); leg != nil {
|
if leg := FindLegacyUser(Admin); leg != nil {
|
||||||
Admin.UserUID = leg.UserUID
|
Admin.UserUID = leg.UserUID
|
||||||
|
if leg.UserName != "" {
|
||||||
Admin.UserName = leg.UserName
|
Admin.UserName = leg.UserName
|
||||||
|
}
|
||||||
|
if leg.PrimaryEmail != "" {
|
||||||
Admin.UserEmail = leg.PrimaryEmail
|
Admin.UserEmail = leg.PrimaryEmail
|
||||||
|
}
|
||||||
|
if leg.FullName != "" {
|
||||||
Admin.DisplayName = leg.FullName
|
Admin.DisplayName = leg.FullName
|
||||||
|
}
|
||||||
|
if leg.LoginAt != nil {
|
||||||
Admin.LoginAt = leg.LoginAt
|
Admin.LoginAt = leg.LoginAt
|
||||||
|
}
|
||||||
log.Infof("users: migrating %s account", Admin.UserName)
|
log.Infof("users: migrating %s account", Admin.UserName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue