Fix a crash by auth commands when online

This commit is contained in:
Bohdan Horbeshko 2023-06-16 00:44:48 -04:00
parent fdd867cf7a
commit 739fc4110a

View file

@ -259,6 +259,10 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) string
return telegramNotInitialized return telegramNotInitialized
} }
if c.authorizer.isClosed {
return "Authorization is done already"
}
switch cmd { switch cmd {
// sign in // sign in
case "login": case "login":
@ -290,7 +294,7 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) string
// cancel auth // cancel auth
case "cancelauth": case "cancelauth":
if c.Online() { if c.Online() {
return "Not allowed when online" return "Not allowed when online, use /logout instead"
} }
c.cancelAuth() c.cancelAuth()
return "Cancelled" return "Cancelled"