mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
I broke email address validation with r1447. I changed EmailAddressValidator.isValid() to only accept email addresses without name part ('foo@bar.com' but not '"snafu" foo@bar.com') because AccountSetupBasics used it to verify the email address for an account. With the old validator spaces were allowed in the email field but lead to an exception later (issue 849). Unfortunately I missed the fact that there are implicit calls to isValid() to validate email addresses e.g. in the 'To field
This commit is contained in:
parent
e6cabe4a82
commit
f7094a2a8e
@ -3,6 +3,7 @@ package com.fsck.k9;
|
|||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import android.text.util.Rfc822Tokenizer;
|
||||||
import android.widget.AutoCompleteTextView.Validator;
|
import android.widget.AutoCompleteTextView.Validator;
|
||||||
|
|
||||||
public class EmailAddressValidator implements Validator
|
public class EmailAddressValidator implements Validator
|
||||||
@ -20,6 +21,11 @@ public class EmailAddressValidator implements Validator
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValid(CharSequence text)
|
public boolean isValid(CharSequence text)
|
||||||
|
{
|
||||||
|
return Rfc822Tokenizer.tokenize(text).length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValidAddressOnly(CharSequence text)
|
||||||
{
|
{
|
||||||
return p.matcher(text).matches();
|
return p.matcher(text).matches();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ public class AccountSetupBasics extends K9Activity
|
|||||||
String email = mEmailView.getText().toString();
|
String email = mEmailView.getText().toString();
|
||||||
boolean valid = Utility.requiredFieldValid(mEmailView)
|
boolean valid = Utility.requiredFieldValid(mEmailView)
|
||||||
&& Utility.requiredFieldValid(mPasswordView)
|
&& Utility.requiredFieldValid(mPasswordView)
|
||||||
&& mEmailValidator.isValid(email);
|
&& mEmailValidator.isValidAddressOnly(email);
|
||||||
|
|
||||||
mNextButton.setEnabled(valid);
|
mNextButton.setEnabled(valid);
|
||||||
mManualSetupButton.setEnabled(valid);
|
mManualSetupButton.setEnabled(valid);
|
||||||
|
Loading…
Reference in New Issue
Block a user