if settings.SMTP_SERVER: auth.sender = Mailer( server=settings.SMTP_SERVER, sender=settings.SMTP_SENDER, login=settings.SMTP_LOGIN, tls=settings.SMTP_TLS, ssl=settings.SMTP_SSL, ) if auth.db: groups = Tags(db.auth_user, "groups") if settings.USE_PAM: from py4web.utils.auth_plugins.pam_plugin import PamPlugin auth.register_plugin(PamPlugin()) if settings.USE_LDAP: from py4web.utils.auth_plugins.ldap_plugin import LDAPPlugin auth.register_plugin( LDAPPlugin(db=db, groups=groups, **settings.LDAP_SETTINGS)) if settings.OAUTH2GOOGLE_CLIENT_ID: from py4web.utils.auth_plugins.oauth2google import OAuth2Google # TESTED auth.register_plugin( OAuth2Google( client_id=settings.OAUTH2GOOGLE_CLIENT_ID, client_secret=settings.OAUTH2GOOGLE_CLIENT_SECRET, callback_url="auth/plugin/oauth2google/callback",
elif settings.SESSION_TYPE == 'database': from py4web.utils.dbstore import DBStore session = Session(secret=settings.SESSION_SECRET_KEY, storage=DBStore(db)) auth = Auth(session, db, registration_requires_confirmation=False, password_complexity=False, use_username=False) if auth.db: groups = Tags(db.auth_user, 'groups') if settings.USE_PAM: from py4web.utils.auth_plugins.pam_plugin import PamPlugin auth.register_plugin(PamPlugin()) if settings.USE_LDAP: from py4web.utils.auth_plugins.ldap_plugin import LDAPPlugin auth.register_plugin(LDAPPlugin(**settings.LDAP_SETTINGS)) if settings.OAUTH2GOOGLE_CLIENT_ID: from py4web.utils.auth_plugins.oauth2google import OAuth2Google # TESTED auth.register_plugin( OAuth2Google(client_id=settings.OAUTH2GOOGLE_CLIENT_ID, client_secret=settings.OAUTH2GOOGLE_CLIENT_SECRET, callback_url='auth/plugin/oauth2google/callback')) if settings.OAUTH2FACEBOOK_CLIENT_ID: from py4web.utils.auth_plugins.oauth2facebook import OAuth2Facebook # UNTESTED auth.register_plugin( OAuth2Facebook(client_id=settings.OAUTH2FACEBOOK_CLIENT_ID,