Two-factor authentication using LWC
Use Case: In this blog we are going take the use case to build "Two-factor authentication (EMAIL)" using Lightning Web Component. This use case is going to be helpful to place an extra layer of security, especially when when we try to expose Salesforce sensitive data using Public Sites (or) Communities. Code Components: Below we are going to use 3 main code components to implement Two-factor email authentication. 1. CommonUtility.cls : Apex class that has two methods. One method to generate unique 6 digit code using crypto class and another method to generate single email message and dispatch email. public with sharing class CommonUtility { @AuraEnabled(cacheable= true ) // Method to send 6 digit two-factor email verification public static String twoFactorGen(String usrEmail) { String verCode = genUniqueCode(); // generate unique 6 digit code Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage(); // ins...