SimpleMachines/SMF2.1 — pull request #2547 by Dragooon (2014-11-30 20:58:14+00:00)
Title: [WIP] Two-Factor Authentication for SMF using TOTP protocol

This PR adds support for 2FA for SMF using TOTP protocol, allowing users to register a secondary layer of authentication via a device with app such as Google Authenticator, Authy, Duo Mobile etc.

This implementation is based on [RFC 6238](https://tools.ietf.org/html/rfc6238) Time-Based One Time Password protocol, The user can register a secondary 2FA device via their Account Settings profile area allowing them to add a layer of security upon logging in. This setup provides them a backup code as well, should they lose the device they can use this (it is recommended to store this backup code in a secure place and use only in emergency).

Internally the authentication is stored in a cookie generated with the data sha512(tfa_secret + password_salt), this is checked in loadUserSettings and the user is logged out if it fails and is forwarded to TFA login screen.

To-do:
-[] Allow Admins to enable, disable and force 2FA
-[] Allow Admins to disable 2FA on other members
-[] Add credits for \TOTP\Auth class to contributors/credits etc