Display error message when login fails

This commit is contained in:
Jack 2019-02-05 11:28:58 -08:00
parent 5d12cb64e4
commit 15d50a7c50
2 changed files with 2 additions and 0 deletions

View file

@ -22,6 +22,7 @@ function postToLoginEndpoint(event) {
localStorage.setItem("token", token); localStorage.setItem("token", token);
window.location.replace("home.html"); window.location.replace("home.html");
} else { } else {
document.getElementById("errorLogin").innerHTML = "Incorrect user name or password";
console.error("LOGIN FAILURE!"); console.error("LOGIN FAILURE!");
console.error("Server status: " + this.status); console.error("Server status: " + this.status);
console.error("Server response:\n" + this.response); console.error("Server response:\n" + this.response);

View file

@ -31,6 +31,7 @@
<label for="formGroupPassword">Password:</label> <label for="formGroupPassword">Password:</label>
<input class="form-control" id="formGroupPassword" type="password" name="password" required> <input class="form-control" id="formGroupPassword" type="password" name="password" required>
</div> </div>
<p id="errorLogin" style="color:red"></p>
<button type="submit" class="btn btn-primary pull-right">Submit</button> <button type="submit" class="btn btn-primary pull-right">Submit</button>
</form> </form>
</div> </div>