make login name changeable

pull/3/head
Daniel Dietsch 2020-11-02 22:15:11 +01:00
rodzic cb74e3d36c
commit fbf2ca495a
1 zmienionych plików z 10 dodań i 7 usunięć

Wyświetl plik

@ -878,27 +878,30 @@ class Gitea:
def create_user( def create_user(
self, self,
userName: str, user_name: str,
email: str, email: str,
password: str, password: str,
login_name: str = None,
change_pw=True, change_pw=True,
sendNotify=True, send_notify=True,
sourceId=0, source_id=0,
): ):
""" Create User. """ Create User.
Throws: Throws:
AlreadyExistsException, if the User exists already AlreadyExistsException, if the User exists already
Exception, if something else went wrong. Exception, if something else went wrong.
""" """
if not login_name:
login_name = user_name
result = self.requests_post( result = self.requests_post(
Gitea.ADMIN_CREATE_USER, Gitea.ADMIN_CREATE_USER,
data={ data={
"source_id": sourceId, "source_id": source_id,
"login_name": userName, "login_name": login_name,
"username": userName, "username": user_name,
"email": email, "email": email,
"password": password, "password": password,
"send_notify": sendNotify, "send_notify": send_notify,
"must_change_password": change_pw, "must_change_password": change_pw,
}, },
) )