FIX devops pwd auth bug

This commit is contained in:
Jasder 2020-10-15 14:37:24 +08:00
parent 28d6aa2dda
commit 64a3ab24e2
2 changed files with 3 additions and 2 deletions

View File

@ -2640,7 +2640,7 @@ GET /api/users/ci/oauth_grant
*示例*
```
curl -X GET \
-d "password=123456"
-d "password=123456" \
http://localhost:3000/api/users/ci/oauth_grant.json | jq
```
*请求参数说明:*

View File

@ -84,7 +84,8 @@ class Ci::CloudAccountsController < Ci::BaseController
end
def oauth_grant
return render_error('你输入的密码不正确.') unless current_user.check_password?(params[:password].to_s)
password = params[:password].to_s
return render_error('你输入的密码不正确.') unless current_user.check_password?(password)
result = gitea_oauth_grant!(current_user.login, password, @cloud_account.drone_url, current_user.oauths.last&.client_id)
result === true ? render_ok : render_error('授权失败.')