-
-
Notifications
You must be signed in to change notification settings - Fork 41
messagix/bloks,dependencies: Handle phone number login #213
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
Conversation
pkg/messagix/bloks/selenium.go
Outdated
| return &b | ||
| } | ||
|
|
||
| var usernameOrEmailRegexp = regexp.MustCompile(`^([a-zA-Z0-9.]+[a-zA-Z][a-zA-Z0-9.]*|[a-zA-Z0-9.]*[a-zA-Z][a-zA-Z0-9.]+|.+@.+)$`) |
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.
Instagram seems to allow 1 character usernames as well as underscores, so the username part should probably just be [a-zA-Z0-9._]*[a-zA-Z][a-zA-Z0-9._]*? (so no +* and *+ as separate options)
1 number/dot/underscore usernames don't exist fortunately
| var usernameOrEmailRegexp = regexp.MustCompile(`^([a-zA-Z0-9.]+[a-zA-Z][a-zA-Z0-9.]*|[a-zA-Z0-9.]*[a-zA-Z][a-zA-Z0-9.]+|.+@.+)$`) | |
| var usernameOrEmailRegexp = regexp.MustCompile(`^([a-zA-Z0-9._]*[a-zA-Z][a-zA-Z0-9._]*|.+@.+)$`) |
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.
wait I'm dumb this is messenger only, anyway, probably no need for the 2 cases?
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.
(actually in theory we might want this for instagram in the future? they use the same bloks stuff, not sure how reusable the code is though)
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.
I guess there is no harm doing it the way you suggested, it is not a valid username but we only need this regex to filter out phone numbers. Making a tweak
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.
It's called the "definitely not a phone number" regexp now, and I just check if it contains at least an at-sign or letter
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.
Oh yeah that regex is much simpler and should do the trick
tulir
left a comment
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.
Looks fine other than the potential minor tweak to the regex
add phonenumbers libraryitregexp to check if the user tried to login to messenger with a phone number, and error out if so