Merge branch 'dev' into runny827
feat(training): 新增精益培训视频与周任务管理 # Conflicts: # backend/app/models/__init__.py
This commit is contained in:
1 parent
85d27e9ffa
commit
91b7233872
812 files changed
+73763
-18908
No files matched your search
@@ -101,7 +101,7 @@ def login():
|
||||
|
||||
@auth_bp.post('/change-password', endpoint='change_password')
|
||||
def change_password():
|
||||
"""校验当前身份并同步更新本地与 Casdoor 密码。"""
|
||||
"""校验当前身份并同步更新本地与 Casdoor 密码;新密码与原密码相同直接 400。"""
|
||||
user = _compat._get_current_user()
|
||||
if not user:
|
||||
raise UnauthorizedError('Unauthorized')
|
||||
@@ -110,6 +110,12 @@ def change_password():
|
||||
new_password = data.get('new_password')
|
||||
if not current_password or not new_password:
|
||||
raise ValidationError('Current and new password are required')
|
||||
if current_password == new_password:
|
||||
raise AppError(
|
||||
code='AUTH.PASSWORD_UNCHANGED',
|
||||
message='New password must differ from the current password',
|
||||
http_status=400,
|
||||
)
|
||||
try:
|
||||
_compat._verify_current_password_for_change(user, current_password)
|
||||
_compat._sync_casdoor_password(user.username, current_password, new_password)
|
||||
|
||||
Reference in new issue
Block a user