3
I have a system in JSF(with primefaces) with spring security. When the user registers it receives an e-mail with user and password.
Okay - It works.
However I would like to send in the body of the email a hyperlink where the user could click and already enter the validated system.
What I’ve tried to do so far on a test basis. At least send the user and password as parameters (I will encrypt logico) of the login page by automatically filling the user and password fields. With the fields already filled in just click on the login button. I don’t know if it would be very elegant but it would help.
However I can make the system fill in 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
}
Doubt is how to send this to spring security?
– Marcelo