1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 06:33:48 +00:00

Improve login and create user (#5458)

* add create oauth/ldap/saml user in UserManager

* improve admin add/import users

* improve dingtalk/weixin/work_weixin login/create user

* improve saml login/create user

* improve oauth login/create user

* login ldap user in seahub

* improve invite user

* fix code

* fix github test action

* fix test

* fix saml login

* optimize code

* specify the version of python-ldap

* fix code

* improve code

* add get_old_user

* optimize oauth login code

* optimize code

* remove LDAP_USER_UNIQUE_ID

* remove test_primary_id

* improve authenticate user

* improve saml login

* optimize code
This commit is contained in:
WJH
2023-06-19 13:06:15 +08:00
committed by GitHub
parent 42773a692d
commit 532fa5ef8c
45 changed files with 689 additions and 591 deletions

View File

@@ -11,6 +11,7 @@ from tests.common.common import USERNAME, PASSWORD, \
from tests.common.utils import apiurl, urljoin, randstring
from tests.api.urls import TOKEN_URL, GROUPS_URL, ACCOUNTS_URL, REPOS_URL
from seahub.base.accounts import User
class ApiTestBase(unittest.TestCase):
_token = None
@@ -175,8 +176,11 @@ class ApiTestBase(unittest.TestCase):
def create_user(self):
username = '%s@test.com' % randstring(20)
password = randstring(20)
data = {'password': password}
self.admin_put(urljoin(ACCOUNTS_URL, username), data=data, expected=201)
user = User(email=username)
user.is_staff = False
user.is_active = True
user.set_password(password)
user.save()
return _User(username, password)
def remove_user(self, username):