-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature(authentication): allow user to retry input password #4
base: master
Are you sure you want to change the base?
Conversation
+ allow user to retry authentication. + add time delay when password verification failed to avoid brute-force password.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkhang please take a look
@@ -14,7 +15,9 @@ import ( | |||
) | |||
|
|||
var ( | |||
ppidStr = fmt.Sprintf("%d", os.Getppid()) | |||
ppidStr = fmt.Sprintf("%d", os.Getppid()) | |||
loginMaxRetries = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkhang I think this can be clearer. Is number 3
Retries
? You mean maxLogin
?
ppidStr = fmt.Sprintf("%d", os.Getppid()) | ||
ppidStr = fmt.Sprintf("%d", os.Getppid()) | ||
loginMaxRetries = 3 | ||
failedLogInWaitTime = time.Second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkhang I think we need to be consistent on Login
vs LogIn
, also Time
is quite unclear
err = s.doLogin() | ||
if err != nil { | ||
var isLoggedIn = false | ||
for i := 0; i < loginMaxRetries; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkhang should we extract login and retrying login logics to another method?
password.