Checked for valid email id.

Email id is checked for (z)(z)*@(z).(z)
where z is an alphanumeric character. 
Following emails are valid: abc@xyz.com a@abc.com
d@ddyC00l@abc.com foo@ab.com
Following are invalid: abc foo@ @foo.com @.com .com@
This commit is contained in:
amtkhdkr 2014-05-21 11:41:32 +05:30
parent bffc615a49
commit cd573d8446

View File

@ -97,6 +97,12 @@ void RegisterScreen::doRegister()
{
m_info_widget->setText(_("Email has to be between 4 and 50 characters long!"), false);
}
else if (email.find("@")== -1 || email.find(".")== -1 ||\
( email.find_last_of(".") - email.find_last_of("@") <= 2 ) ||\
email.find_last_of("@")==0 )
{
m_info_widget->setText(_("Email is invalid!"), false);
}
else
{
m_info_widget->setDefaultColor();