Skip to content

Commit

Permalink
fix profile name not displayed on the login page for synced device in…
Browse files Browse the repository at this point in the history
… the fallback flow
  • Loading branch information
Parveshdhull committed Sep 27, 2024
1 parent 7a23ac5 commit c3aa4f3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions api/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,29 @@ func TestRestoreAccountAndLogin(t *testing.T) {
require.Empty(t, mnemonic)
}

func TestRestoreAccountAndLoginWithoutDisplayName(t *testing.T) {
utils.Init()
tmpdir := t.TempDir()

backend := NewGethStatusBackend()

// Test case: Valid restore account request without DisplayName
restoreRequest := &requests.RestoreAccount{
Mnemonic: "test test test test test test test test test test test test",
FetchBackup: false,
CreateAccount: requests.CreateAccount{
DeviceName: "StatusIM",
Password: "password",
CustomizationColor: "0x000000",
RootDataDir: tmpdir,
},
}
account, err := backend.RestoreAccountAndLogin(restoreRequest)
require.NoError(t, err)
require.NotNil(t, account)
require.NotEmpty(t, account.Name)
}

func TestCreateAccountPathsValidation(t *testing.T) {
tmpdir := t.TempDir()

Expand Down
4 changes: 4 additions & 0 deletions api/geth_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,10 @@ func (b *GethStatusBackend) prepareNodeAccount(request *requests.CreateAccount,
return nil, errors.Wrap(err, "failed to prepare settings")
}

if response.account.Name == "" {
response.account.Name = response.settings.Name
}

response.nodeConfig, err = b.prepareConfig(request, input, response.settings.InstallationID)
if err != nil {
return nil, errors.Wrap(err, "failed to prepare node config")
Expand Down

0 comments on commit c3aa4f3

Please sign in to comment.