Fix issue with localauth conversion

This commit is contained in:
Arnaud Delcasse 2023-11-27 09:00:40 +01:00
parent 045bcb7bf6
commit 3a80acae37
1 changed files with 18 additions and 12 deletions

View File

@ -38,19 +38,25 @@ func (a Account) ToStorageType() storage.Account {
}
func (lc LocalAuth) ToStorageType() storage.LocalAuth {
emailValidation := storage.Validation{}
if lc.EmailValidation != nil {
emailValidation.Validated = lc.EmailValidation.Validated
emailValidation.ValidationCode = lc.EmailValidation.ValidationCode
}
phoneValidation := storage.Validation{}
if lc.PhoneNumberValidation != nil {
phoneValidation.Validated = lc.PhoneNumberValidation.Validated
phoneValidation.ValidationCode = lc.PhoneNumberValidation.ValidationCode
}
return storage.LocalAuth{
Username: lc.Username,
Password: lc.Password,
Email: lc.Email,
EmailValidation: storage.Validation{
Validated: lc.EmailValidation.Validated,
ValidationCode: lc.EmailValidation.ValidationCode,
},
EmailValidation: emailValidation,
PhoneNumber: lc.PhoneNumber,
PhoneNumberValidation: storage.Validation{
Validated: lc.PhoneNumberValidation.Validated,
ValidationCode: lc.PhoneNumberValidation.ValidationCode,
},
PhoneNumberValidation: phoneValidation,
}
}