-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: email_verified field not being updated on signup confirmation (#…
- Loading branch information
1 parent
40e0de1
commit 483463e
Showing
3 changed files
with
48 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,15 @@ func (ts *VerifyTestSuite) SetupTest() { | |
u, err := models.NewUser("12345678", "[email protected]", "password", ts.Config.JWT.Aud, nil) | ||
require.NoError(ts.T(), err, "Error creating test user model") | ||
require.NoError(ts.T(), ts.API.db.Create(u), "Error saving new test user") | ||
|
||
// Create identity | ||
i, err := models.NewIdentity(u, "email", map[string]interface{}{ | ||
"sub": u.ID.String(), | ||
"email": "[email protected]", | ||
"email_verified": false, | ||
}) | ||
require.NoError(ts.T(), err, "Error creating test identity model") | ||
require.NoError(ts.T(), ts.API.db.Create(i), "Error saving new test identity") | ||
} | ||
|
||
func (ts *VerifyTestSuite) TestVerifyPasswordRecovery() { | ||
|
@@ -673,6 +682,8 @@ func (ts *VerifyTestSuite) TestVerifySignupWithRedirectURLContainedPath() { | |
u, err = models.FindUserByEmailAndAudience(ts.API.db, "[email protected]", ts.Config.JWT.Aud) | ||
require.NoError(ts.T(), err) | ||
assert.True(ts.T(), u.IsConfirmed()) | ||
assert.True(ts.T(), u.UserMetaData["email_verified"].(bool)) | ||
assert.True(ts.T(), u.Identities[0].IdentityData["email_verified"].(bool)) | ||
}) | ||
} | ||
} | ||
|
@@ -875,6 +886,18 @@ func (ts *VerifyTestSuite) TestVerifyValidOtp() { | |
tokenHash: crypto.GenerateTokenHash(u.GetEmail(), "123456"), | ||
}, | ||
}, | ||
{ | ||
desc: "Valid Signup Token Hash", | ||
sentTime: time.Now(), | ||
body: map[string]interface{}{ | ||
"type": mail.SignupVerification, | ||
"token_hash": crypto.GenerateTokenHash(u.GetEmail(), "123456"), | ||
}, | ||
expected: expected{ | ||
code: http.StatusOK, | ||
tokenHash: crypto.GenerateTokenHash(u.GetEmail(), "123456"), | ||
}, | ||
}, | ||
{ | ||
desc: "Valid Recovery OTP", | ||
sentTime: time.Now(), | ||
|
@@ -940,18 +963,6 @@ func (ts *VerifyTestSuite) TestVerifyValidOtp() { | |
tokenHash: crypto.GenerateTokenHash(u.PhoneChange, "123456"), | ||
}, | ||
}, | ||
{ | ||
desc: "Valid Signup Token Hash", | ||
sentTime: time.Now(), | ||
body: map[string]interface{}{ | ||
"type": mail.SignupVerification, | ||
"token_hash": crypto.GenerateTokenHash(u.GetEmail(), "123456"), | ||
}, | ||
expected: expected{ | ||
code: http.StatusOK, | ||
tokenHash: crypto.GenerateTokenHash(u.GetEmail(), "123456"), | ||
}, | ||
}, | ||
{ | ||
desc: "Valid Email Change Token Hash", | ||
sentTime: time.Now(), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters