Dat_Nguyen
(Dat Nguyen)
25 במרץ, 2020, 3:01am
13
simon:
To do that, enter the rails console, then you need to find your user ID. To do that run:
id = User.find_by(username: '<your_username>').id
Replace <your_username> with your Discourse username. Make sure to keep the quotation marks. When you run the command, you should see a number returned. That number is your user ID. It has been assigned to the variable id .
Then you need to find the UserSecondFactor record that is associated with your user. This command uses the id variable that you set with the first command:
second_factor = UserSecondFactor.find_by(user_id: id)
When you run that command, you should see some output in the console that shows your second factor record.
Now destroy the record:
second_factor.destroy
You can exit the console after running that command. You should be able to login to your site after running it.
Thanks so much, it works great.
However, I did not use the command second_factor.destroy. Instead, I took the data field to manually enter the Authenticator to recreate the two-factor authentication code.
Yes, it worked perfectly. For added security, I will recreate the new validator.
Thanks you.