java ee - Couldn't reset my password CRUD -
i have form user can reset password if did forget it. resetform.xhtml
<h:form id="newcustomerform" > <fieldset> <legend>rest password</legend> <table border="0" > <tbody > <tr type="text"> <td> <p:outputlabel value="account login :" for="pseudo"/> </td> <p:spacer height="5px" /> <td> <p:inputtext id="pseudo" value="#{accountmb.login}" title="pseudo" required="true" requiredmessage="the pseudo field required."> </p:inputtext> <p:watermark for="pseudo" value="login" /> <p:message for="pseudo" display="text"/> </td> </tr> <tr type="password"> <td> <p:outputlabel value="new password :" for="pwd1"/> </td> <p:spacer height="5px" /> <td> <p:password id="pwd1" value="#{accountmb.password}" feedback="true" match="pwd2" label="password 1" required="true" requiredmessage="the password field required."/> <p:watermark for="pwd1" value="password" /> <p:message for="pwd1"/> </td> </tr> <p:spacer height="5px" /> <tr type="password"> <td> <p:outputlabel value="confirm password :" for="pwd2"/> </td> <p:spacer height="5px" /> <td> <p:password id="pwd2" value="#{accountmb.password}" feedback="true" label="password 2" required="true" requiredmessage="the confirm password field required."/> <p:watermark for="pwd2" value="confirm password" /> <p:message for="pwd2"/> </td> </tr> </tbody> </table> <div type="submit" align="right" style="margin-top: 5px"> <p:commandbutton style="width: 130px; height: 40px" value="save" ajax="false" icon="ui-icon-circle-check" styleclass="ui-priority-primary" action="#{accountmb.updateaccount()}"/> </div> </fieldset> </h:form>
and here managed bean
@managedbean(name = "accountmb") @sessionscoped public class accountmanagedbean implements serializable { private static logger logger = logger.getlogger(accountmanagedbean.class.getname()); @inject private accountbusinesslocal accountbusinesslocal; private string login; private string password; private account passwordaccount; public accountmanagedbean() { customer = new customer(); } @postconstruct public void init() { passwordaccount= new account(); } public string updateaccount() { logger.log(level.severe, "*****update account***** "); passwordaccount = accountbusinesslocal.findbylogin(login); accountbusinesslocal.updateaccount(passwordaccount); logger.log(level.severe, passwordaccount.tostring()); return "login.jsp"; } }
my problem when enter login , new password , submit. password in database isn't updated can't login new password.
what missing??
you're not updating password in passwordaccount object.
passwordaccount = accountbusinesslocal.findbylogin(login); // update passwordaccount entered password passwordaccount.setpassword(password); accountbusinesslocal.updateaccount(passwordaccount);
Comments
Post a Comment