Skip to content

Commit

Permalink
fix invalid implementation of RetryPassword hook
Browse files Browse the repository at this point in the history
RetryPassword hook of conservator is supposed to ask call AskPassword
but it was calling AskCode instead in web auth example as well as basic
conservator.
  • Loading branch information
celestix committed Apr 21, 2024
1 parent b55e34a commit d364b28
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion authConversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ func (b *basicConservator) RetryPassword(trialsLeft int) (string, error) {
fmt.Println("The 2FA Code you just entered seems to be incorrect,")
fmt.Println("Attempts Left:", trialsLeft)
fmt.Println("Please try again....")
return b.AskCode()
return b.AskPassword()
}
2 changes: 1 addition & 1 deletion authHelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func authFlow(ctx context.Context, client *auth.Client, conversator AuthConversa

sentCode, err := client.SendCode(ctx, phone, f.Options)
if err != nil {
return errors.Wrap(err, "send code")
return err
}
switch s := sentCode.(type) {
case *tg.AuthSentCode:
Expand Down
3 changes: 2 additions & 1 deletion examples/auth-using-api-base/web/webauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package web

import (
"fmt"

"github.com/celestix/gotgproto"
)

Expand Down Expand Up @@ -39,7 +40,7 @@ func (w *webAuth) RetryPassword(attemptsLeft int) (string, error) {
fmt.Println("The 2FA Code you just entered seems to be incorrect,")
fmt.Println("Attempts Left:", attemptsLeft)
fmt.Println("Please try again.... ")
return w.AskCode()
return w.AskPassword()
}

func ReceivePhone(phone string) {
Expand Down

0 comments on commit d364b28

Please sign in to comment.