From 15d50a7c50f04b8b451cdcf2904d030d24bde8fc Mon Sep 17 00:00:00 2001
From: Jack <hui2@pdx.edu>
Date: Tue, 5 Feb 2019 11:28:58 -0800
Subject: [PATCH] Display error message when login fails

---
 front/static/js/login.js | 1 +
 front/static/login.html  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/front/static/js/login.js b/front/static/js/login.js
index cdef5f4..20b411d 100644
--- a/front/static/js/login.js
+++ b/front/static/js/login.js
@@ -22,6 +22,7 @@ function postToLoginEndpoint(event) {
                 localStorage.setItem("token", token);
                 window.location.replace("home.html");
             } else {
+                document.getElementById("errorLogin").innerHTML = "Incorrect user name or password";
                 console.error("LOGIN FAILURE!");
                 console.error("Server status: " + this.status);
                 console.error("Server response:\n" + this.response);
diff --git a/front/static/login.html b/front/static/login.html
index 03938ea..9a8af2f 100644
--- a/front/static/login.html
+++ b/front/static/login.html
@@ -31,6 +31,7 @@
                                 <label for="formGroupPassword">Password:</label>
                                 <input class="form-control" id="formGroupPassword" type="password" name="password" required>
                             </div>
+                            <p id="errorLogin" style="color:red"></p>
                             <button type="submit" class="btn btn-primary pull-right">Submit</button>
                         </form>
                     </div>