loginForm = (req, isCreating) => {
  const postAuthMethods = Object.entries(getState().auth_methods)
    // TBD unresolved parameter K
    // TBD unresolved postUsernamePassword
    .filter(([k, v]) => v.postUsernamePassword)
    .map(([k, v]) => v);
  const user_sublabel = postAuthMethods
    // TBD unresolved usernameLabel
    .map((auth) => `${auth.usernameLabel} for ${auth.label}`)
    .join(", ");
  const form = new Form({
    class: "login",
    fields: [
      new Field({
        label: req.__("E-mail"),
        name: "email",
        type: "String",
        attributes: {
          input_type: "email",
        },
        sublabel: user_sublabel || undefined,
        // fixed correct size of email is 254 https://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address
        validator: (s) => s.length < 255,
      }),
      new Field({
        label: req.__("Password"),
        name: "password",
        input_type: "password",
        attributes: {
          autocomplete: "current-password",
        },
        validator: isCreating
          ? (pw) => User.unacceptable_password_reason(pw)
          : undefined,
      }),
    ],
    action: "/auth/login",
    submitLabel: req.__("Login"),
  });
  const { dest } = req.query;
  if (dest) {
    form.hidden("dest");
    form.values.dest = encodeURIComponent(dest);
  }
  return form;
}
Login Form
@param {object} req
@param {boolean} isCreating
@returns {Form}