seafile_ynh/sources/patches/x86-64-force_domain_email.patch
2019-08-01 15:15:29 +02:00

16 lines
724 B
Diff

diff --git a/seahub/base/accounts.py b/seahub/base/accounts.py
index 4ebbb98c4..ba468d073 100644
--- a/seahub/seahub/base/accounts.py
+++ b/seahub/seahub/base/accounts.py
@@ -540,7 +540,11 @@ class User(object):
class AuthBackend(object):
+ allowed_domain = settings.REMOTE_USER_DOMAIN
+
def get_user_with_import(self, username):
+ if '@' in username and self.allowed_domain != username.split('@')[1]:
+ raise User.DoesNotExist, 'Invalid domain for the email. Please use the seafile domain for the domain part of the email.'
emailuser = seaserv.get_emailuser_with_import(username)
if not emailuser:
raise User.DoesNotExist, 'User matching query does not exits.'