2 Factor authentication with first time only

Nicky Nguyen asked on February 25, 2015 13:00

Hi all,

I have a requirement is that, we have to enable two 2FA authentication with first time user login in a browser only. If in the same browser user login at second time we won't show "passcode" form anymore. And my 2FA uses email to send passcode.

Currently I can send passcode whenever user login but cannot disable 2FA when user login at second time :( Could somebody help me a solution?

Thanks, Nicky

Recent Answers


Virgil Carroll answered on February 25, 2015 14:51

You are most likely going to have to build your own custom login control. During first login, users will have to complete the 2nd factor authentication methods. Upon subsequent logins you will not require this.

In Kentico user table it stores the last logged on date/time. You could write your control to check for this value upon entering in username/password. If the value exists, you could code to skip the 2nd factor...if not then require that step.

0 votesVote for this answer Mark as a Correct answer

Nicky Nguyen answered on February 25, 2015 15:01

Hi Virgil,

I plan to use cookie to check number of login in the broswer. As for passcode of 2FA, do you know how i can generate it using Kentico API? And how i can set user to be logged using kentico api?

0 votesVote for this answer Mark as a Correct answer

Nicky Nguyen answered on February 26, 2015 03:18

Hi all,

Can somebody help me on thí?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on February 26, 2015 08:39

Virgil is right regarding the last login time. The downfall is the only way to actually capture the previous date before it's changed is to intercept the authentication event.

In a previous question you had I mentioned adding another field to the user settings or user object. I'd suggest doing this if you haven't and then override the Authenticate event. See the documentation here. Then in the authentication event, do a lookup on the user to see if that date is updated, if so, perform some logical actions or set some global properties to let the rest of the system know they don'n need to perform MFA again. If not update the user with date the logged in the first time and then perform your logical actions.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.