diff --git a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/bookmark-edit.js b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/bookmark-edit.js
index 578aad2..75d4b55 100644
--- a/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/bookmark-edit.js
+++ b/archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/bookmark-edit.js
@@ -63,6 +63,9 @@ function saveOk(data) {
function saveFailed(request) {
switch (request.status) {
+ case 401:
+ alert('Você não está autenticado.');
+ break;
case 412:
$($("form input").get().reverse()).each(function() {
var id = $(this).attr('id');
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
index 8a44cce..7e40565 100644
--- 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
@@ -15,14 +15,23 @@ $(function() {
});
+// Função utilitária
+function make_base_auth(user, password) {
+ var tok = user + ':' + password;
+ var hash = btoa(tok);
+ return "Basic " + hash;
+}
+
// Funções de Callback
function loginOk(data) {
- location.href = "pendencies.html";
+ sessionStorage.setItem('credential',
+ make_base_auth($("#username").val().trim(), $("#password").val().trim()));
+ location.href = "bookmark-list.html";
}
function loginFail(request) {
-
+ sessionStorage.clear();
switch (request.status) {
case 401:
$("#global-message").html("Usuário ou senha inválidos.").show();
--
libgit2 0.21.2