telegram: find USERNAME when USER env not found for windows.

This commit is contained in:
TonyQ 2021-12-11 10:30:57 +08:00
parent 9f14d00f3c
commit e5450492bb

View File

@ -32,6 +32,9 @@ func NewDefaultTotpKey() (*otp.Key, error) {
if len(totpAccountName) == 0 {
user, ok := os.LookupEnv("USER")
if !ok {
user, ok = os.LookupEnv("USERNAME")
}
if !ok {
return nil, fmt.Errorf("can not get USER env var for totp account name")
}