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
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
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
}