Allow empty email
This commit is contained in:
@@ -43,8 +43,7 @@ func profileTests(t *testing.T, s TestSetup) {
|
||||
assert.NotNil(t, profileRes)
|
||||
s.GinContext.Request.Header.Set("Authorization", "")
|
||||
newEmail := profileRes.Email
|
||||
assert.Equal(t, email, newEmail, "emails should be equal")
|
||||
|
||||
assert.Equal(t, email, refs.StringValue(newEmail), "emails should be equal")
|
||||
cleanData(email)
|
||||
})
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ func signupTests(t *testing.T, s TestSetup) {
|
||||
})
|
||||
assert.Nil(t, err, "signup should be successful")
|
||||
user := *res.User
|
||||
assert.Equal(t, email, user.Email)
|
||||
assert.Equal(t, email, refs.StringValue(user.Email))
|
||||
assert.Equal(t, "test", user.AppData["test"])
|
||||
assert.Nil(t, res.AccessToken, "access token should be nil")
|
||||
res, err = resolvers.SignupResolver(ctx, model.SignUpInput{
|
||||
|
@@ -19,7 +19,7 @@ func updateAllUsersTest(t *testing.T, s TestSetup) {
|
||||
_, ctx := createContext(s)
|
||||
for i := 0; i < 10; i++ {
|
||||
user := &models.User{
|
||||
Email: fmt.Sprintf("update_all_user_%d_%s", i, s.TestInfo.Email),
|
||||
Email: refs.NewStringRef(fmt.Sprintf("update_all_user_%d_%s", i, s.TestInfo.Email)),
|
||||
SignupMethods: constants.AuthRecipeMethodBasicAuth,
|
||||
Roles: "user",
|
||||
}
|
||||
@@ -61,7 +61,7 @@ func updateAllUsersTest(t *testing.T, s TestSetup) {
|
||||
} else {
|
||||
assert.True(t, refs.BoolValue(u.IsMultiFactorAuthEnabled))
|
||||
}
|
||||
cleanData(u.Email)
|
||||
cleanData(refs.StringValue(u.Email))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@@ -59,14 +59,14 @@ func userTest(t *testing.T, s TestSetup) {
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, res.User.ID, userRes.ID)
|
||||
assert.Equal(t, email, userRes.Email)
|
||||
assert.Equal(t, email, refs.StringValue(userRes.Email))
|
||||
// Should get user by email
|
||||
userRes, err = resolvers.UserResolver(ctx, model.GetUserRequest{
|
||||
Email: &email,
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, res.User.ID, userRes.ID)
|
||||
assert.Equal(t, email, userRes.Email)
|
||||
assert.Equal(t, email, refs.StringValue(userRes.Email))
|
||||
cleanData(email)
|
||||
})
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/authorizerdev/authorizer/server/db/models"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
"github.com/authorizerdev/authorizer/server/memorystore"
|
||||
"github.com/authorizerdev/authorizer/server/refs"
|
||||
"github.com/authorizerdev/authorizer/server/resolvers"
|
||||
"github.com/authorizerdev/authorizer/server/token"
|
||||
"github.com/authorizerdev/authorizer/server/utils"
|
||||
@@ -41,7 +42,7 @@ func validateJwtTokenTest(t *testing.T, s TestSetup) {
|
||||
scope := []string{"openid", "email", "profile", "offline_access"}
|
||||
user := &models.User{
|
||||
ID: uuid.New().String(),
|
||||
Email: "jwt_test_" + s.TestInfo.Email,
|
||||
Email: refs.NewStringRef("jwt_test_" + s.TestInfo.Email),
|
||||
Roles: "user",
|
||||
UpdatedAt: time.Now().Unix(),
|
||||
CreatedAt: time.Now().Unix(),
|
||||
@@ -96,6 +97,6 @@ func validateJwtTokenTest(t *testing.T, s TestSetup) {
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, res.IsValid)
|
||||
assert.Equal(t, user.Email, res.Claims["email"])
|
||||
assert.Equal(t, refs.StringValue(user.Email), res.Claims["email"])
|
||||
})
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ func verifyEmailTest(t *testing.T, s TestSetup) {
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, res)
|
||||
user := *res.User
|
||||
assert.Equal(t, email, user.Email)
|
||||
assert.Equal(t, email, refs.StringValue(user.Email))
|
||||
assert.Nil(t, res.AccessToken, "access token should be nil")
|
||||
verificationRequest, err := db.Provider.GetVerificationRequestByEmail(ctx, email, constants.VerificationTypeBasicAuthSignup)
|
||||
assert.Nil(t, err)
|
||||
|
Reference in New Issue
Block a user