diff --git a/seahub/api2/endpoints/account.py b/seahub/api2/endpoints/account.py index 191f626da8..c33a40b504 100644 --- a/seahub/api2/endpoints/account.py +++ b/seahub/api2/endpoints/account.py @@ -30,6 +30,7 @@ json_content_type = 'application/json; charset=utf-8' def get_account_info(user): email = user.username d_profile = DetailedProfile.objects.get_detailed_profile_by_user(email) + profile = Profile.objects.get_profile_by_user(email) info = {} info['email'] = email @@ -39,6 +40,7 @@ def get_account_info(user): info['is_staff'] = user.is_staff info['is_active'] = user.is_active info['create_time'] = user.ctime + info['login_id'] = profile.login_id if profile else '' info['total'] = seafile_api.get_user_quota(email) info['usage'] = seafile_api.get_user_self_usage(email) @@ -108,10 +110,18 @@ class Account(APIView): profile = Profile.objects.get_profile_by_user(email) if profile is None: profile = Profile(user=email) - profile.nickname = name profile.save() + # update account loginid + loginid = request.data.get("login_id", '').strip() + if loginid != '': + profile = Profile.objects.get_profile_by_user(email) + if profile is None: + profile = Profile(user=email) + profile.login_id = loginid + profile.save() + # update account detailed profile department = request.data.get("department", None) if department is not None: @@ -165,6 +175,18 @@ class Account(APIView): return api_error(status.HTTP_400_BAD_REQUEST, _(u"Name should not include '/'.")) + #argument check for loginid + loginid = request.data.get("login_id", None) + if loginid is not None: + loginid = loginid.strip() + if loginid == "": + return api_error(status.HTTP_400_BAD_REQUEST, + _(u"Login id can't be empty")) + usernamebyloginid = Profile.objects.get_username_by_login_id(loginid) + if usernamebyloginid is not None: + return api_error(status.HTTP_400_BAD_REQUEST, + _(u"Login id %s already exists." % loginid)) + # argument check for department department = request.data.get("department", None) if department is not None: diff --git a/seahub/base/accounts.py b/seahub/base/accounts.py index 1efecd04c3..9e638fdf33 100644 --- a/seahub/base/accounts.py +++ b/seahub/base/accounts.py @@ -253,6 +253,10 @@ class User(object): ccnet_api.remove_emailuser(source, username) Profile.objects.delete_profile_by_user(username) + if settings.ENABLE_TERMS_AND_CONDITIONS: + from termsandconditions.models import UserTermsAndConditions + UserTermsAndConditions.objects.filter(username=username).delete() + def get_and_delete_messages(self): messages = [] return messages diff --git a/seahub/settings.py b/seahub/settings.py index 5a8e71ee15..fc2297b504 100644 --- a/seahub/settings.py +++ b/seahub/settings.py @@ -520,11 +520,14 @@ THUMBNAIL_EXTENSION = 'png' THUMBNAIL_DEFAULT_SIZE = 48 THUMBNAIL_SIZE_FOR_GRID = 192 - # size(MB) limit for generate thumbnail THUMBNAIL_IMAGE_SIZE_LIMIT = 20 THUMBNAIL_IMAGE_ORIGINAL_SIZE_LIMIT = 256 +# video thumbnails +ENABLE_VIDEO_THUMBNAIL = False +THUMBNAIL_VIDEO_FRAME_TIME = 5 # use the frame at 5 second as thumbnail + # template for create new office file OFFICE_TEMPLATE_ROOT = os.path.join(MEDIA_ROOT, 'office-template') diff --git a/seahub/templates/sysadmin/userinfo.html b/seahub/templates/sysadmin/userinfo.html index 416a19d343..997e3e3826 100644 --- a/seahub/templates/sysadmin/userinfo.html +++ b/seahub/templates/sysadmin/userinfo.html @@ -53,6 +53,18 @@ +