mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-22 19:51:39 +00:00
parent
beed39a8f4
commit
ae7b6dd516
@ -65,7 +65,7 @@ const selectPasswordHashSQL = "" +
|
|||||||
"SELECT password_hash FROM account_accounts WHERE localpart = $1 AND is_deactivated = FALSE"
|
"SELECT password_hash FROM account_accounts WHERE localpart = $1 AND is_deactivated = FALSE"
|
||||||
|
|
||||||
const selectNewNumericLocalpartSQL = "" +
|
const selectNewNumericLocalpartSQL = "" +
|
||||||
"SELECT COALESCE(MAX(localpart::integer), 0) FROM account_accounts WHERE localpart ~ '^[0-9]{1,}$'"
|
"SELECT COALESCE(MAX(localpart::bigint), 0) FROM account_accounts WHERE localpart ~ '^[0-9]{1,}$'"
|
||||||
|
|
||||||
type accountsStatements struct {
|
type accountsStatements struct {
|
||||||
insertAccountStmt *sql.Stmt
|
insertAccountStmt *sql.Stmt
|
||||||
|
@ -133,6 +133,14 @@ func Test_Accounts(t *testing.T) {
|
|||||||
// test getting a numeric localpart, with an existing user without a localpart
|
// test getting a numeric localpart, with an existing user without a localpart
|
||||||
_, err = db.CreateAccount(ctx, "", "", "", api.AccountTypeGuest)
|
_, err = db.CreateAccount(ctx, "", "", "", api.AccountTypeGuest)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
// Create a user with a high numeric localpart, out of range for the Postgres integer (2147483647) type
|
||||||
|
_, err = db.CreateAccount(ctx, "2147483650", "", "", api.AccountTypeUser)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
// Now try to create a new guest user
|
||||||
|
_, err = db.CreateAccount(ctx, "", "", "", api.AccountTypeGuest)
|
||||||
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user