Commit 42b970f5e4cab8794c00e3389515e72865796be8

Authored by Luciano Borges
1 parent 39420401
Exists in master

Nome do usuário aparecendo no menu.

archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/css/bookmark.css
1 1 body {
2 2 padding-top: 20px;
3 3 padding-bottom: 20px;
4   - margin-top: 60px;
  4 + margin-top: 20px;
5 5 }
6 6  
7 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 21 </div>
22 22 <script type="text/javascript" src="js/lib/jquery-2.1.0.min.js"></script>
23 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 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 27 </body>
28 28 </html>
29 29 \ No newline at end of file
... ...
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/index.html
1 1 <html>
2 2 <head>
3   -<meta http-equiv="Refresh" content="0; URL=bookmark-list.html">
  3 +<meta http-equiv="Refresh" content="0; URL=home.html">
4 4 </head>
5 5 </html>
6 6 \ No newline at end of file
... ...
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 25  
26 26 function loginOk(data) {
27 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 31 function loginFail(request) {
... ...
archetype/html-rest/src/main/resources/archetype-resources/src/main/webapp/js/controller/menu.js
1 1 $(function() {
2   -
3 2 AuthProxy.getUser(getUserOk, getUserFailed);
4   -
5 3 });
6 4  
7 5 function getUserOk(data){
8   - console.log('getUserOk');
  6 + $("#username").html(data.username);
9 7 }
10 8  
11 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 27 url : this.url,
28 28 type : "GET",
29 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 24 </li>
25 25 </ul>
26 26 <ul class="nav navbar-nav navbar-right">
27   - <li><a href="#">[username]</a></li>
  27 + <li><a id="username" href="#"></a></li>
28 28 <li><a href="#">Sair</a></li>
29 29 </ul>
30 30 </div><!-- /.navbar-collapse -->
... ...