fix password resty api
此提交包含在:
@@ -2,6 +2,7 @@ package httpclient
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
"integrity-checkin/data/dto"
|
"integrity-checkin/data/dto"
|
||||||
"regexp"
|
"regexp"
|
||||||
@@ -14,10 +15,8 @@ func Setup() {
|
|||||||
Client = resty.New().SetTimeout(10 * time.Second)
|
Client = resty.New().SetTimeout(10 * time.Second)
|
||||||
}
|
}
|
||||||
func SDULogin(username string, password string) (*dto.SDULoginData, error) {
|
func SDULogin(username string, password string) (*dto.SDULoginData, error) {
|
||||||
resp, err := Client.R().SetFormData(map[string]string{
|
resp, err := Client.R().SetBody(fmt.Sprintf("username=%v&password=%v", username, password)).
|
||||||
"username": username,
|
Post("https://pass.sdu.edu.cn/cas/restlet/tickets")
|
||||||
"password": password,
|
|
||||||
}).Post("https://pass.sdu.edu.cn/cas/restlet/tickets")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
新增問題並參考
封鎖使用者