commit
3e8db72794
@ -491,9 +491,10 @@ func (c *LoginController) CkLogin() {
|
|||||||
func (c *LoginController) SMSLogin() {
|
func (c *LoginController) SMSLogin() {
|
||||||
cookie := c.GetString("ck")
|
cookie := c.GetString("ck")
|
||||||
qq := c.GetString("qq")
|
qq := c.GetString("qq")
|
||||||
|
token := c.GetString("token")
|
||||||
logs.Info(cookie)
|
logs.Info(cookie)
|
||||||
(&models.JdCookie{}).Push(cookie)
|
(&models.JdCookie{}).Push(cookie)
|
||||||
|
if token == models.Config.ApiToken {
|
||||||
ptKey := FetchJdCookieValue("pt_key", cookie)
|
ptKey := FetchJdCookieValue("pt_key", cookie)
|
||||||
ptPin := FetchJdCookieValue("pt_pin", cookie)
|
ptPin := FetchJdCookieValue("pt_pin", cookie)
|
||||||
ck := &models.JdCookie{
|
ck := &models.JdCookie{
|
||||||
@ -511,7 +512,7 @@ func (c *LoginController) SMSLogin() {
|
|||||||
models.NewJdCookie(ck)
|
models.NewJdCookie(ck)
|
||||||
ck.Query()
|
ck.Query()
|
||||||
if qq != "" {
|
if qq != "" {
|
||||||
msg := fmt.Sprintf("来自短信的添加,账号:%s,QQ: %s", ck.PtPin, qq)
|
msg := fmt.Sprintf("来自短信的添加,账号:%s,QQ: %v", ck.PtPin, qq)
|
||||||
(&models.JdCookie{}).Push(msg)
|
(&models.JdCookie{}).Push(msg)
|
||||||
} else {
|
} else {
|
||||||
msg := fmt.Sprintf("来自短信的添加,账号:%s", ck.PtPin)
|
msg := fmt.Sprintf("来自短信的添加,账号:%s", ck.PtPin)
|
||||||
@ -523,7 +524,7 @@ func (c *LoginController) SMSLogin() {
|
|||||||
if qq != "" && len(qq) > 6 {
|
if qq != "" && len(qq) > 6 {
|
||||||
ck.Update(models.QQ, qq)
|
ck.Update(models.QQ, qq)
|
||||||
}
|
}
|
||||||
msg := fmt.Sprintf("来自短信的更新,账号:%s", ck.PtPin)
|
msg := fmt.Sprintf("来自短信的更新,账号:%s,QQ: %v", ck.PtPin,qq)
|
||||||
(&models.JdCookie{}).Push(msg)
|
(&models.JdCookie{}).Push(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,7 +567,20 @@ func (c *LoginController) SMSLogin() {
|
|||||||
(&models.JdCookie{}).Push(msg)
|
(&models.JdCookie{}).Push(msg)
|
||||||
c.Ctx.WriteString(string(jsons))
|
c.Ctx.WriteString(string(jsons))
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
result := Result{
|
||||||
|
Data: "null",
|
||||||
|
Code: 300,
|
||||||
|
Message: "Token错误",
|
||||||
|
}
|
||||||
|
jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[]
|
||||||
|
if errs != nil {
|
||||||
|
fmt.Println(errs.Error())
|
||||||
|
}
|
||||||
|
msg := fmt.Sprintf("传入错误Token,请小心攻击")
|
||||||
|
(&models.JdCookie{}).Push(msg)
|
||||||
|
c.Ctx.WriteString(string(jsons))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *LoginController) Cookie() {
|
func (c *LoginController) Cookie() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user