mirror of https://github.com/Xhofe/alist
🐛 fix account status
parent
27e61c9eb8
commit
f4942e89bd
|
@ -339,6 +339,8 @@ func (a AliDrive) RefreshToken(account *model.Account) error {
|
||||||
if e.Code != "" {
|
if e.Code != "" {
|
||||||
account.Status = e.Message
|
account.Status = e.Message
|
||||||
return fmt.Errorf("failed to refresh token: %s", e.Message)
|
return fmt.Errorf("failed to refresh token: %s", e.Message)
|
||||||
|
}else {
|
||||||
|
account.Status = "work"
|
||||||
}
|
}
|
||||||
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
|
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -40,6 +40,11 @@ func (n Native) Save(account *model.Account, old *model.Account) error {
|
||||||
if !utils.Exists(account.RootFolder) {
|
if !utils.Exists(account.RootFolder) {
|
||||||
return fmt.Errorf("[%s] not exist", account.RootFolder)
|
return fmt.Errorf("[%s] not exist", account.RootFolder)
|
||||||
}
|
}
|
||||||
|
account.Status = "work"
|
||||||
|
err := model.SaveAccount(account)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,8 @@ func (o Onedrive) RefreshToken(account *model.Account) error {
|
||||||
if e.Error != "" {
|
if e.Error != "" {
|
||||||
account.Status = e.ErrorDescription
|
account.Status = e.ErrorDescription
|
||||||
return fmt.Errorf("%s", e.ErrorDescription)
|
return fmt.Errorf("%s", e.ErrorDescription)
|
||||||
|
}else {
|
||||||
|
account.Status = "work"
|
||||||
}
|
}
|
||||||
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
|
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue