Skip to content

Commit

Permalink
feat: add non-unified tip in stored accounts list
Browse files Browse the repository at this point in the history
  • Loading branch information
unbyte committed Apr 12, 2021
1 parent 8edb904 commit 82bff2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ var (
}

for i, account := range store.Config.Accounts {
console.InfoF("#%d %s", i, account.Username)
console.InfoF("#%d %s", i, account.String())
if account.Username == store.Config.DefaultAccount {
console.Info(" - default")
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/model/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package model

import (
"errors"
"fmt"
"github.com/neucn/ipgw/pkg/utils"
)

Expand Down Expand Up @@ -37,3 +38,10 @@ func (a *Account) SetPassword(password string, secret []byte) error {
a.EncryptedPassword = result
return nil
}

func (a *Account) String() string {
if a.NonUnified {
return fmt.Sprintf("%s [non-unified]", a.Username)
}
return a.Username
}

0 comments on commit 82bff2d

Please sign in to comment.