|
|
|
@ -43,7 +43,21 @@ module Mobile
|
|
|
|
|
requires :accessType, type: Integer, desc: "资源类型"
|
|
|
|
|
end
|
|
|
|
|
get "source_url" do
|
|
|
|
|
CnmoocsService.new.source_url(params)
|
|
|
|
|
user = User.find_by_id(params[:userId])
|
|
|
|
|
return {error: -1, messages: "用户不存在,请先创建用户"} unless user
|
|
|
|
|
token = Token.get_or_create_permanent_login_token(user)
|
|
|
|
|
cookie_options = {
|
|
|
|
|
:value => token.value,
|
|
|
|
|
:expires => 1.month.from_now,
|
|
|
|
|
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
|
|
|
|
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
|
|
|
|
:httponly => true
|
|
|
|
|
}
|
|
|
|
|
if Redmine::Configuration['cookie_domain'].present?
|
|
|
|
|
cookie_options = cookie_options.merge(domain: Redmine::Configuration['cookie_domain'])
|
|
|
|
|
end
|
|
|
|
|
cookies[Redmine::Configuration['autologin_cookie_name'].presence || 'autologin'] = cookie_options
|
|
|
|
|
CnmoocsService.new.source_url(params, token)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "远程登录"
|
|
|
|
|