fixed 密码处理,兼容base64

This commit is contained in:
2025-03-31 20:47:23 +08:00
parent 568248e6c1
commit 076d92a3eb
8 changed files with 16 additions and 16 deletions

View File

@@ -54,7 +54,7 @@ class Api::V1::UsersController < Api::V1::BaseController
end
def check_password
password = decrypt(params[:password]) rescue ""
password = decrypt(params[:password]) rescue params[:password].to_s
return tip_exception(-5, "8~16位密码支持字母数字和符号") unless password =~ CustomRegexp::PASSWORD
return tip_exception(-5, "密码错误") unless @observe_user.check_password?(password)
render_ok
@@ -127,7 +127,7 @@ class Api::V1::UsersController < Api::V1::BaseController
def destroy
password = decrypt(params[:password]) rescue ""
password = decrypt(params[:password]) rescue params[:password].to_s
return tip_exception(-1, "密码不正确.") unless @observe_user.check_password?(password)
org_ids = TeamUser.where(user_id: @observe_user.id).pluck(:organization_id) | OrganizationUser.where(user_id: @observe_user.id).pluck(:organization_id)
org_count = TeamUser.where(organization_id: org_ids).where(user_id: @observe_user.id).joins(:team).where(teams: {authorize: %w(owner)}).count