1
0

fix(caldav): make sure the caldav tokens of non-local accounts are properly checked

This commit is contained in:
kolaente
2022-07-04 18:08:41 +02:00
parent db1ccff0de
commit 4429ba2da1
3 changed files with 37 additions and 5 deletions

View File

@ -28,14 +28,15 @@ import (
)
func BasicAuth(username, password string, c echo.Context) (bool, error) {
creds := &user.Login{
s := db.NewSession()
defer s.Close()
credentials := &user.Login{
Username: username,
Password: password,
}
s := db.NewSession()
defer s.Close()
u, err := user.CheckUserCredentials(s, creds)
if err != nil && !user.IsErrWrongUsernameOrPassword(err) {
u, err := user.CheckUserCredentials(s, credentials)
if err != nil && !user.IsErrWrongUsernameOrPassword(err) && !user.IsErrAccountIsNotLocal(err) {
log.Errorf("Error during basic auth for caldav: %v", err)
return false, nil
}