Advertisement
Guest User

Untitled

a guest
Oct 26th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. package paw.aplication.Paw2.Entity;
  2.  
  3. public class User2 {
  4. private String login;
  5. private String password;
  6.  
  7. public User2(String login, String password) {
  8. this.login = login;
  9. this.password = password;
  10. }
  11.  
  12. public User2() {
  13. }
  14.  
  15. public String getLogin() {
  16. return login;
  17. }
  18.  
  19. public void setLogin(String login) {
  20. this.login = login;
  21. }
  22.  
  23. public String getPassword() {
  24. return password;
  25. }
  26.  
  27. public void setPassword(String password) {
  28. this.password = password;
  29. }
  30. }
  31.  
  32.  
  33.  
  34. package paw.aplication.Paw2.Controller;
  35. import org.springframework.beans.factory.annotation.Autowired;
  36. import org.springframework.data.domain.PageRequest;
  37. import org.springframework.stereotype.Controller;
  38. import org.springframework.ui.Model;
  39. import org.springframework.web.bind.annotation.*;
  40.  
  41. import paw.aplication.Paw2.Entity.User;
  42. import paw.aplication.Paw2.Entity.User2;
  43. import paw.aplication.Paw2.Repository.UserRepository;
  44. import paw.aplication.Paw2.Repository.OfertaRepository;
  45. import paw.aplication.Paw2.form.LoginForm;
  46.  
  47.  
  48. @Controller
  49. @RequestMapping(path="/demo")
  50.  
  51. public class LogowanieController {
  52.  
  53. @GetMapping(path="/logowanie")
  54. public String loginView(Model model) {
  55. model.addAttribute("user2", new User2());
  56. return "logowanie";
  57. }
  58.  
  59. @PostMapping(path="/logowanie2")
  60. public String check(@ModelAttribute("user2") User2 user2) {
  61. String username = user2.getLogin();
  62. String password = user2.getPassword();
  63.  
  64. if ("admin".equals(username) && "admin".equals(password)) {
  65.  
  66. }
  67. return "logowanie";
  68. }
  69. }
  70.  
  71.  
  72.  
  73.  
  74. <!doctype html>
  75. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  76.  
  77. <head>
  78. <meta charset="utf-8">
  79. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  80.  
  81. <!-- Bootstrap CSS -->
  82. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  83.  
  84. <link href="signin.css" rel="stylesheet">
  85. </head>
  86.  
  87.  
  88. <body class="text-center">
  89. <div class="row justify-content-md-center">
  90. <form class="form-signin" action="#" th:action="@{/demo/logowanie2}" th:object="${user2}" method="post">
  91. <img class="mb-4" src="https://getbootstrap.com/assets/brand/bootstrap-solid.svg" alt="" width="72" height="72">
  92. <h1 class="h3 mb-3 font-weight-normal">Logowanie</h1>
  93.  
  94. <label for="login" class="sr-only">Username</label>
  95. <input type="text" id="login" class="form-control" placeholder="Username" th:field="*{login}" required autofocus>
  96.  
  97. <label for="password" class="sr-only">Password</label>
  98. <input type="password" id="password" class="form-control" placeholder="Password" th:field="*{password}" required>
  99.  
  100. <button class="btn btn-lg btn-primary btn-block" type="submit">Zaloguj się</button>
  101. </form>
  102. </div>
  103.  
  104. <!--<a class="btn btn-primary" href="adminPanel/index.html" role="button">Zaloguj się</a>
  105. <p class="mt-5 mb-3 text-muted">&copy; EventPol</p>-->
  106.  
  107. </body>
  108. <!--<body>
  109. <form th:action="@{/logowanie}" th:object="${logowanieForm}" method="post">
  110. <label for="username">Username</label>
  111. <input type="text" id="username" name="username" autofocus="autofocus"/>
  112.  
  113. <label for="password">Password</label>
  114. <input type="password" id="password" name="password"/>
  115. <br/>
  116. <input type="submit" value="Log In"/>
  117. </form>
  118. </body>-->
  119. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement