fixed token registration

This commit is contained in:
Givralix 2024-07-14 12:55:41 +02:00
parent 3c5943bef4
commit 4a80491eb7

View file

@ -980,12 +980,9 @@ func (a *UserInternalAPI) PerformSaveThreePIDAssociation(ctx context.Context, re
const pushRulesAccountDataType = "m.push_rules" const pushRulesAccountDataType = "m.push_rules"
func (a *UserInternalAPI) ValidateRegistrationToken(ctx context.Context, token string) (*clientapi.RegistrationToken, error) { 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 { if registrationToken == nil || *registrationToken.UsesAllowed == 0 || *registrationToken.ExpiryTime < int64(spec.AsTimestamp(time.Now())) {
return nil, err
}
if registrationToken == nil || *registrationToken.UsesAllowed == 0 || *registrationToken.ExpiryTime > int64(spec.AsTimestamp(time.Now())) {
return nil, nil return nil, nil
} }