Submit development confirmation instructions via SMS or email

Hi, I used the program for authentication, and also made several changes to it, so I indicated the sign using both e-mail and a mobile phone number . Link to this link .

Here is my code

def self.find_for_database_authentication(conditions={}) find_by(mobile_number: conditions[:email]) || find_by(email: conditions[:email]) end 

I use a validated module to send confirmation instructions, and they work great for email.

Now, if the user does not enter this letter (only enters the mobile phone number), he must send an SMS (confirmation instruction in SMS) .

Therefore, I have the following doubts

  • How can I achieve this functionality?
  • How can I generate the same confirmation link for the same.

EDIT (I tried the following solutions to create a confirmation link)

Like I should send a confirmation link in SMS as well, so I tried to generate this link using the following

 http://localhost:3000/admin_users/confirmation?confirmation_token=#{@user.confirmation_token}" 

it generates the following link type

 http://localhost:3000/admin_users/confirmation?confirmation_token=00b2880c9662c65dc6d276db08532ea42d4333e6b7d2357d036cb9233eed41e8 

when I'm tired of using this link, it gives me a Lack of confirmation confirmation . After searching, I found this . So how can I create a confirmation link on the development side.

+5
source share
1 answer

As for sending instructions via SMS, you can take a look at tropo or restcomm if you want to set up your server. Tropo is especially easy to use, you will need a small deposit (for example, $ 10) to enable the SMS sending function.

Regarding the generation of the URL, you may need to create a controller that extends the Devise::ConfirmationsController and overrides the create method to add logic to check for email or phone number and respond correctly.

0
source

Source: https://habr.com/ru/post/1233502/


All Articles