Security

last person joined: yesterday 

Forum to discuss Enterprise security using HPE Aruba Networking NAC solutions (ClearPass), Introspect, VIA, 360 Security Exchange, Extensions, and Policy Enforcement Firewall (PEF).
Expand all | Collapse all

SMS Validation not working as intended - NwaSmsIsValidPhoneNumber

This thread has been viewed 0 times
  • 1.  SMS Validation not working as intended - NwaSmsIsValidPhoneNumber

    Posted Jun 15, 2012 02:08 PM

    Ello Ello,

     

    Having some trouble with validating the mobile number on my self-registration page.  I have the felid set to validate using NwaSmsIsValidPhoneNumber, however this doesn't seem to be working.  I 'm able to successfully register with numerical entries as short as 5 digits.  This is not good enough, as even benign typos will eventually start filling up my database.  

     

    Surely there's a way to get proper SMS validation working? Or is this by design...

     

    Thank you



  • 2.  RE: SMS Validation not working as intended - NwaSmsIsValidPhoneNumber

    Posted Jun 20, 2012 01:21 AM

    How many digits do you think the phone number should have?

     

    If you want to enforce a particular phone number format then you can use a different validator, e.g. a regular expression validator could be used to match a 10 digit phone number.



  • 3.  RE: SMS Validation not working as intended - NwaSmsIsValidPhoneNumber

    Posted Jun 20, 2012 09:40 AM

    Yes Id like to enforce at least to 10 digits.  Where can I add a custom validator for a regular expression?



  • 4.  RE: SMS Validation not working as intended - NwaSmsIsValidPhoneNumber
    Best Answer

    Posted Jun 20, 2012 11:09 AM

    Got it!

    For anyone else who's interested, IsRegExMatch is the validator and this long expression below seems to do the trick.

    ^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$

     

     Edit: this one works as well and is more simple.

    ^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$