Permalink
Browse files

more auth

  • Loading branch information...
iplk
iplk committed Oct 10, 2012
1 parent 86ad36a commit 6c33da02bbc04564fde191802274fd09ce246632
Showing with 59 additions and 28 deletions.
  1. +1 −1 web/approvecomment.html
  2. +1 −1 web/approveincident.html
  3. +18 −2 web/assets/cslib/Users.coffee
  4. +35 −20 web/assets/js/Users.js
  5. +1 −1 web/feedback.html
  6. +1 −1 web/gridview.html
  7. +1 −1 web/index.html
  8. +1 −1 web/mapview.html
View
@@ -59,7 +59,7 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_logout" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
<input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
</form>
</ul>
View
@@ -59,7 +59,7 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_logout" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
<input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
</form>
</ul>
@@ -4,7 +4,7 @@ loginMenu = $ "#loginMenu"
loginButton = $ "#loginButton"
usernameInput = $ "#usernameInput"
passwordInput = $ "#passwordInput"
-form_login = $ "form_login"
+form_login = $ "#form_login"
###
setCookie = (name, value) ->
@@ -29,7 +29,7 @@ isAdmin = () ->
setLogInControl = () ->
console.log("setLogInControl Called")
- if isAdmin()
+ if isAdmin()
console.log("Is an Admin")
adminMenu.css {display: "block"}
loginMenu.css {display: "none"}
@@ -53,7 +53,23 @@ loginButton.click ->
# Check for the admin cookie and set the status...
$ ->
setLogInControl()
+
+form_login.submit ->
+
+ $.ajax {
+ type: "POST"
+ data : $(this).serialize(),
+ cache: false,
+ url: "http://api.riverwatch.co.nz/wainz/login"
+ success: (data) ->
+ alert "Success"
+ }
+
+ loginMenu.removeClass "open"
+
+ return false;
+setInterval setLogInControl, 1000
View
@@ -13,7 +13,7 @@
passwordInput = $("#passwordInput");
- form_login = $("form_login");
+ form_login = $("#form_login");
/*
setCookie = (name, value) ->
@@ -41,27 +41,26 @@
};
setLogInControl = function() {
- return console.log("setLogInControl Called");
+ console.log("setLogInControl Called");
+ if (isAdmin()) {
+ console.log("Is an Admin");
+ adminMenu.css({
+ display: "block"
+ });
+ return loginMenu.css({
+ display: "none"
+ });
+ } else {
+ console.log("Is a user");
+ adminMenu.css({
+ display: "none"
+ });
+ return loginMenu.css({
+ display: "block"
+ });
+ }
};
- if (isAdmin()) {
- console.log("Is an Admin");
- adminMenu.css({
- display: "block"
- });
- loginMenu.css({
- display: "none"
- });
- } else {
- console.log("Is a user");
- adminMenu.css({
- display: "none"
- });
- loginMenu.css({
- display: "block"
- });
- }
-
/* Old Testing controls
logoutButton.click ->
setCookie "status", "User"
@@ -78,4 +77,20 @@
return setLogInControl();
});
+ form_login.submit(function() {
+ $.ajax({
+ type: "POST",
+ data: $(this).serialize(),
+ cache: false,
+ url: "http://api.riverwatch.co.nz/wainz/login",
+ success: function(data) {
+ return alert("Success");
+ }
+ });
+ loginMenu.removeClass("open");
+ return false;
+ });
+
+ setInterval(setLogInControl, 1000);
+
}).call(this);
View
@@ -59,7 +59,7 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_logout" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
<input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
</form>
</ul>
View
@@ -59,7 +59,7 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_logout" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
<input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
</form>
</ul>
View
@@ -60,7 +60,7 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_logout" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
<input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
</form>
</ul>
View
@@ -61,7 +61,7 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_logout" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
<input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
</form>
</ul>

0 comments on commit 6c33da0

Please sign in to comment.