I want to build a WordPress website that redirects the users to a verification page, after successful login on the login page. This verification page should ask for a 6 digit PIN which should be generated every time the user logs in, and destroyed every time the user logs out. Please, how do I go about it?

closed as too broad by TheDeadMedic, Max Yudin, Howdy_McGee Aug 17 '18 at 14:50

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    See wordpress.stackexchange.com/help/how-to-ask. What have you researched? what code have you tried so far? I suggest you start by googling two step authentication / verification / login, words like that. See how the answers meet your needs or not, then rephrase your question and describe your observations and conclusions. – anmari Aug 17 '18 at 10:41

Read up on the documentation for the filter login_redirect

And also see the answer to this question already answered

I'm not totally sure what you are trying to do with the PIN - is that sent to the user via text/email or displayed on the page?

Either way, the page you redirect to would need to generate the PIN, store it in a (custom) table, then when the user enters the PIN, check the (custom) table on form submission, and then redirect to the page you want them to go after that.

  • thanks for the feedback. yeah it will be sent to the user via email. If you create a custom table for the generated pin how would you match it to the user it was generated for inorder to validate it. – Kelvin Aug 17 '18 at 16:36
  • You would also need to store the user id in that table, and probably a column if the PIN is currently active or not (expired or used). id - unique number; pin - number; userid - number; active - boolean or number (0 or 1); this is assuming you create a new row for every pin generated. The other option would be to only have one row per userid and replace the pin when a new one is generated for that user, which would make the 'active' column unnecessary. – Vitzkrieg Aug 19 '18 at 16:39
  • Sorry forgot about you wanting to destroy the pin on logout, so you would just need to delete the row on logout. The 'active' column would be unnecessary also. – Vitzkrieg Aug 19 '18 at 16:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.