Make image path optional

This commit is contained in:
Andrea Maria Piana 2023-03-20 17:38:56 +00:00
parent ba2aa3f83e
commit 6775e79920
3 changed files with 10 additions and 13 deletions

View File

@ -1 +1 @@
0.138.8 0.138.9

View File

@ -795,14 +795,16 @@ func (b *GethStatusBackend) CreateAccountAndLogin(request *requests.CreateAccoun
return err return err
} }
iis, err := images.GenerateIdentityImages(request.ImagePath, 0, 0, 1000, 1000) if request.ImagePath != "" {
if err != nil { iis, err := images.GenerateIdentityImages(request.ImagePath, 0, 0, 1000, 1000)
return err if err != nil {
} return err
}
err = b.multiaccountsDB.StoreIdentityImages(info.KeyUID, iis, false) err = b.multiaccountsDB.StoreIdentityImages(info.KeyUID, iis, false)
if err != nil { if err != nil {
return err return err
}
} }
return nil return nil

View File

@ -6,7 +6,6 @@ import (
var ErrCreateAccountInvalidDisplayName = errors.New("create-account: invalid display name") var ErrCreateAccountInvalidDisplayName = errors.New("create-account: invalid display name")
var ErrCreateAccountInvalidPassword = errors.New("create-account: invalid password") var ErrCreateAccountInvalidPassword = errors.New("create-account: invalid password")
var ErrCreateAccountInvalidImagePath = errors.New("create-account: invalid image path")
var ErrCreateAccountInvalidColor = errors.New("create-account: invalid color") var ErrCreateAccountInvalidColor = errors.New("create-account: invalid color")
var ErrCreateAccountInvalidRootKeystoreDir = errors.New("create-account: invalid root keystore directory") var ErrCreateAccountInvalidRootKeystoreDir = errors.New("create-account: invalid root keystore directory")
var ErrCreateAccountInvalidBackupDisabledDataDir = errors.New("create-account: invalid backup disabled data directory") var ErrCreateAccountInvalidBackupDisabledDataDir = errors.New("create-account: invalid backup disabled data directory")
@ -42,10 +41,6 @@ func (c *CreateAccount) Validate() error {
return ErrCreateAccountInvalidPassword return ErrCreateAccountInvalidPassword
} }
if len(c.ImagePath) == 0 {
return ErrCreateAccountInvalidImagePath
}
if len(c.Color) == 0 { if len(c.Color) == 0 {
return ErrCreateAccountInvalidColor return ErrCreateAccountInvalidColor
} }