SCS-CBU-CED-IAM / mobileid-helper

Mobile ID Test Signature Portal
1 stars 1 forks source link

Allow any number in the entry field and implicitly Switzerland #51

Closed FreddyKaiser closed 11 years ago

FreddyKaiser commented 11 years ago

The entry field should allow all numbers and endup in formating it into + format without any spaces 1) Remove all whitespaces 2) Replace all + with 00 3) Remove all non-digits 4) Add implict Switzerland if no international code 5) Remove leading 0 and add the desired prefix

Sample code:

    /*
     * Ensures international format with specified prefix (+ or 00) and no spaces
     */
    private function getMSISDNfrom($uid, $prefix = '00') {
        $uid = preg_replace('/\s+/', '', $uid);         // Remove all whitespaces
        $uid = str_replace('+', '00', $uid);            // Replace all + with 00
        $uid = preg_replace('/\D/', '', $uid);          // Remove all non-digits
        if (strlen($uid) > 5) {                         // Still something here */
            if ($uid[0] == '0' && $uid[1] != '0')           // Add implicit 41 if starting with one 0
                $uid = '41' . substr($uid, 1);
            $uid = ltrim($uid, '0');                        // Remove all leading 0
        }
        $uid = $prefix . $uid;                           // Add the defined prefix

        return $uid;
    }
FreddyKaiser commented 11 years ago

Also remove the java script validatePhone() and related error codes that validates the defined number and let the Mobile ID backend reply with the proper answer. In case of wrong number it would provide a 105 error.

FreddyKaiser commented 11 years ago

Still error message "The mobile number is invalid." with numbers like 123, +4237771234, ...

It should not have any phone number validation at all. The Mobile ID backend will inform if number is not ok.

michellotto commented 11 years ago

?? I can't reproduce it.. Sounds like a cache problem on your client browser.. ?? I've removed all the check about the phone number, except if it's empty..

Otherwise, I've still this error message -> "UNAUTHORIZED_ACCESS". Can you give me the access to your API ?

FreddyKaiser commented 11 years ago

Ok fine by cleaning up the cache