NOTE: The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.
Issue
- The Multi-Factor Authentication (MFA) one-time password (OTP) is generated in an alphanumeric format. How can it be changed to numeric only?
Environment
- Liferay DXP 7.4
Resolution
- At the time of writing this article, there is no out-of-the-box feature available to change the password from alphanumeric to numeric only.
- However, this requirement could be achieved by overriding
SendMFAEmailOTPMVCResourceCommandclass
Modify the following code:
@Component(
property = {
"javax.portlet.name=" + "com_liferay_multi_factor_authentication_portlet_web_internal_portlet_MFAEmailOTPVerifyPortlet",
"mvc.command.name=/mfa_email_otp_verify/send_mfa_email_otp",
"service.ranking:Integer=100"},
service = MVCResourceCommand.class)
public class SendMFAEmailOTPMVCResourceCommand implements MVCResourceCommand {
public static final String KEY1 = "0123456789";
private static final String[] _KEYS = {KEY1};
String generatedMFAEmailOTP = PwdGenerator.getPassword(mfaEmailOTPConfiguration.otpSize(),_KEYS);
}
This change configures the OTP generator to use only numeric characters.