From 4a80491eb7c943aba53d953a4e5805f9a290a90a Mon Sep 17 00:00:00 2001 From: Givralix <13620839+Givralix@users.noreply.github.com> Date: Sun, 14 Jul 2024 12:55:41 +0200 Subject: [PATCH] fixed token registration --- userapi/internal/user_api.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/userapi/internal/user_api.go b/userapi/internal/user_api.go index 7c4604386..e885b4a31 100644 --- a/userapi/internal/user_api.go +++ b/userapi/internal/user_api.go @@ -980,12 +980,9 @@ func (a *UserInternalAPI) PerformSaveThreePIDAssociation(ctx context.Context, re const pushRulesAccountDataType = "m.push_rules" func (a *UserInternalAPI) ValidateRegistrationToken(ctx context.Context, token string) (*clientapi.RegistrationToken, error) { - registrationToken, err := a.DB.GetRegistrationToken(ctx, token) + registrationToken, _ := a.DB.GetRegistrationToken(ctx, token) - if err != nil { - return nil, err - } - if registrationToken == nil || *registrationToken.UsesAllowed == 0 || *registrationToken.ExpiryTime > int64(spec.AsTimestamp(time.Now())) { + if registrationToken == nil || *registrationToken.UsesAllowed == 0 || *registrationToken.ExpiryTime < int64(spec.AsTimestamp(time.Now())) { return nil, nil }