Commit 115e3f68004a77c08d7e8ccfa5e69002e27283f9
1 parent
303fdc72
amélioration du frontend
Ajout d'une page afin qu'un utilisateur avec le role ADMIN puisse voir la liste des utilisateurs existants dans la BDD
Showing
12 changed files
with
312 additions
and
95 deletions
Show diff stats
@@ -0,0 +1,36 @@ | @@ -0,0 +1,36 @@ | ||
1 | +<!DOCTYPE html> | ||
2 | +<html lang="fr"> | ||
3 | + <head> | ||
4 | + <title>Bootstrap template</title> | ||
5 | + <meta charset="utf-8"> | ||
6 | + <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
7 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
8 | + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | ||
9 | + </head> | ||
10 | + <body> | ||
11 | + <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> | ||
12 | + <a class="navbar-brand" href="#">Accueil</a> | ||
13 | + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> | ||
14 | + <span class="navbar-toggler-icon"></span> | ||
15 | + </button> | ||
16 | + <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> | ||
17 | + <div class="navbar-nav"> | ||
18 | + <a class="nav-item nav-link active" href="#">Home <span class="sr-only">(current)</span></a> | ||
19 | + <a class="nav-item nav-link" href="#">Features</a> | ||
20 | + <a class="nav-item nav-link" href="#">Pricing</a> | ||
21 | + <li class="nav-item dropdown"> | ||
22 | + <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Options</a> | ||
23 | + <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> | ||
24 | + <a class="dropdown-item" href="#">Ajouter des utilisateurs</a> | ||
25 | + <a class="dropdown-item" href="#">A ajouter...</a> | ||
26 | + </div> | ||
27 | + </li> | ||
28 | + <a class="nav-item nav-link disabled" href="#">Documentations</a> | ||
29 | + </div> | ||
30 | + </div> | ||
31 | + </nav> | ||
32 | + <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | ||
33 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> | ||
34 | + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> | ||
35 | + </body> | ||
36 | +</html> | ||
0 | \ No newline at end of file | 37 | \ No newline at end of file |
PFE06/src/main/java/com/PFE/ServerManager/CustomerRepository.java
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository; | @@ -10,7 +10,7 @@ import org.springframework.stereotype.Repository; | ||
10 | //This class allows the JPA to know that the Customer class is a table | 10 | //This class allows the JPA to know that the Customer class is a table |
11 | //Need to check if "extends JpaRepository is more useful" | 11 | //Need to check if "extends JpaRepository is more useful" |
12 | @Repository | 12 | @Repository |
13 | -public interface CustomerRepository extends CrudRepository<Customer, Integer> { | 13 | +public interface CustomerRepository extends JpaRepository<Customer, Integer> { |
14 | 14 | ||
15 | Customer findByPseudo(String pseudo); | 15 | Customer findByPseudo(String pseudo); |
16 | 16 |
PFE06/src/main/java/com/PFE/ServerManager/MainController.java
@@ -3,19 +3,17 @@ package com.PFE.ServerManager; | @@ -3,19 +3,17 @@ package com.PFE.ServerManager; | ||
3 | import org.springframework.beans.factory.annotation.Autowired; | 3 | import org.springframework.beans.factory.annotation.Autowired; |
4 | import org.springframework.http.HttpStatus; | 4 | import org.springframework.http.HttpStatus; |
5 | import org.springframework.stereotype.Controller; | 5 | import org.springframework.stereotype.Controller; |
6 | -import org.springframework.ui.ModelMap; | ||
7 | import org.springframework.web.bind.annotation.*; | 6 | import org.springframework.web.bind.annotation.*; |
8 | import org.springframework.web.multipart.MultipartFile; | 7 | import org.springframework.web.multipart.MultipartFile; |
9 | import org.springframework.web.servlet.ModelAndView; | 8 | import org.springframework.web.servlet.ModelAndView; |
10 | 9 | ||
11 | import java.io.*; | 10 | import java.io.*; |
12 | import java.sql.Timestamp; | 11 | import java.sql.Timestamp; |
13 | -import java.util.Arrays; | ||
14 | -import java.util.HashSet; | 12 | +import java.util.*; |
13 | + | ||
15 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | 14 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
16 | import org.springframework.security.core.context.SecurityContextHolder; | 15 | import org.springframework.security.core.context.SecurityContextHolder; |
17 | import org.springframework.security.core.Authentication; | 16 | import org.springframework.security.core.Authentication; |
18 | -import org.springframework.web.context.request.RequestContextHolder; | ||
19 | 17 | ||
20 | import javax.servlet.annotation.MultipartConfig; | 18 | import javax.servlet.annotation.MultipartConfig; |
21 | 19 | ||
@@ -54,6 +52,7 @@ public class MainController { | @@ -54,6 +52,7 @@ public class MainController { | ||
54 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | 52 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); |
55 | Customer customer = customerRepository.findByPseudo(auth.getName()); | 53 | Customer customer = customerRepository.findByPseudo(auth.getName()); |
56 | modelAndView.addObject("customerName", customer.getPseudo()); | 54 | modelAndView.addObject("customerName", customer.getPseudo()); |
55 | + modelAndView.addObject("customerRole", customer.getRole()); | ||
57 | modelAndView.setViewName("registration"); | 56 | modelAndView.setViewName("registration"); |
58 | return modelAndView; | 57 | return modelAndView; |
59 | } | 58 | } |
@@ -75,7 +74,13 @@ public class MainController { | @@ -75,7 +74,13 @@ public class MainController { | ||
75 | Customer temp = customerRepository.findByPseudo(pseudo); | 74 | Customer temp = customerRepository.findByPseudo(pseudo); |
76 | Role userRole = roleRepository.findByRole(role); | 75 | Role userRole = roleRepository.findByRole(role); |
77 | n.setRoles(new HashSet<Role>(Arrays.asList(userRole))); | 76 | n.setRoles(new HashSet<Role>(Arrays.asList(userRole))); |
78 | - | 77 | + //utilisé uniquement pour continuer à afficher l'utilisateur connecté// |
78 | + Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | ||
79 | + Customer customer = customerRepository.findByPseudo(auth.getName()); | ||
80 | + modelAndView.addObject("customerName", customer.getPseudo()); | ||
81 | + modelAndView.addObject("customerRole", customer.getRole()); | ||
82 | + modelAndView.setViewName("registration"); | ||
83 | + /////// | ||
79 | if(temp != null) { | 84 | if(temp != null) { |
80 | modelAndView.addObject("ok", "l'utilisateur existe déjà"); | 85 | modelAndView.addObject("ok", "l'utilisateur existe déjà"); |
81 | } | 86 | } |
@@ -140,11 +145,31 @@ public class MainController { | @@ -140,11 +145,31 @@ public class MainController { | ||
140 | return modelAndView; | 145 | return modelAndView; |
141 | } | 146 | } |
142 | 147 | ||
143 | - @GetMapping(path="/all") | 148 | + /*@GetMapping(path="/all") |
144 | public @ResponseBody Iterable<Customer> getAllUsers() { | 149 | public @ResponseBody Iterable<Customer> getAllUsers() { |
145 | return customerRepository.findAll(); | 150 | return customerRepository.findAll(); |
151 | + }*/ | ||
152 | + @GetMapping(path="/all") | ||
153 | + public ModelAndView getAllUsers() { | ||
154 | + ModelAndView modelAndView = new ModelAndView(); | ||
155 | + modelAndView.setViewName("all"); | ||
156 | + | ||
157 | + Authentication auth = SecurityContextHolder.getContext().getAuthentication(); | ||
158 | + Customer customer = customerRepository.findByPseudo(auth.getName()); | ||
159 | + modelAndView.addObject("customerName", customer.getPseudo()); | ||
160 | + modelAndView.addObject("customerRole", customer.getRole()); | ||
161 | + | ||
162 | + /*List<Customer> list = new ArrayList<Customer>(); | ||
163 | + Iterator<Customer> listIterator = customerRepository.findAll().iterator(); | ||
164 | + while (listIterator.hasNext()) { | ||
165 | + list.add(listIterator.next()); | ||
166 | + }*/ | ||
167 | + List<Customer> list = customerRepository.findAll(); // attention : la méthode findAll() de JpaRepository retourne une liste alors que celle de CrudRepository retourne un itérable | ||
168 | + modelAndView.addObject("list",list); | ||
169 | + return modelAndView; | ||
146 | } | 170 | } |
147 | 171 | ||
172 | + | ||
148 | @GetMapping(value="/success") | 173 | @GetMapping(value="/success") |
149 | public String success(){ | 174 | public String success(){ |
150 | return "success"; | 175 | return "success"; |
PFE06/src/main/java/com/PFE/ServerManager/SecurityConfig.java
@@ -36,6 +36,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { | @@ -36,6 +36,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { | ||
36 | .authorizeRequests() | 36 | .authorizeRequests() |
37 | .antMatchers("/home").hasAnyAuthority("USER","ADMIN") | 37 | .antMatchers("/home").hasAnyAuthority("USER","ADMIN") |
38 | .antMatchers("/registration").hasAuthority("ADMIN") | 38 | .antMatchers("/registration").hasAuthority("ADMIN") |
39 | + .antMatchers("/all").hasAuthority("ADMIN") | ||
39 | .antMatchers("/login").permitAll() | 40 | .antMatchers("/login").permitAll() |
40 | .antMatchers("/denied").permitAll() | 41 | .antMatchers("/denied").permitAll() |
41 | .antMatchers("/css/**", "/js/**").permitAll() | 42 | .antMatchers("/css/**", "/js/**").permitAll() |
PFE06/src/main/resources/application.properties
@@ -8,9 +8,9 @@ spring.jpa.hibernate.ddl-auto=create | @@ -8,9 +8,9 @@ spring.jpa.hibernate.ddl-auto=create | ||
8 | #"update" met à jour la base données | 8 | #"update" met à jour la base données |
9 | 9 | ||
10 | #Postgres config : | 10 | #Postgres config : |
11 | -spring.datasource.url=jdbc:postgresql://localhost:3306/sql_only | 11 | +spring.datasource.url=jdbc:postgresql://localhost:5432/sql_only |
12 | spring.datasource.username=postgres | 12 | spring.datasource.username=postgres |
13 | -spring.datasource.password=admin | 13 | +spring.datasource.password=idalurf123 |
14 | 14 | ||
15 | 15 | ||
16 | # montre les communications JPA avec la BDD | 16 | # montre les communications JPA avec la BDD |
PFE06/src/main/resources/static/css/home.css
1 | body { background-color: #FFF; } | 1 | body { background-color: #FFF; } |
2 | - | 2 | +/* |
3 | .upload-drop-zone { | 3 | .upload-drop-zone { |
4 | height: 200px; | 4 | height: 200px; |
5 | border-width: 2px; | 5 | border-width: 2px; |
@@ -9,4 +9,23 @@ body { background-color: #FFF; } | @@ -9,4 +9,23 @@ body { background-color: #FFF; } | ||
9 | border-color: #ccc; | 9 | border-color: #ccc; |
10 | line-height: 200px; | 10 | line-height: 200px; |
11 | text-align: center | 11 | text-align: center |
12 | +}*/ | ||
13 | +/* | ||
14 | +body { | ||
15 | + padding-top: 70px; | ||
16 | + padding-bottom: 30px; | ||
17 | +}*/ | ||
18 | + | ||
19 | +.theme-dropdown .dropdown-menu { | ||
20 | + position: static; | ||
21 | + display: block; | ||
22 | + margin-bottom: 20px; | ||
23 | +} | ||
24 | + | ||
25 | +.theme-showcase > p > .btn { | ||
26 | + margin: 5px 0; | ||
27 | +} | ||
28 | + | ||
29 | +.theme-showcase .navbar .container { | ||
30 | + width: auto; | ||
12 | } | 31 | } |
PFE06/src/main/resources/static/css/registration.css
0 → 100644
@@ -0,0 +1,61 @@ | @@ -0,0 +1,61 @@ | ||
1 | +body { background-color: #E9EEF2; } | ||
2 | + | ||
3 | +.form-heading { color:#fff; font-size:23px; } | ||
4 | + | ||
5 | +.panel h2{ color:#444444; font-size:18px; margin:0 0 8px 0; } | ||
6 | + | ||
7 | +.panel p { color:#777777; font-size:14px; margin-bottom:30px; line-height:24px; } | ||
8 | + | ||
9 | +.login-form .form-control { | ||
10 | + background: #f7f7f7 none repeat scroll 0 0; | ||
11 | + border: 1px solid #d4d4d4; | ||
12 | + border-radius: 4px; | ||
13 | + font-size: 14px; | ||
14 | + height: 50px; | ||
15 | + line-height: 50px; | ||
16 | +} | ||
17 | + | ||
18 | +.main-div { | ||
19 | + background: #ffffff none repeat scroll 0 0; | ||
20 | + border-radius: 5px; | ||
21 | + margin: 50px auto; | ||
22 | + max-width: 38%; | ||
23 | + padding: 50px 70px 70px 71px; | ||
24 | +} | ||
25 | + | ||
26 | +.login-form .form-group { | ||
27 | + margin-bottom:10px; | ||
28 | +} | ||
29 | + | ||
30 | +.login-form { text-align:center;} | ||
31 | + | ||
32 | +.forgot a { | ||
33 | + color: #777777; | ||
34 | + font-size: 14px; | ||
35 | + text-decoration: underline; | ||
36 | +} | ||
37 | +.login-form .btn.btn-primary { | ||
38 | + background: #f0ad4e none repeat scroll 0 0; | ||
39 | + border-color: #f0ad4e; | ||
40 | + color: #ffffff; | ||
41 | + font-size: 14px; | ||
42 | + width: 100%; | ||
43 | + height: 50px; | ||
44 | + line-height: 50px; | ||
45 | + padding: 0; | ||
46 | +} | ||
47 | + | ||
48 | +.login-form .btn.btn-primary.reset { | ||
49 | + background: #ff9900 none repeat scroll 0 0; | ||
50 | +} | ||
51 | + | ||
52 | + | ||
53 | +.back { text-align: left; margin-top:10px; } | ||
54 | + | ||
55 | +.back a {color: #444444; font-size: 13px;text-decoration: none;} | ||
56 | + | ||
57 | +.dropdown-item.active{ | ||
58 | + background-color: #ffffff !important; | ||
59 | + color:#212529 !important; | ||
60 | + font-weight: bold !important; | ||
61 | +} | ||
0 | \ No newline at end of file | 62 | \ No newline at end of file |
@@ -0,0 +1,63 @@ | @@ -0,0 +1,63 @@ | ||
1 | +<!DOCTYPE html> | ||
2 | +<html xmlns:th="http://www.thymeleaf.org"> | ||
3 | +<head> | ||
4 | + | ||
5 | + <meta charset="utf-8"> | ||
6 | + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
7 | + | ||
8 | + <link rel="stylesheet" th:href="@{/css/all.css}"> | ||
9 | + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | ||
10 | + | ||
11 | + <title>Listes des utilisateurs dans la base de donnée</title> | ||
12 | +</head> | ||
13 | +<body> | ||
14 | + | ||
15 | +<div id="app"> | ||
16 | + <!-- NAV BAR --> | ||
17 | + <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> | ||
18 | + <span class="navbar-brand"> votre identifiant : <span th:text="${customerName}" th:remove="tag">Documentations</span></span> | ||
19 | + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> | ||
20 | + <span class="navbar-toggler-icon"></span> | ||
21 | + </button> | ||
22 | + <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> | ||
23 | + <div class="navbar-nav"> | ||
24 | + <a class="nav-item nav-link" th:href="@{/home}">Gestion des noeuds</a> | ||
25 | + <a class="nav-item nav-link" th:href="@{/logout}">Déconnexion</a> | ||
26 | + <li class="nav-item dropdown"> | ||
27 | + <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Options</a> | ||
28 | + <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> | ||
29 | + <div th:switch="${customerRole}"> | ||
30 | + <div th:case="'ADMIN'"> | ||
31 | + <a class="dropdown-item" th:href="@{/registration}">Enregistrer des utilisateurs</a> | ||
32 | + <a class="dropdown-item active" th:href="@{/all}">Listes des utilisateurs</a></div> | ||
33 | + <div th:case="'USER'"></div> | ||
34 | + </div> | ||
35 | + <a class="dropdown-item" href="#">A ajouter...</a> | ||
36 | + </div> | ||
37 | + </li> | ||
38 | + <a class="nav-item nav-link disabled" href="#">Documentations</a> | ||
39 | + </div> | ||
40 | + </div> | ||
41 | + </nav> | ||
42 | + | ||
43 | + <!-- TABLE PART --> | ||
44 | + <table class="table"> | ||
45 | + <tr> | ||
46 | + <th scope="col">Pseudo</th> | ||
47 | + <th scope="col">Role</th> | ||
48 | + <th scope="col">Id</th> | ||
49 | + </tr> | ||
50 | + <tr th:each="prod : ${list}"> | ||
51 | + <td th:text="${prod.pseudo}">pseudo</td> | ||
52 | + <td th:text="${prod.getRole()}">role</td> | ||
53 | + <td th:text="${prod.customer_id}">id</td> | ||
54 | + </tr> | ||
55 | + </table> | ||
56 | +</div> | ||
57 | + | ||
58 | +<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> | ||
59 | +<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | ||
60 | +<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> | ||
61 | +<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> | ||
62 | +</body> | ||
63 | +</html> |
PFE06/src/main/resources/templates/home.html
1 | -<!-- | ||
2 | - | ||
3 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
4 | <html xmlns:th="http://www.thymeleaf.org"> | 2 | <html xmlns:th="http://www.thymeleaf.org"> |
5 | <html lang="en"> | 3 | <html lang="en"> |
6 | -<head> | ||
7 | - <meta charset="UTF-8"> | ||
8 | - <title>Page d'accueil</title> | ||
9 | -</head> | ||
10 | -<body> | ||
11 | - | ||
12 | -<div th:switch="${customerRole}"> | ||
13 | - <div th:case="'ADMIN'"><a th:href="@{/registration}">Enregistrer des utilisateurs</a></div> | ||
14 | - <div th:case="'USER'"></div> | ||
15 | -</div> | ||
16 | -<form th:action="@{/logout}" method="GET"> | ||
17 | - <button type="Submit">Logout </button> | ||
18 | -</form> | ||
19 | - | ||
20 | -<h1><span th:text="${customerName}" th:remove="tag"></span> est connecté(e) !</h1> | ||
21 | - | ||
22 | -</body> | ||
23 | -</html> | ||
24 | - | ||
25 | ---> | ||
26 | - | ||
27 | -<html xmlns:th="http://www.thymeleaf.org"> | ||
28 | -<html lang="en"> | ||
29 | <head> | 4 | <head> |
30 | 5 | ||
31 | <meta charset="utf-8"> | 6 | <meta charset="utf-8"> |
32 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | 7 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
33 | - | ||
34 | - <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> | ||
35 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | 8 | <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> |
9 | + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> | ||
10 | + | ||
36 | <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css"> | 11 | <link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css"> |
37 | <link rel="stylesheet" href="https://cdn.datatables.net/select/1.2.7/css/select.dataTables.min.css"> | 12 | <link rel="stylesheet" href="https://cdn.datatables.net/select/1.2.7/css/select.dataTables.min.css"> |
38 | <link rel="stylesheet" th:href="@{/css/home.css}"> | 13 | <link rel="stylesheet" th:href="@{/css/home.css}"> |
39 | - | ||
40 | <title>Accueil</title> | 14 | <title>Accueil</title> |
41 | </head> | 15 | </head> |
42 | - <body> | ||
43 | 16 | ||
17 | + <body> | ||
44 | <div id="app"> | 18 | <div id="app"> |
45 | - | ||
46 | - <nav class="navbar navbar-expand-sm bg-dark navbar-dark justify-content-end" style="padding:15px; margin-bottom:50px;"> | ||
47 | - <a class="navbar-brand" href="#"><i class="fa fa-home" style="margin-right:10px;"></i>Gestion des noeuds</a> | ||
48 | - <a class="btn btn-danger ml-auto mr-2" th:href="@{/logout}"><i class="fa fa-sign-out-alt" style="margin-right:7px;"></i>Déconnexion</a> | ||
49 | - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"> | ||
50 | - <span class="navbar-toggler-icon"></span> | ||
51 | - </button> | ||
52 | - <div class="collapse navbar-collapse flex-grow-0" id="navbarSupportedContent"> | ||
53 | - <ul class="navbar-nav text-right"> | ||
54 | - <li class="nav-item active"> | ||
55 | - <a class="nav-link" th:href="@{/registration}"><i class="fa fa-cog" style="margin-right:7px;"></i>Paramètres</a> | ||
56 | - </li> | ||
57 | - </ul> | ||
58 | - </div> | ||
59 | - </nav> | 19 | + <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> |
20 | + <span class="navbar-brand"> votre identifiant : <span th:text="${customerName}" th:remove="tag">Documentations</span></span> | ||
21 | + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> | ||
22 | + <span class="navbar-toggler-icon"></span> | ||
23 | + </button> | ||
24 | + <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> | ||
25 | + <div class="navbar-nav"> | ||
26 | + <a class="nav-item nav-link active" th:href="@{/home}">Gestion des noeuds <span class="sr-only">(current)</span></a> | ||
27 | + <a class="nav-item nav-link" th:href="@{/logout}">Déconnexion</a> | ||
28 | + <li class="nav-item dropdown"> | ||
29 | + <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Options</a> | ||
30 | + <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> | ||
31 | + <div th:switch="${customerRole}"> | ||
32 | + <div th:case="'ADMIN'"> | ||
33 | + <a class="dropdown-item" th:href="@{/registration}">Enregistrer des utilisateurs</a> | ||
34 | + <a class="dropdown-item" th:href="@{/all}">Listes des utilisateurs</a> | ||
35 | + </div> | ||
36 | + <div th:case="'USER'"></div> | ||
37 | + </div> | ||
38 | + <a class="dropdown-item" href="#">A ajouter...</a> | ||
39 | + </div> | ||
40 | + </li> | ||
41 | + <a class="nav-item nav-link disabled" href="#">Documentations</a> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | + </nav> | ||
60 | 45 | ||
61 | <div class="container" style="padding-bottom: 50px;"> | 46 | <div class="container" style="padding-bottom: 50px;"> |
62 | - | ||
63 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Choix des noeuds</h1> | 47 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Choix des noeuds</h1> |
64 | - | ||
65 | <table id="nodes-table" class="table table-striped table-bordered dt-responsive nowrap"> | 48 | <table id="nodes-table" class="table table-striped table-bordered dt-responsive nowrap"> |
66 | <thead> | 49 | <thead> |
67 | <tr> | 50 | <tr> |
@@ -166,31 +149,21 @@ | @@ -166,31 +149,21 @@ | ||
166 | <td>Software Engineer</td> | 149 | <td>Software Engineer</td> |
167 | <td>London</td> | 150 | <td>London</td> |
168 | </tr> | 151 | </tr> |
169 | - | ||
170 | </tbody> | 152 | </tbody> |
171 | </table> | 153 | </table> |
172 | - | ||
173 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Uploader un fichier</h1> | 154 | <h1 style="margin-bottom:50px; margin-top:50px; border-bottom:1px solid #CCC; padding-bottom:20px;">Uploader un fichier</h1> |
174 | - | ||
175 | <div class="panel panel-default"> | 155 | <div class="panel panel-default"> |
176 | - | ||
177 | <h4>Choix du fichier</h4> | 156 | <h4>Choix du fichier</h4> |
178 | - | ||
179 | <input id="filesExplorer" type="file" style="display:none"></input> | 157 | <input id="filesExplorer" type="file" style="display:none"></input> |
180 | <div class="upload-drop-zone" id="drop-zone"> | 158 | <div class="upload-drop-zone" id="drop-zone"> |
181 | Clic ou dépose un fichier ici | 159 | Clic ou dépose un fichier ici |
182 | </div> | 160 | </div> |
183 | - | ||
184 | <div class="progress"> | 161 | <div class="progress"> |
185 | <div id="file-progress" class="progress-bar" role="progressbar" style="width: 75%; display:none">25%</div> | 162 | <div id="file-progress" class="progress-bar" role="progressbar" style="width: 75%; display:none">25%</div> |
186 | </div> | 163 | </div> |
187 | - | ||
188 | </div> | 164 | </div> |
189 | - | ||
190 | <button id="sendButton" type="button" class="btn btn-secondary btn-lg btn-block"style="margin-top:50px;">Envoyer</button> | 165 | <button id="sendButton" type="button" class="btn btn-secondary btn-lg btn-block"style="margin-top:50px;">Envoyer</button> |
191 | - | ||
192 | </div> | 166 | </div> |
193 | - | ||
194 | </div> | 167 | </div> |
195 | 168 | ||
196 | <div class="modal fade" id="warningFilesNumber" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> | 169 | <div class="modal fade" id="warningFilesNumber" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true"> |
@@ -213,7 +186,6 @@ | @@ -213,7 +186,6 @@ | ||
213 | </div> | 186 | </div> |
214 | 187 | ||
215 | </div> | 188 | </div> |
216 | - | ||
217 | <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | 189 | <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> |
218 | <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> | 190 | <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> |
219 | <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> | 191 | <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> |
PFE06/src/main/resources/templates/registration.html
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html xmlns:th="http://www.thymeleaf.org"> | 2 | <html xmlns:th="http://www.thymeleaf.org"> |
3 | +<html lang="fr"> | ||
3 | <head> | 4 | <head> |
4 | - <title>Ajout d'utilisateurs</title> | ||
5 | - <meta charset="utf-8"/> | 5 | + <title>Enregistrement de nouveaux utilisateurs</title> |
6 | + <meta charset="utf-8"> | ||
7 | + <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
8 | + <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
9 | + <link rel="stylesheet" th:href="@{/css/registration.css}"> | ||
10 | + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> | ||
6 | </head> | 11 | </head> |
7 | <body> | 12 | <body> |
8 | -<div> | ||
9 | - <h1><span th:text="${customerName}" th:remove="tag"></span> est connecté(e) !</h1> | ||
10 | - <h5>Ajout d'utilisateurs :</h5> | ||
11 | - <form th:action="@{/registration}" method="POST"> | ||
12 | - <div class="form1"> | ||
13 | - <label for="username">User Name: </label> | ||
14 | - <input type="text" id="username" placeholder="Enter UserName" name="pseudo"/> | 13 | + <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> |
14 | + <span class="navbar-brand"> votre identifiant : <span th:text="${customerName}" th:remove="tag">Documentations</span></span> | ||
15 | + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> | ||
16 | + <span class="navbar-toggler-icon"></span> | ||
17 | + </button> | ||
18 | + <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> | ||
19 | + <div class="navbar-nav"> | ||
20 | + <!--<a class="nav-item nav-link active" th:href="@{/registration}">Enregistrer des utilisateurs <span class="sr-only">(current)</span></a>--> | ||
21 | + <a class="nav-item nav-link" th:href="@{/home}">Gestion des noeuds</a> | ||
22 | + <a class="nav-item nav-link" th:href="@{/logout}">Déconnexion</a> | ||
23 | + <li class="nav-item dropdown"> | ||
24 | + <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Options</a> | ||
25 | + <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> | ||
26 | + <div th:switch="${customerRole}"> | ||
27 | + <div th:case="'ADMIN'"> | ||
28 | + <a class="dropdown-item active" th:href="@{/registration}">Enregistrer des utilisateurs</a> | ||
29 | + <a class="dropdown-item" th:href="@{/all}">Listes des utilisateurs</a></div> | ||
30 | + <div th:case="'USER'"></div> | ||
31 | + </div> | ||
32 | + <a class="dropdown-item" href="#">A ajouter...</a> | ||
33 | + </div> | ||
34 | + </li> | ||
35 | + <a class="nav-item nav-link disabled" href="#">Documentations</a> | ||
36 | + </div> | ||
15 | </div> | 37 | </div> |
16 | - <div class="form2"> | ||
17 | - <label for="password">Password: </label> | ||
18 | - <input type="password" id="password" placeholder="Enter Password" name="password"/> | ||
19 | - </div> | ||
20 | - <div class="form3"> | ||
21 | - <input type="radio" id="role1" name="role" value="ADMIN"> | ||
22 | - <label for="role1">Admin</label> | 38 | + </nav> |
39 | + <div class="login-form"> | ||
40 | + <div class="main-div"> | ||
41 | + <div class="panel"> | ||
42 | + <h2>Formulaire d'ajout</h2> | ||
43 | + <p>Merci d'entrer le login et le mot de passe du nouvel utilisateur</p> | ||
44 | + </div> | ||
45 | + <form id="Login" th:action="@{/registration}" method="POST"> | ||
46 | + <div class="form-group"> | ||
47 | + <input type="text" v-model="user.login" class="form-control" id="username" placeholder="Enter UserName" name="pseudo"> | ||
48 | + </div> | ||
49 | + <div class="form-group"> | ||
50 | + <input type="password" v-model="user.password" class="form-control" id="password" placeholder="Enter Password" name="password"> | ||
51 | + </div> | ||
52 | + <div class="form3"> | ||
53 | + <input type="radio" id="role1" name="role" value="ADMIN"> | ||
54 | + <label for="role1">Admin</label> | ||
23 | 55 | ||
24 | - <input type="radio" id="role2" name="role" value="USER" checked="checked"> <!-- "checked" empeche l'utilisateur de ne rien séléctionner --> | ||
25 | - <label for="role2">User</label> | 56 | + <input type="radio" id="role2" name="role" value="USER" checked="checked"> <!--//"checked" empeche l'utilisateur de ne rien séléctionner--> |
57 | + <label for="role2">User</label> | ||
58 | + </div> | ||
59 | + <button @click.prevent="registration" type="submit" class="btn btn-primary">Ajouter</button> | ||
60 | + </form> | ||
61 | + <span th:utext="${ok}"></span> | ||
26 | </div> | 62 | </div> |
27 | - <button type="submit">Ajouter</button> | ||
28 | - </form> | ||
29 | - <span th:utext="${ok}"></span> | ||
30 | - <a th:href="@{/home}">Accueil</a> | ||
31 | - <!--<div th:if="${param.ok}"> | ||
32 | - <span>L'utilisateur a été ajouté !</span> | ||
33 | </div> | 63 | </div> |
34 | - <div th:if="${param.fail}"> | ||
35 | - <span>Le pseudo existe déjà !</span> | ||
36 | - </div>--> | ||
37 | -</div> | 64 | + |
65 | + | ||
66 | +<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | ||
67 | +<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script> | ||
68 | +<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script> | ||
38 | </body> | 69 | </body> |
39 | </html> | 70 | </html> |
40 | \ No newline at end of file | 71 | \ No newline at end of file |