By: Kee Wee Wong named 01 Mar 2020 at 8:12 p.m. CST

3 Responses
Kee Wee Wong gravatar
Hi Support, We are currently customizing the login and otp pages. The login page is based on the existing login.xhtml and the otp page is based on the TwilioSMS page (auth/twiliosms/twiliosms.xhtml) We would like to customize the error message when the user input the wrong username/password and wrong otp. Understand the JSF code for login page is this: ``` <h:messages class="text-center" style="color:#8b0000;margin:5px;margin-left:20px; font-size:2vw;" infoClass="text-center" errorClass="text-center" /> ``` And the TwilioSMS page is this: ``` <h:messages style="margin-left:-35px;text-align: center;color:red;" id="messages" globalOnly="true" styleClass="message text-center" errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg" rendered="#{showGlobalMessages != 'false'}" /> ``` May I know where is the message customized? Current for wrong username/password, the message is `Failed to authenticate.` and `Failed to authenticate.` for wrong OTP and we would like to change that. Thank you!

By Madhumita Subramaniam staff 01 Mar 2020 at 9:42 p.m. CST

Madhumita Subramaniam gravatar
Hi Kee Wee Wong, In your custom script you can write - ``` facesMessages = CdiUtil.bean(FacesMessages) facesMessages.setKeepMessages() facesMessages.add(FacesMessage.SEVERITY_ERROR, "Wrong username / password") ``` You'll find an example of similar error message in twilio's script itself. Hope that answers your question. Regards Madhu

By Kee Wee Wong named 03 Mar 2020 at 7:52 p.m. CST

Kee Wee Wong gravatar
Hi Madhu, Thanks for the info! I found out why I didn't get the error message in my custom script. The Twilio custom script had a typo in the invalid code line. It was `facesMessages.add(facesMessage.SEVERITY_ERROR, "Incorrect Twilio code, please try again.")` It should be `facesMessages.add(FacesMessage.SEVERITY_ERROR, "Incorrect Twilio code, please try again.")` Capital `F` for the FacesMessage

By Madhumita Subramaniam staff 03 Mar 2020 at 9:50 p.m. CST

Madhumita Subramaniam gravatar
Oops! Thanks for letting me know.