GitHub PullRequestReviewCommentEvent at 2014-05-14 14:00:52
Repository: endofcodes
Actor: dionyziz
Payload: {"comment":{"url":"https://api.github.com/repos/dionyziz/endofcodes/pulls/comments/12636976","id":12636976,"diff_hunk":"@@ -44,6 +44,40 @@ $( document ).ready( function() {\n         }\n     }); \n \n+    $( '#login-form' ).submit( function() {\n+        var form = $(\"#login-form\"); // or $(\"form\"), or any selector matching an element containing your input fields\n+        var username = $( \"[name='username']\", form ).val();\n+        var password = $( \"[name='password']\", form ).val();\n+        var token = $( \"[name='token']\", form ).val();\n+        if ( username == '' ) {\n+            createError( '#login-form', 'Please type a username' );\n+            return false;\n+        }\n+        if ( password == '' ) {\n+            createError( '#login-form', 'Please type a password' );\n+            return false;\n+        }\n+        $.ajax({ \n+            type: \"POST\",\n+            url: \"session/create\",\n+            data: { username: username, password: password, token: token },\n+            dataType: \"json\",\n+            async: true,\n+            statusCode: { \n+                404: function() {\n+                    createError( '#login-form', \"Username doesn't exist\" );\n+                },\n+                401: function() { \n+                    createError( '#login-form', 'Password is incorrect' );\n+                },\n+                200: function() {\n+                    window.location.replace( 'dashboard' );\n+                }\n+            }\n+        }); \n+        return false;\n+    });","path":"static/script/form_validation.js","position":36,"original_position":36,"commit_id":"b1833f8fce4d3b22845b523f39c127c04798a615","original_commit_id":"b1833f8fce4d3b22845b523f39c127c04798a615","user":{"login":"dionyziz","id":544572,"avatar_url":"https://avatars.githubusercontent.com/u/544572?","gravatar_id":"3863e7fc8ee24a35326b0a813572bd00","url":"https://api.github.com/users/dionyziz","html_url":"https://github.com/dionyziz","followers_url":"https://api.github.com/users/dionyziz/followers","following_url":"https://api.github.com/users/dionyziz/following{/other_user}","gists_url":"https://api.github.com/users/dionyziz/gists{/gist_id}","starred_url":"https://api.github.com/users/dionyziz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dionyziz/subscriptions","organizations_url":"https://api.github.com/users/dionyziz/orgs","repos_url":"https://api.github.com/users/dionyziz/repos","events_url":"https://api.github.com/users/dionyziz/events{/privacy}","received_events_url":"https://api.github.com/users/dionyziz/received_events","type":"User","site_admin":false},"body":"nit: space before `)`","created_at":"2014-05-14T14:00:52Z","updated_at":"2014-05-14T14:00:52Z","html_url":"https://github.com/dionyziz/endofcodes/pull/291#discussion_r12636976","pull_request_url":"https://api.github.com/repos/dionyziz/endofcodes/pulls/291","_links":{"self":{"href":"https://api.github.com/repos/dionyziz/endofcodes/pulls/comments/12636976"},"html":{"href":"https://github.com/dionyziz/endofcodes/pull/291#discussion_r12636976"},"pull_request":{"href":"https://api.github.com/repos/dionyziz/endofcodes/pulls/291"}}}}