Move IsValidEmail from program- to setup controller

This commit is contained in:
Hylke Bons 2011-11-18 02:00:12 +00:00
parent 3536b626d4
commit 989472802e
2 changed files with 11 additions and 13 deletions

View file

@ -1155,16 +1155,6 @@ namespace SparkleShare {
}
// Checks to see if an email address is valid
public bool IsValidEmail (string email)
{
Regex regex = new Regex (@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase);
return regex.IsMatch (email);
}
public void AddNoteToFolder (string folder_name, string revision, string note)
{
folder_name = folder_name.Replace ("%20", " ");
@ -1177,8 +1167,6 @@ namespace SparkleShare {
}
private string [] tango_palette = new string [] {"#eaab00", "#e37222",
"#3892ab", "#33c2cb", "#19b271", "#9eab05", "#8599a8", "#9ca696",
"#b88454", "#cc0033", "#8f6678", "#8c6cd0", "#796cbf", "#4060af",

View file

@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using SparkleLib;
@ -165,7 +166,7 @@ namespace SparkleShare {
email = email.Trim ();
bool fields_valid = (!string.IsNullOrWhiteSpace (full_name) &&
Program.Controller.IsValidEmail (email));
IsValidEmail (email));
if (UpdateSetupContinueButtonEvent != null)
UpdateSetupContinueButtonEvent (fields_valid);
@ -318,6 +319,15 @@ namespace SparkleShare {
ChangePathFieldEvent ("", "", FieldState.Enabled);
}
}
private bool IsValidEmail (string email)
{
Regex regex = new Regex (@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$",
RegexOptions.IgnoreCase);
return regex.IsMatch (email);
}
}