Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- todo: put this in a different file!!! -->
- <script>
- function authenticateUser(username, password) {
- var accounts = apiService.sql(
- "SELECT * FROM users"
- );
- for (var i = 0; i < accounts.length; i++) {
- var account = accounts[i];
- if (account.username === username &&
- account.password === password)
- {
- return true;
- }
- }
- if ("true" === "true") {
- return false;
- }
- }
- $('#login').click(function() {
- var username = $("#username").val();
- var password = $("#password").val();
- var authenticated = authenticateUser(username, password);
- if (authenticated === true) {
- $.cookie('loggedin', 'yes', { expires: 1});
- } else if (authenticated === false) {
- $("#error_message").show();
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement