Commit 42b970f5e4cab8794c00e3389515e72865796be8
1 parent
39420401
Exists in
master
Nome do usuário aparecendo no menu.
Showing
7 changed files
with
11 additions
and
10 deletions
Show diff stats
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css
1 | body { | 1 | body { |
2 | padding-top: 20px; | 2 | padding-top: 20px; |
3 | padding-bottom: 20px; | 3 | padding-bottom: 20px; |
4 | - margin-top: 60px; | 4 | + margin-top: 20px; |
5 | } | 5 | } |
6 | 6 | ||
7 | input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button { | 7 | input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button { |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/home.html
@@ -21,8 +21,8 @@ | @@ -21,8 +21,8 @@ | ||
21 | </div> | 21 | </div> |
22 | <script type="text/javascript" src="js/lib/jquery-2.1.0.min.js"></script> | 22 | <script type="text/javascript" src="js/lib/jquery-2.1.0.min.js"></script> |
23 | <script type="text/javascript" src="js/lib/bootstrap.min.js"></script> | 23 | <script type="text/javascript" src="js/lib/bootstrap.min.js"></script> |
24 | - <script type="text/javascript" src="js/controller/menu.js"></script> | ||
25 | - <script type="text/javascript" src="js/controller/home.js"></script> | ||
26 | <script type="text/javascript" src="js/proxy/auth.js"></script> | 24 | <script type="text/javascript" src="js/proxy/auth.js"></script> |
25 | + <script type="text/javascript" src="js/controller/home.js"></script> | ||
26 | + <script type="text/javascript" src="js/controller/menu.js"></script> | ||
27 | </body> | 27 | </body> |
28 | </html> | 28 | </html> |
29 | \ No newline at end of file | 29 | \ No newline at end of file |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/login.js
@@ -25,7 +25,7 @@ function make_base_auth(user, password) { | @@ -25,7 +25,7 @@ function make_base_auth(user, password) { | ||
25 | 25 | ||
26 | function loginOk(data) { | 26 | function loginOk(data) { |
27 | sessionStorage.setItem('credentials', make_base_auth($("#username").val().trim(), $("#password").val().trim())); | 27 | sessionStorage.setItem('credentials', make_base_auth($("#username").val().trim(), $("#password").val().trim())); |
28 | - location.href = "bookmark-list.html"; | 28 | + location.href = "home.html"; |
29 | } | 29 | } |
30 | 30 | ||
31 | function loginFail(request) { | 31 | function loginFail(request) { |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/menu.js
1 | $(function() { | 1 | $(function() { |
2 | - | ||
3 | AuthProxy.getUser(getUserOk, getUserFailed); | 2 | AuthProxy.getUser(getUserOk, getUserFailed); |
4 | - | ||
5 | }); | 3 | }); |
6 | 4 | ||
7 | function getUserOk(data){ | 5 | function getUserOk(data){ |
8 | - console.log('getUserOk'); | 6 | + $("#username").html(data.username); |
9 | } | 7 | } |
10 | 8 | ||
11 | function getUserFailed(request){ | 9 | function getUserFailed(request){ |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/proxy/auth.js
@@ -27,7 +27,10 @@ AuthProxy.getUser = function($success, $error) { | @@ -27,7 +27,10 @@ AuthProxy.getUser = function($success, $error) { | ||
27 | url : this.url, | 27 | url : this.url, |
28 | type : "GET", | 28 | type : "GET", |
29 | success : $success, | 29 | success : $success, |
30 | - error : $error | 30 | + error : $error, |
31 | + beforeSend : function(xhr) { | ||
32 | + xhr.setRequestHeader("Authorization", AuthProxy.getCredentials()); | ||
33 | + } | ||
31 | }); | 34 | }); |
32 | }; | 35 | }; |
33 | 36 |
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/menu.html
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | </li> | 24 | </li> |
25 | </ul> | 25 | </ul> |
26 | <ul class="nav navbar-nav navbar-right"> | 26 | <ul class="nav navbar-nav navbar-right"> |
27 | - <li><a href="#">[username]</a></li> | 27 | + <li><a id="username" href="#"></a></li> |
28 | <li><a href="#">Sair</a></li> | 28 | <li><a href="#">Sair</a></li> |
29 | </ul> | 29 | </ul> |
30 | </div><!-- /.navbar-collapse --> | 30 | </div><!-- /.navbar-collapse --> |