Browse Source

fixed cloudIDE saas定制api

pull/313/head
“xxq250” 3 years ago
parent
commit
a4c892ec0a
2 changed files with 14 additions and 1 deletions
  1. +11
    -0
      app/controllers/application_controller.rb
  2. +3
    -1
      app/controllers/public_keys_controller.rb

+ 11
- 0
app/controllers/application_controller.rb View File

@@ -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


+ 3
- 1
app/controllers/public_keys_controller.rb View File

@@ -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

Loading…
Cancel
Save