ssh公钥允许token请求

This commit is contained in:
“xxq250” 2022-10-21 09:42:21 +08:00
parent 4b0609931a
commit 0a5dd2f1ee
2 changed files with 9 additions and 1 deletions

View File

@ -173,6 +173,14 @@ class ApplicationController < ActionController::Base
tip_exception(401, "请登录后再操作") unless User.current.logged?
end
def require_login_or_token
if params[:token].present?
user = User.try_to_autologin(params[:token])
User.current = user
end
tip_exception(401, "请登录后再操作") unless User.current.logged?
end
def require_profile_completed
tip_exception(411, "请完善资料后再操作") unless User.current.profile_is_completed?
end

View File

@ -1,5 +1,5 @@
class PublicKeysController < ApplicationController
before_action :require_login
before_action :require_login_or_token
before_action :find_public_key, only: [:destroy]
def index