[mono/mono] [2 commits] 9d13d1ae: Remove CodeProject licensed code

"Miguel de Icaza ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014185055843-fc46432a-df2c-4180-be52-91f23a82edb2-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/58cf2e272a05...8f604d71f13f

   Commit: 9d13d1aeb05c0ddd0e83b5094a5d0333e3a08c87
   Author: Miguel de Icaza <[email protected]> (migueldeicaza)
     Date: 2013-10-04 19:43:47 GMT
      URL: https://github.com/mono/mono/commit/9d13d1aeb05c0ddd0e83b5094a5d0333e3a08c87

Remove CodeProject licensed code

Changed paths:
  M mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CreditCardAttribute.cs

Modified: mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/CreditCardAttribute.cs
===================================================================
@@ -66,14 +66,8 @@ public override bool IsValid(object value)
 			//
 			// See: http://en.wikipedia.org/wiki/Luhn_algorithm
 			// See: http://rosettacode.org/wiki/Luhn_test_of_credit_card_numbers
-			// See: http://www.codeproject.com/Tips/515367/Validate-credit-card-number-with-Mod-10-algorithm
 
-			int sumOfDigits = creditCardNumber.Where((e) => e >= '0' && e <= '9')
-				.Reverse()
-				.Select((e, i) => ((int)e - 48) * (i % 2 == 0 ? 1 : 2))
-				.Sum((e) => e / 10 + e % 10);
-
-			return sumOfDigits % 10 == 0;
+			return true;	
 		}
 	}
 }

   Commit: 8f604d71f13f15711c655c9dce22b318fe74ad14
   Author: Miguel de Icaza <[email protected]> (migueldeicaza)
     Date: 2013-10-04 19:47:22 GMT
      URL: https://github.com/mono/mono/commit/8f604d71f13f15711c655c9dce22b318fe74ad14

This regex was wrong in the first place, and second, it uses CC code from Stackoverflow

Changed paths:
  M mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EmailAddressAttribute.cs

Modified: mcs/class/System.ComponentModel.DataAnnotations/System.ComponentModel.DataAnnotations/EmailAddressAttribute.cs
===================================================================
@@ -40,11 +40,6 @@ namespace System.ComponentModel.DataAnnotations
 	public class EmailAddressAttribute : DataTypeAttribute
 	{
 		private const string DefaultErrorMessage = "The {0} field is not a valid e-mail address.";
-		// See: http://stackoverflow.com/questions/16167983/best-regular-expression-for-email-validation-in-c-sharp
-		// See: http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
-		private const string _emailRegexStr =   @"[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*" +
-						  	@"@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-z0-9])?\.)+(?:[A-Za-z]{2}|" +
-						    	@"com|org|net|edu|gov|cat|mil|biz|info|mobi|name|aero|asia|jobs|museum|coop|travel|post|pro|tel|int|xxx)\b";
 		private static Regex _emailRegex = new Regex (_emailRegexStr, RegexOptions.IgnoreCase | RegexOptions.Compiled);
 
 		public EmailAddressAttribute ()
@@ -60,10 +55,7 @@ public override bool IsValid(object value)
 				return true;
 
 			if (value is string)
-			{
-				var str = value as string;
-				return !string.IsNullOrEmpty(str) ? _emailRegex.IsMatch(str) : false;
-			}
+				return true;
 
 			return false;
 		}


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.