Commit 3cf11d81 by keith

app_secret

parent 211eb670
Showing with 1 additions and 10 deletions
......@@ -151,8 +151,6 @@ func (c *AuthController) Logout() {
// RobotFetchTokenRequest struct
type RobotFetchTokenRequest struct {
AppID string `json:"app_id"`
AppKey string `json:"app_key"`
AppSecret string `json:"app_secret"`
}
......@@ -166,8 +164,6 @@ func (c *AuthController) RobotFetchToken() {
// valid
valid := validation.Validation{}
valid.Required(request.AppID, "app_id").Message("app_id不能为空!")
valid.Required(request.AppKey, "app_key").Message("app_key不能为空!")
valid.Required(request.AppSecret, "app_secret").Message("app_secret不能为空!")
if valid.HasErrors() {
for _, err := range valid.Errors {
......@@ -175,11 +171,6 @@ func (c *AuthController) RobotFetchToken() {
}
}
// MD5
m5 := md5.New()
m5.Write([]byte(request.AppID + request.AppKey + request.AppSecret))
reqyestSecret := hex.EncodeToString(m5.Sum(nil))
// current app Secret
_AppID, _ := beego.AppConfig.Int64("mimc_appId")
_AppKey := beego.AppConfig.String("mimc_appKey")
......@@ -189,7 +180,7 @@ func (c *AuthController) RobotFetchToken() {
currentAppSecret := hex.EncodeToString(m51.Sum(nil))
// check
if reqyestSecret != currentAppSecret {
if request.AppSecret != currentAppSecret {
c.JSON(configs.ResponseFail, "server error~", nil)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment