This topic is locked

Two-factor autentication intercept

12/30/2021 2:53:29 PM
PHPRunner General questions
ffrinai author

Hi,
how may i know in "before login event" if two-factor authentication is enabled ?
thanks
Fabio

Sergey Kornilov admin 12/30/2021

A few ideas of how you can make it work.

This is how you can get the user's data:
https://xlinesoft.com/phprunner/docs/secapi_get_user_data.htm

$data = Security::getUserData( $username);

Then you can call this function:
Security::twoFactorEnabled( $data["field name for 2fa"] );

It will return either an empty string or one of the following: totp, email, phone

This should be enough for this purpose.