Thymeleaf: Login user via sign up page instead of /login
So far I know that it works automatically,
but don't know how to use it if i had created a new user via some sign page. Now instead of taking the user to log in page again.
Is there any way to log in user automatically on sign up.
As part of where you register your user, you can manually stuff a new authentication object into the SecurityContextHolder. This will keep the user from having to log in manually.
// build authentication token based on the username and password provided
Collection authorities = new ArrayList<>();
Authentication auth = new UsernamePasswordAuthenticationToken(email, password, authorities);
// set authentication in context
Asked in February 2016Viewed 1,832 timesVoted 8Answered 1 times