mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Restrict authentication email domain for seahub
This commit is contained in:
parent
cd742bb46d
commit
a50778b691
2 changed files with 17 additions and 0 deletions
1
sources/patches/arm-force_domain_email.patch
Symbolic link
1
sources/patches/arm-force_domain_email.patch
Symbolic link
|
@ -0,0 +1 @@
|
|||
x86-64-force_domain_email.patch
|
16
sources/patches/x86-64-force_domain_email.patch
Normal file
16
sources/patches/x86-64-force_domain_email.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
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.'
|
Loading…
Reference in a new issue