Two Factor Authentication is broken in the back-end + abstracting the code

The two factor authentication is broken in the back-end as a critical line of code wasn't copied over when merging the two factor auth branch to master. This PR fixes it.

Moreover the code to check the two factor authentication code is moved from the Joomla! authentication plugin to the user model. This makes the code DRY and reusable by third party extensions. When this PR is merged I will write the documentation page describing the 5 lines of code required in the Joomla! documentation wiki.