'DB adding characters on Inputs

I have a form on the client side in which I send data (username and password) to my DB through a socket event:

CLIENT:

     export default function RegisterForm() {
  const [user, setUser] = useState("");
  const [password, setPassword] = useState("");
  const navigate = useNavigate();

  const handleSubmit = () => {
    socket.emit("newuser", { user, password });

    navigate("/");
  };

  return (
    <>
      <div className="join-container">
        <header className="join-header">
          <h1>
            <i className="fas fa-smile"></i> Registration Page
          </h1>
        </header>
        <main className="join-main">
          <form action="chat.html">
            <div className="form-control">
              <label htmlFor="username">Username</label>
              <input
                type="text"
                name="username"
                id="username"
                value={user}
                onChange={(e) => setUser(e.target.value)}
                placeholder="Set username..."
                required
              />
            </div>
            <div className="form-control">
              <label htmlFor="password">Password</label>
              <input
                type="password"
                name="password"
                id="pasword"
                value={password}
                onChange={(e) => setPassword(e.target.value)}
                placeholder="Set new password..."
                required
              />
            </div>
          </form>
          <button type="submit" className="btn" onClick={handleSubmit}>
            Submit
          </button>
        </main>
      </div>
    </>
  );
}

SERVER:

socket.on("newuser", async (msg) => {
    try {
      Users.create({
        username: msg.user,
        password: msg.password,
      });
    } catch (err) {
      console.log(err);
    }
  });

DB MODEL:

const Users = db.define("users", {
  username: {
    type: DataTypes.STRING,
    allowNull: false,
  },
  password: {
    type: DataTypes.STRING,
    allowNull: false,
  },
});

The problem is that when I submit the password, it stores blanck carachters. For example If "1234" password is submited, on the DB I see "1234----------"

"-" are blank spaces

What could be the problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source