-
Notifications
You must be signed in to change notification settings - Fork 510
Add handle login signin signals #6759
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
Add handle login signin signals #6759
Conversation
268efa4 to
3c54ff8
Compare
can you please add details to the PR itself? it's not very convenient for anyone (neither me who would first need to check what discussions we had, nor other devs who are not on our matrix channel) to have any details explaining why a PR is useful only in some other place |
25e164c to
fb0b7e9
Compare
21c7843 to
c216b3e
Compare
|
I made some changes to the signals to make them (in my opinion) more useful, and fixed incorrect documentation. Please have a look and see if they still do everything you need. This is what I used for testing: def init(self):
super().init()
self.connect(signals.users.check_signup_email, self._check_signup_email)
self.connect(signals.users.check_login_data, self._check_login_data)
def _check_signup_email(self, email, **kwargs):
print(email, kwargs)
if email.endswith('@evil.com'):
return 'YOU SHALL DO NO EVIL'
def _check_login_data(self, sender, provider, data, **kwargs):
print(sender, provider, data, kwargs) # data includes the password as well
if data['identifier'] == 'moo':
return 'no cows allowed' |
- clarify when it gets called - just return strings instead of an allowed flag (this is useless here because returning True would not do anything useful)
8f60f18 to
718c4f7
Compare
TESTED, works for us, thank you. |
As previously discussed with Alejandro:
we would like to introduce a signal in Indico core that allows refusing sign ups and logins and display a custom message that explains the reason.
This signal will return a tuple: True/False , String. --> The first value explain if the login/signin process can continue or not, the second value contains the eventual error message.