born05 / craft-twofactorauthentication

Craft plugin for two-factor or two-step login using Time Based OTP.
MIT License
36 stars 26 forks source link

DateInterval::__construct(): Unknown or bad format if userSessionDuration set to 0 #37

Closed romainpoirier closed 5 years ago

romainpoirier commented 5 years ago

Using this setting value in my config/general.php file: 'userSessionDuration' => 0, // users will stay logged in as long as its browser is open https://docs.craftcms.com/v3/config/config-settings.html#usersessionduration

I get this error: Exception DateInterval::__construct(): Unknown or bad format (PT-1S)

born05/craft-twofactorauthentication/src/services/Verify.php @ line 54: $minimalSessionDate->sub(new DateInterval('PT' . $sessionDuration . 'S'));

craft-twofactorauthentication version: 2.2.0

roelvanhintum commented 5 years ago

@romainpoirier That is one of the requirements: "userSessionDuration in the general.php config should be larger than 0" As discussed in #23