alexandregz / twofactor_gauthenticator

This RoundCube plugin adds the 2-step verification(OTP) to the login proccess
MIT License
216 stars 76 forks source link

Script for disable 2fa #140

Closed bartlomiejkida closed 3 years ago

bartlomiejkida commented 3 years ago

Sometimes a given user can turn on two-step verification, but lose their phone or other authorization tool. In this case, a script would be nice to properly remove (e.g. via CLI) the 2fa block from the selected user.

alexandregz commented 3 years ago

See #113

bartlomiejkida commented 3 years ago

This wipes out all of the user's settings, which is quite inconvenient.

Below is a solution for posterity:

UPDATE users SET preferences = REPLACE(preferences, '"activate";b:1', '"activate";b:0') WHERE username = 'USER@DOMAN.COM' LIMIT 1;