Login credentials showing in url parameters in react js

Viewed 1810

I am a beginner in React JS, I created a login form and after click on login button then username and password is showing in the URL. I don't want to show this in URL. How to solve this?

Here is my code:

<form className="loginform" onSubmit={this.ValidateUser}>
  <input
    className="form-control"
    type="text"
    placeholder="Email"
    name="email"
    autocomplete="off"
    value={this.state.email}
    onChange={(e) => this.changeEmailHandler(e.target.value)}
  />
  <input
    className="form-control"
    type="password"
    placeholder="Password"
    name="password"
    value={this.state.password}
    onChange={(e) => this.changePasswordHandler(e.target.value)}
  />
  <input
    type="submit"
    id="kt_login_signin_submit"
    className="btn btn-brand"
    value="Sign In"
  />
</form>
1 Answers

Adding e.preventDefault() in ValidateUser method should do the trick.

Edit-01:

already pointed out in the comments.

Related