-
Notifications
You must be signed in to change notification settings - Fork 38
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
LDAP and local accounts #31
Comments
This is definitely possible - I have done this in many projects. I.e. having local root privilege users. You can do this by providing a custom Login Form. See forms.py - it provides Your best bet here would be to do something like: from flask_ldap3_login.forms import LDAPLoginForm
from flask_wtf import FlaskForm
class MyAuthForm(LDAPLoginForm):
def validate(self, *args, **kwargs):
valid = FlaskForm.validate(self, *args, **kwargs)
if not valid:
print("Form validation failed")
return valid
if self.username.data == 'root' and self.password.data == 'mycoolpassword':
# TODO: Replace this with a call to your users datastore.
return True
# User not a local user, just do the normal LDAP validation
return super().validate(*args, **kwargs) |
Thanks for the reply. Yes, I also thought about overwriting the form, but I thought that is a common desire that could be implemented as part of the module. Anyways, I will try your suggestion... |
I aim to keep this module as use-case agnostic as possible to allow it to be as flexible as possible and work for the masses. |
Closing this issue out for now, if you have any other problems feel free to reply or open another issue. |
I am using the module in combination with the sqlalchemy module. As far as I can see it is not possible to have LDAP as well as local users. Is it planned or am I missing something?
The text was updated successfully, but these errors were encountered: