-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refine error message for sign up (#237)
* refine error message for sign up Signed-off-by: Bariq <[email protected]> * avoid information leak in signup Signed-off-by: Bariq <[email protected]> * resolve reviews Signed-off-by: Bariq <[email protected]> * make new error, sanitize user upon error user already exists Signed-off-by: Bariq <[email protected]> * sanitize confirmed_at, email_confirmed_at, phone_confirmed_at, and last_sign_in_at Signed-off-by: Bariq <[email protected]> * remove email change confirm status Signed-off-by: Bariq <[email protected]> * sanitize identities Signed-off-by: Bariq <[email protected]> * modularize function Signed-off-by: Bariq <[email protected]> * manually check response from gotrue-js Signed-off-by: Bariq <[email protected]> * fix test case and change aud Signed-off-by: Bariq <[email protected]> * refactor: santizeUser function Co-authored-by: Kang Ming <[email protected]>
- Loading branch information
1 parent
8bfde09
commit 5bc665b
Showing
3 changed files
with
65 additions
and
7 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
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 |
---|---|---|
|
@@ -219,11 +219,16 @@ func (ts *SignupTestSuite) TestSignupTwice() { | |
encode() | ||
ts.API.handler.ServeHTTP(w, req) | ||
|
||
data := make(map[string]interface{}) | ||
data := models.User{} | ||
require.NoError(ts.T(), json.NewDecoder(w.Body).Decode(&data)) | ||
|
||
assert.Equal(ts.T(), http.StatusBadRequest, w.Code) | ||
assert.Equal(ts.T(), float64(http.StatusBadRequest), data["code"]) | ||
require.Equal(ts.T(), http.StatusOK, w.Code) | ||
|
||
assert.Equal(ts.T(), "[email protected]", data.GetEmail()) | ||
assert.Equal(ts.T(), ts.Config.JWT.Aud, data.Aud) | ||
assert.Equal(ts.T(), 1.0, data.UserMetaData["a"]) | ||
assert.Equal(ts.T(), "email", data.AppMetaData["provider"]) | ||
assert.Equal(ts.T(), []interface{}{"email"}, data.AppMetaData["providers"]) | ||
} | ||
|
||
func (ts *SignupTestSuite) TestVerifySignup() { | ||
|