I have a system in JSF (with primefaces) with spring security. When the user registers, he receives an email with a username and password.
Ok - It works.
However, I would like to send in the body of the email a hyperlink where the user could click and already entered the validated system.
What I have tried to do so far as a test. At least send the user and password as parameters (I will encrypt logic) of the login page by automatically filling in the user and password fields. With the fields already filled, click on the login button. I do not know if it would be very elegant but it would already help.
However I can make the system populate the user but not the password.
Below the xhtml excerpt.
<h:outputLabel for="username" value="Email" />
<p:inputText id="username" required="true"
label="Informe seu email" value="#{securityController.email}" />
<h:outputLabel for="password" value="Senha" />
<p:password id="password" required="true"
label="Informe sua senha" value="#{securityController.password}" />
<p:spacer />
<p:commandButton process="username password @this" value="Logar"
id="botaoLogar" update="msgs" ajax="false"
styleClass="ms-botao-login ms-cor-botao"
action="#{securityController.processaLogin()}" />
Managed Bean
@Named
@SessionScoped
public class SecurityController implements Serializable {
private static final long serialVersionUID = 1L;
private String email;
private String password;
public void processaLogin() throws ServletException, IOException{
FacesUtil.redireciona("/spring_security_check");
}
public void preRender(){
FacesContext facesContext = FacesContext.getCurrentInstance();
HttpServletRequest request = ((HttpServletRequest) facesContext.getExternalContext().getRequest());
String user__ = request.getParameter("user__");
String pass__ = request.getParameter("pass__");
this.email = user__;
this.password = pass__;
// gets and sets
}