From e5450492bb4805305047fe81abb05b9308a87631 Mon Sep 17 00:00:00 2001 From: TonyQ Date: Sat, 11 Dec 2021 10:30:57 +0800 Subject: [PATCH] telegram: find USERNAME when USER env not found for windows. --- pkg/service/totp.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/service/totp.go b/pkg/service/totp.go index 0c7db3e27..395171999 100644 --- a/pkg/service/totp.go +++ b/pkg/service/totp.go @@ -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") }