aboutsummaryrefslogtreecommitdiffstats
path: root/csci4131/hw7/login.html
diff options
context:
space:
mode:
authorMatthew Strapp <msattr@gmail.com>2021-04-29 12:08:29 -0500
committerMatthew Strapp <msattr@gmail.com>2021-04-29 12:08:29 -0500
commitcb0d7de098f482ba667029f266dd286eab1795b6 (patch)
treed267c42f6ce9bb9461a53104185c5e32043f548d /csci4131/hw7/login.html
parentFix styling (diff)
downloadhomework-cb0d7de098f482ba667029f266dd286eab1795b6.tar
homework-cb0d7de098f482ba667029f266dd286eab1795b6.tar.gz
homework-cb0d7de098f482ba667029f266dd286eab1795b6.tar.bz2
homework-cb0d7de098f482ba667029f266dd286eab1795b6.tar.lz
homework-cb0d7de098f482ba667029f266dd286eab1795b6.tar.xz
homework-cb0d7de098f482ba667029f266dd286eab1795b6.tar.zst
homework-cb0d7de098f482ba667029f266dd286eab1795b6.zip
Add HW6 files
Diffstat (limited to 'csci4131/hw7/login.html')
-rw-r--r--csci4131/hw7/login.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/csci4131/hw7/login.html b/csci4131/hw7/login.html
new file mode 100644
index 0000000..9bb80cc
--- /dev/null
+++ b/csci4131/hw7/login.html
@@ -0,0 +1,48 @@
+<html>
+
+<head>
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
+ <script src="https://code.jquery.com/jquery-2.2.4.min.js"integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
+</head>
+
+<body>
+ <div class="jumbotron" style="background: DarkSeaGreen !important">
+ <h1>Login Page</h1>
+ <div id="error"></div>
+ <br><br>
+ <form id="myForm" name="myForm" style="list-style-type:none">
+ <div>
+ <label for="login">login:</label>
+ <input type="text" id="login" name="login" required>
+ </div>
+ <div>
+ <label for="password">password:</label>
+ <input id="password" name="password" type="password" required>
+ </div>
+ <input type="submit"value="Submit!">
+ </form>
+ </div>
+ <script>
+ //jQuery below. Tread with caution as sneezing near here may rupture the fabric of reality.
+ $(document).ready(function () {
+ $('#myForm').submit(function (event) {
+ event.preventDefault();//collect the form data using Id Selector for whatever data you need to send to server
+ let login=$('#login').val();
+ let password=$('#password').val();
+ $.post('api/login',
+ {"login": login,"password": password},
+ (data) => {
+ if(data.status === 'success'){
+ //pseudo code
+ //Make sure error message is not displayed
+ //Re-direct to contacts page,
+ window.location.href='contacts';}
+ else{
+ //Display error message
+ $('#error').html("<b>Login failed. Please try again.</b>")
+ }});
+ });
+ });</script>
+
+</html>