PacketFence - BTS - PacketFence | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0001813 | PacketFence | captive portal | public | 2014-06-25 05:14 | 2014-07-07 12:36 |
Reporter | sisu | ||||
Assigned To | |||||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | new | Resolution | open | ||
Platform | Linux | OS | Ubuntu | OS Version | 12.04 |
Product Version | 4.2.2 | ||||
Target Version | Fixed in Version | ||||
fixed in git revision | |||||
fixed in mtn revision | |||||
Summary | 0001813: Phone number check with regex | ||||
Description | On Packetfence 4.1 In the File /pf/lib/pf/web/util.pm i changee the text form : sub validate_phone_number { my ($phone_number) = @_; # north american regular expression if ($phone_number =~ / ^(?:\+?(1)[-.\s]?)? # optional 1 in front with -, ., space or nothing seperator \(?([2-9]\d{2})\)? # captures first 3 digits allows optional parenthesis [-.\s]? # separator -, ., space or nothing (\d{3}) # captures 3 digits [-.\s]? # separator -, ., space or nothing (\d{4})$ # captures last 4 digits /x) { return "$1$2$3$4" if defined($1); return "$2$3$4"; } # rest of world regular expression if ($phone_number =~ / ^\+?\s? # optional + on front with optional space ((?:[0-9]\s?){6,14} # between 6 and 14 groups of digits seperated by spaces or not [0-9])$ # end with a digit /x) { # trim spaces my $return = $1; $return =~ s/\s+//g; return $return; } return; } to sub validate_phone_number { my ($phone_number) = @_; $phone_number =~ s/\s+//g; # Leerzeichen rausnehmen $phone_number =~ s/\s-//g; # Minuszeichen rausnehmen $phone_number =~ s/^\+/00/; # + mit 00 ersetzen $phone_number =~ s/^0041/0/; # 0041 mit 0 ersetzen # Schweiz: ^07[5-9]\d{7}$ #Frankreich ^00336(0(7|8)|3[0-2]|54|[6-8]\d{1})\d{6}$ #Oesterreich ^00436(50|6(0|3|4)|7(6|8)|8(0|1|8)|99)\d{7}$ #Deutschland ^00491(5(1|2|5|7|9)|6(0|2|3)|7)\d{8,9}$ #Italien ^00393([2-4]\d{1}|6[0-8]|8\d{1}|9[0-3])\d{7}$ #England ^00447(4|5|[7-9]|7624)\d{6,8}$ if ($phone_number =~ /^07[5-9]\d{7}$|^00336(0(7|8)|3[0-2]|54|[6-8]\d{1})\d{6}$|^00491(5(1|2|5|7|9)|6(0|2|3)|7)\d{8,9}$|^00393([2-4]\d{1}|6[0-8]|8\d{1}|9[0-3])\d{7}$|^00447(4|5|[7-9]|7624)\d{6,8}$/) { return $phone_number; } return; } if I sign up with the number +49... the system sending sms to 0049.... On Packetfence 4.2 who i do the same if not send to 0049.... it sends to 49... Thanks for help Best Regards Sisu | ||||
Steps To Reproduce | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2014-06-25 05:14 | sisu | New Issue |
There are no notes attached to this issue. |