fixed cloudIDE saas定制api
This commit is contained in:
parent
2945570a51
commit
a4c892ec0a
|
@ -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
|
||||
|
|
|
@ -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…
Reference in New Issue