WaspW
Wasp2y ago
KYAN1TE

Disable case sensitivity on username register/login?

So I can enforce my user that is registering to use a lowercase username by doing the following:

              <SignupForm
                additionalFields={(form, state) => {
                  return (
                    <>
                      <FormItemGroup>
                        <div className="mb-4">
                          <label className="block text-md font-bold">
                            Username
                          </label>
                          <label className="block text-sm font-light mb-2">
                            You'll use this when logging in.
                          </label>
                          <input
                            {...form.register("username")}
                            className="input w-full mb-2"
                            id="username"
                            onChange={(e) => {
                              e.target.value = e.target.value.toLowerCase();
                              form.register("username").onChange(e);
                            }}
                          />


However, as there is no additionalFields type of option on the <LoginForm> component, I am stumped as to how to do something similar.

In an ideal world, I'd just lowercase it all on the server side... but it kind of defeats the point of using the built in batteries included auth, right?

Any way I can do this without running with my own auth? Cheers
Was this page helpful?