mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 23:16:37 +08:00
fix(user): assign snowflake IDs on registration
The HTTP register path left ID at 0, so SQLite/GORM filled a serial primary key. CreateUser now generates a snowflake ID when none is set, matching admin create and OAuth signup.
This commit is contained in:
@@ -166,6 +166,8 @@ func TestUserLoginHTTPHandler(t *testing.T) {
|
||||
IsActive: true,
|
||||
}
|
||||
require.NoError(t, user.CreateUser(context.Background(), plainUser))
|
||||
require.NotZero(t, plainUser.ID)
|
||||
require.Greater(t, plainUser.ID, uint64(10000), "user id must be snowflake, not sqlite autoincrement")
|
||||
|
||||
reqBodyPlain := `{"username":"plain_admin","password":"12345678"}`
|
||||
reqPlain, _ := http.NewRequest(http.MethodPost, "/api/v1/user/login", bytes.NewBufferString(reqBodyPlain))
|
||||
|
||||
Reference in New Issue
Block a user