mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-29 21:08:49 +01:00
🎨 Support LiuYun account login https://github.com/siyuan-note/siyuan/issues/8578
This commit is contained in:
parent
4459413493
commit
5f13dea7af
2 changed files with 11 additions and 15 deletions
|
|
@ -564,21 +564,25 @@ func CheckActivationcode(code string) (retCode int, msg string) {
|
|||
return
|
||||
}
|
||||
|
||||
func Login(userName, password, captcha string, cloudRegion int) (ret *gulu.Result, err error) {
|
||||
func Login(userName, password, captcha string, cloudRegion int) (ret *gulu.Result) {
|
||||
Conf.CloudRegion = cloudRegion
|
||||
Conf.Save()
|
||||
util.CurrentCloudRegion = cloudRegion
|
||||
|
||||
result := map[string]interface{}{}
|
||||
request := httpclient.NewCloudRequest30s()
|
||||
_, err = request.
|
||||
resp, err := request.
|
||||
SetSuccessResult(&result).
|
||||
SetBody(map[string]string{"userName": userName, "userPassword": password, "captcha": captcha}).
|
||||
Post(util.GetCloudServer() + "/apis/siyuan/login")
|
||||
if nil != err {
|
||||
logging.LogErrorf("login failed: %s", err)
|
||||
return nil, errors.New(Conf.Language(18))
|
||||
ret = gulu.Ret.NewResult()
|
||||
ret.Code = -1
|
||||
ret.Msg = Conf.Language(18) + ": " + err.Error()
|
||||
return
|
||||
}
|
||||
logging.LogInfof(resp.Status)
|
||||
ret = &gulu.Result{
|
||||
Code: int(result["code"].(float64)),
|
||||
Msg: result["msg"].(string),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue