diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index cfff09c2e..eaffdeca0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -181,6 +181,17 @@ class ApplicationController < ActionController::Base tip_exception(401, "请登录后再操作") unless User.current.logged? end + def require_login_cloud_ide_saas + if params[:sign].present? && params[:email].present? + sign = Digest::MD5.hexdigest("#{OPENKEY}#{params[:email]}") + if params[:sign].to_s == sign + user = User.find_by(mail: params[:email]) + User.current = user + end + end + tip_exception(401, "请登录后再操作") unless User.current.logged? + end + def require_profile_completed tip_exception(411, "请完善资料后再操作") unless User.current.profile_is_completed? end diff --git a/app/controllers/public_keys_controller.rb b/app/controllers/public_keys_controller.rb index 0e18e3e09..fa6601178 100644 --- a/app/controllers/public_keys_controller.rb +++ b/app/controllers/public_keys_controller.rb @@ -1,5 +1,5 @@ class PublicKeysController < ApplicationController - before_action :require_login_or_token + before_action :require_login_cloud_ide_saas before_action :find_public_key, only: [:destroy] def index @@ -61,4 +61,6 @@ class PublicKeysController < ApplicationController def find_public_key @public_key = current_user.public_keys.find_by_id(params[:id]) end + + end \ No newline at end of file