SHARE
TWEET

Untitled

a guest Jun 20th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form th:action="@{/login}"  th:object="${user}" method="post" role="login">
  2.  
  3.       <h2 class="text-center" th:text="${companyName}"></h2>
  4.  
  5.        <input type="email" id="username" name="username" autocomplete="username" th:placeholder="|Email@${clientEmailDomain}|" required class="form-control input-lg"  />
  6.  
  7.        <input type="password" class="form-control input-lg" id="password" name="password" autocomplete="current-password" placeholder="Password" required="" />
  8.  
  9.        <button type="submit" class="btn btn-lg btn-primary btn-block">Log in</button>                  
  10.  
  11.   </form>
  12.      
  13. @Override
  14. protected void configure(HttpSecurity http) throws Exception {
  15.  
  16.     http
  17.             .authorizeRequests()
  18.             .antMatchers("/",
  19.                     "/css/**",
  20.                     "/fonts/**",
  21.                     "/img/**",
  22.                     "/js/**",
  23.                     "/register",
  24.                     "/resetPassword",
  25.  
  26.  
  27.             ).permitAll()
  28.             .anyRequest().authenticated()
  29.             .and()
  30.             .formLogin()
  31.             .loginPage("/login")
  32.             .defaultSuccessUrl("/search/" + clientOsVersion)
  33.             .permitAll()
  34.             .and()
  35.             .logout()
  36.             .permitAll();
  37.  
  38.     // THIS IS ONLY DURING DEV to access to the database
  39.     http.csrf().disable();
  40.     http.headers().frameOptions().disable();
  41.     // END OF DEV ONLY
  42. }
  43.      
  44. @PostMapping("/login")
  45. public ModelAndView processLoginForm(ModelAndView modelAndView,
  46.          @Valid User user
  47. ) {
  48.  
  49.     System.err.println("Processing login data"); // This line is NEVER printed!!!
  50.  
  51.     // Here I need to update a user's attribute.
  52.  
  53.     modelAndView.addObject("clientEmailDomain",
  54.             clientEmailDomain);
  55.  
  56.     modelAndView.addObject("companyName",
  57.             companyName);
  58.  
  59.     return modelaAndView;
  60. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top