feat: allows loginWithUsername to not require username (#7480)

Allows username to be optional when using the new loginWithUsername
feature. This can be done by the following:

```ts
auth: {
  loginWithUsername: {
    requireUsername: false, // <-- new property, default true
    requireEmail: false, // default: false
    allowEmailLogin: true, // default false
  },
},
```
This commit is contained in:
Jarrod Flesch
2024-08-05 11:35:01 -04:00
committed by GitHub
parent cdb2072a6d
commit 1ebd54b315
67 changed files with 884 additions and 325 deletions

View File

@@ -15,7 +15,9 @@ export const AuthDebug: React.FC<UIField> = () => {
setState(userRes)
}
void fetchUser()
if (user?.id) {
void fetchUser()
}
}, [user])
return (

View File

@@ -56,7 +56,6 @@ const createFirstUser = async ({
// forget to fill out confirm password
await page.locator('#field-email').fill(devUser.email)
await page.locator('#field-password').fill(devUser.password)
await wait(500)
await page.locator('.form-submit > button').click()
await expect(page.locator('.field-type.confirm-password .field-error')).toHaveText(
'This field is required.',
@@ -66,7 +65,6 @@ const createFirstUser = async ({
await page.locator('#field-email').fill(devUser.email)
await page.locator('#field-password').fill('12')
await page.locator('#field-confirm-password').fill('12')
await wait(500)
await page.locator('.form-submit > button').click()
await expect(page.locator('.field-type.password .field-error')).toHaveText(
'This value must be longer than the minimum length of 3 characters.',
@@ -76,7 +74,6 @@ const createFirstUser = async ({
await page.locator('#field-password').fill(devUser.password)
await page.locator('#field-confirm-password').fill(devUser.password)
await page.locator('#field-custom').fill('Hello, world!')
await wait(500)
await page.locator('.form-submit > button').click()
await expect