Skip to content
Snippets Groups Projects

Draft: dissallow amiv accounts to sign into the api.

Open cwalter requested to merge dissallow-amiv-accounts into master
1 file
+ 4
1
Compare changes
  • Side-by-side
  • Inline
+ 4
1
@@ -173,9 +173,12 @@ def process_login(items):
# If the username matches an ethz email address, we just take the part
# before the @ as the username for the authentication against LDAP.
if re.match(r"^[^@]+@([^@]+[.]{1}){0,1}ethz.ch$", username):
if re.match(r"^[^@\-]+@([^@]+[.]{1}){0,1}ethz.ch$", username):
ldap_username = username.split('@', 2)[0]
if re.match(r"^.*[^\-].*", ldap_username):
raise ValueError("invalid username. please use a normal account, not a amiv account")
# LDAP
if (app.config.get('ldap_connector') and
ldap.authenticate_user(ldap_username, password)):
Loading