This may work fine, however this is not two-factor authentication .
In addition to the password, a second factor may be:
- What you have (e.g. secureid, smartcard, etc.).
- Something you (i.e. various forms of biometrics).
Since I assume that you are not biometric-oriented;), let me explain why I say that this is not the second factor (you have something).
To qualify for the 2nd factor, you need to ensure that the owner of the device (i.e. a pre-registered cell phone) is the only one who could receive SMS.
In today's cellular networks, this is simply not the case. There are ruts for copying, for example. SIM card mobile operators may intercept; smartphones may have applications that intercept and resubmit; etc.
In addition, if the user enters the code back to the site, he allows all standard web attacks on this additional password: sniffing, interception, MITM, session capture, etc.
Now, to be clear, this still definitely has value - out-of-band communication can help ensure that the obvious user is not the victim of a simple web attack, XSS, etc.
I have worked with a large number of telecommunications companies that love this solution (it can also be part of their business model, but whatever;))
However, depending on your situation, in some places (for example, in banks, gov't) a real 2nd factor is required - that is, cryptographic proof (usually). And this is not so.
source share