eLearning-BS23 / moodle-auth_otp

Moodle auth_otp is a One time password (OTP) based authentication plugin.
6 stars 3 forks source link

Invalid phone number validation for most countries #1

Open tmuras opened 3 years ago

tmuras commented 3 years ago

The phone validation is not correct for many countries:

            var phoneno = /^\d{10}$/;
            if (phoneno.test(phone)) {

For example in Poland and Ireland it's 9 digits for the mobile phone.

Similar assumption is done here:

    public function user_login($username, $password) {
        global $DB;
        $username = substr($username, -10);
sebastianberm commented 3 years ago

I suggest using the libphonenumber library from Google to validate this.