Adding Two-Factor Authentication(2FA) to ActiveAdmin auth in a Ruby on Rails web application

To enhance the security of a web application having a user authentication workflow, we use a security method called 2FA. It is also known as Two Factor Authentication(type of Multi-Factor Authentication). In this blog post, we will see how to implement email-based 2FA in ActiveAdmin auth of a Ruby on Rails application. In the email-based 2FA approach, when logging in with an email and password, an OTP will be sent on a registered email address. Upon entering the OTP, it will successfully authenticate and the session will be started. Also, we will see the following additional functionality and customizations

Implement client side validation in Active admin

Recently, we have to build an Admin dashboard for an e-commerce application. This involves adding stores, items their photos and other data typically needed for managing the data from admin side for non technical people. Since, we are using rails framework so we had two options that are best suitable as per our need administrate and active admin. The former is very popular recently as it has several advantages over the latter. Unlike active admin you don't have to understand the DSL. It's very flexible and easily customisable. But administrate is still in pre-1.0 version and not very stable