diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css index bd81f96..8accfad 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css @@ -1,4 +1,10 @@ body { padding-top: 20px; padding-bottom: 20px; + margin-top: 60px; +} + +input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; } \ No newline at end of file diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html index db6afcc..4360f94 100644 --- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js new file mode 100644 index 0000000..8a44cce --- /dev/null +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js @@ -0,0 +1,52 @@ +$(function() { + + $("#username").focus(); + + $("form").submit(function(event) { + event.preventDefault(); + $("[id$='-message']").hide(); + var form = { + 'username' : $("#username").val().trim(), + 'password' : $("#password").val().trim() + }; + + AuthProxy.login(form, loginOk, loginFail); + }); + +}); + +// Funções de Callback + +function loginOk(data) { + location.href = "pendencies.html"; +} + +function loginFail(request) { + + switch (request.status) { + case 401: + $("#global-message").html("Usuário ou senha inválidos.").show(); + break; + case 412: + $($("form input").get().reverse()).each(function() { + var id = $(this).attr('id'); + var message = null; + + $.each(request.responseJSON, function(index, value) { + if (id == value.property) { + message = value.message; + return; + } + }); + + if (message) { + $("#" + id + "-message").html(message).show(); + $(this).focus(); + } else { + $("#" + id + "-message").hide(); + + } + }); + break; + } +} diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js new file mode 100644 index 0000000..b9633d3 --- /dev/null +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js @@ -0,0 +1,32 @@ +var AuthProxy = {}; + +AuthProxy.url = "api/auth"; + +AuthProxy.login = function($credentials, $success, $error) { + $.ajax({ + url : this.url, + type : "POST", + data : JSON.stringify($credentials), + contentType : "application/json", + success : $success, + error : $error + }); +}; + +AuthProxy.logout = function($success, $error) { + $.ajax({ + url : this.url, + type : "DELETE", + success : $success, + error : $error + }); +}; + +AuthProxy.getUser = function($success, $error) { + $.ajax({ + url : this.url, + type : "GET", + success : $success, + error : $error + }); +}; \ No newline at end of file diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/login.html b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/login.html new file mode 100644 index 0000000..0dbc000 --- /dev/null +++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/login.html @@ -0,0 +1,46 @@ + + + + + + + Notifica | Login + + + + +
+
+
+
+

Bookmark | Login

+
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + +
+
+
+
+ + + + + + \ No newline at end of file -- libgit2 0.21.2