0

As we know, I can use several gems to implement OTP but I'm fresher so I want to know, what is the procedure to set an otp for different kind of reason.

LHH
  • 3,233
  • 1
  • 20
  • 27
  • why you are generating OTP to verify email? why can't you use devise inbuilt way to confirm user's email? – LHH Nov 23 '22 at 11:31
  • I'm fresher rails developer and I already use devise but I want to know how to verify email. When an user visit for sign up on website. – Prakash Chand Nov 25 '22 at 07:47
  • https://www.bogotobogo.com/RubyOnRails/RubyOnRails_Devise_Authentication_Sending_Confirmation_Email.php and https://stackoverflow.com/questions/8186584/how-do-i-set-up-email-confirmation-with-devise – LHH Nov 26 '22 at 06:25

2 Answers2

0

OTP can be used for the MFA authentication. You can create the OTP by using a ruby random number and can also pass the length of the number. This can be verified by clicking the link you will send in your email, which will open a pop-up for the OTP input, and submit will validate.

Santanu
  • 960
  • 10
  • 14
0

I believe this code will do the work for you:

rand.to_s[2..7]