Create custom username login page with custom user attribute

Hello dears;
I’m newbie in java i create pages with keycloakify and i need to create custom spi for login form with custom user attribute e.g nationalCode, I create page custom-login-username.ftl and input with name username but i need find in attribute like say it i create sample and implement Auhenticator and in authentication class challenge custom page and show but when try to change locale get error missing response_type missing.
Can help me for it or show me sample how change custom username login my flow is like this
User input username check custom attribute then after success go other page option which way login otp with email or otp with mobile then show code page and then login
Thx.

package com.dawidgora.provider;

import org.jboss.logging.Logger;
import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.AuthenticationFlowError;
import org.keycloak.authentication.Authenticator;
import org.keycloak.forms.login.LoginFormsProvider;
import org.keycloak.models.*;

import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;

import java.util.Optional;
import java.util.stream.Stream;

public class LoginWithNationalCode implements Authenticator {
    protected static final Logger logger = Logger.getLogger(LoginWithNationalCode.class);

    private static final String PAGE = "custom-login-username.ftl";

    @Override
    public void authenticate(AuthenticationFlowContext context) {
        logger.debug("authenticate()");
        MultivaluedMap<String, String> formData = new MultivaluedHashMap<>();
        context.getAuthenticationSession().removeAuthNote("USER_SET_BEFORE_USERNAME_PASSWORD_AUTH");
        LoginFormsProvider form = context.form().setExecution(context.getExecution().getId());
        Response response = form.createForm(PAGE);
        context.challenge(response);
    }

    @Override
    public void action(AuthenticationFlowContext context) {
        String customUsername = context.getHttpRequest().getDecodedFormParameters().getFirst("username");

        if (customUsername == null || customUsername.isEmpty()) {
            context.failureChallenge(AuthenticationFlowError.INVALID_USER,
                    context.form().setError("Invalid username or national code").createForm(PAGE));
            return;
        }

        Stream<UserModel> users = context.getSession().users().searchForUserByUserAttributeStream(
                context.getRealm(), "nationalCode", customUsername);

        Optional<UserModel> user = users.findFirst();

        if (user.isPresent()) {
            context.setUser(user.get());
            context.success();
        } else {
            context.failureChallenge(AuthenticationFlowError.INVALID_USER,
                    context.form().setError("User not found or invalid national code").createForm(TPL_CODE));
        }
    }

    @Override
    public boolean requiresUser() {
        return false;
    }

    @Override
    public boolean configuredFor(KeycloakSession session, RealmModel realm, UserModel user) {
        return true;
    }

    @Override
    public void setRequiredActions(KeycloakSession session, RealmModel realm, UserModel user) {
    }

    @Override
    public void close() {
    }
}

this simple my code for custom usernameLoginPage

I just need add check my user attribute like nationalCode as username how can do this?
please help