ssh公钥允许token请求
This commit is contained in:
parent
4b0609931a
commit
0a5dd2f1ee
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue