Fix issue with reset password

This commit is contained in:
Lakhan Samani 2022-01-08 23:01:06 +05:30
parent 1e759c64ed
commit 3221740198

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"strings"
"time"
"github.com/authorizerdev/authorizer/server/constants"
"github.com/authorizerdev/authorizer/server/db"
@ -47,6 +48,12 @@ func ResetPassword(ctx context.Context, params model.ResetPasswordInput) (*model
}
user.SignupMethods = signupMethod
// helpful if user has not signed up with basic auth
if user.EmailVerifiedAt == nil {
now := time.Now().Unix()
user.EmailVerifiedAt = &now
}
// delete from verification table
db.Mgr.DeleteVerificationRequest(verificationRequest)
db.Mgr.UpdateUser(user)