|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
#encoding=utf-8
|
|
|
|
|
require 'net/http'
|
|
|
|
|
require 'digest'
|
|
|
|
|
|
|
|
|
|
class EcloudController < ApplicationController
|
|
|
|
|
skip_before_filter :verify_authenticity_token
|
|
|
|
|
|
|
|
|
@ -22,16 +24,12 @@ class EcloudController < ApplicationController
|
|
|
|
|
ROOT_URl = 'http://localhost:3000'
|
|
|
|
|
SERVER_URL = "https://221.176.54.92:9081/restful/services/"
|
|
|
|
|
|
|
|
|
|
def oschina_login
|
|
|
|
|
# 根据session,看看有没有存access_token,去刷新下。
|
|
|
|
|
# 1. 如果过期,则跳转
|
|
|
|
|
# 2. 未过期,直接用
|
|
|
|
|
|
|
|
|
|
redirect_to "https://gitee.com/oauth/authorize?client_id=#{CLIENT_ID}&redirect_uri=#{ROOT_URl}/oschina/login_cb&response_type=code"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 签名
|
|
|
|
|
def sign(timestamp)
|
|
|
|
|
Digest::MD5.hexdigest("client_id=#{CLIENT_ID}client_key=#{CLIENT_SECRET}timestamp=#{timestamp}")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 企业开通
|
|
|
|
|