From 7b0f219a829d6b3340ea8b4a1f1d68935f72e96f Mon Sep 17 00:00:00 2001 From: Jasder <2053003901@@qq.com> Date: Thu, 15 Oct 2020 19:40:50 +0800 Subject: [PATCH] FIX pwd bug --- app/controllers/ci/cloud_accounts_controller.rb | 5 +++-- app/views/ci/cloud_accounts/oauth_grant.json.jbuilder | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 app/views/ci/cloud_accounts/oauth_grant.json.jbuilder diff --git a/app/controllers/ci/cloud_accounts_controller.rb b/app/controllers/ci/cloud_accounts_controller.rb index bb5df9895..85f687716 100644 --- a/app/controllers/ci/cloud_accounts_controller.rb +++ b/app/controllers/ci/cloud_accounts_controller.rb @@ -84,14 +84,15 @@ class Ci::CloudAccountsController < Ci::BaseController end def oauth_grant - password = params[:password].to_s + password = params[:password].strip.to_s return render_error('你输入的密码不正确.') unless current_user.check_password?(password) oauth = current_user.oauths.last return render_error("服务器出小差了.") if oauth.blank? result = gitea_oauth_grant!(password, oauth) - result === true ? render_ok : render_error('授权失败.') + return render_error('授权失败.') unless result === true + current_user.set_drone_step!(User::DEVOPS_CERTIFICATION) end private diff --git a/app/views/ci/cloud_accounts/oauth_grant.json.jbuilder b/app/views/ci/cloud_accounts/oauth_grant.json.jbuilder new file mode 100644 index 000000000..39d2c0647 --- /dev/null +++ b/app/views/ci/cloud_accounts/oauth_grant.json.jbuilder @@ -0,0 +1 @@ +json.step current_user.devops_step