am b3412d7f
: Merge "Handle leading/trailing space in passwords" into honeycomb
* commit 'b3412d7f5e1356f92d2ed4a6a9ed1f3313d3d058': Handle leading/trailing space in passwords
This commit is contained in:
commit
8f319d1c3e
@ -26,7 +26,9 @@ import com.android.email.provider.EmailContent.AccountColumns;
|
|||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.XmlResourceParser;
|
import android.content.res.XmlResourceParser;
|
||||||
|
import android.text.Editable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@ -213,4 +215,20 @@ public class AccountSettingsUtils {
|
|||||||
}
|
}
|
||||||
return ((incoming != null) ? incoming : outgoing) + '.' + server.substring(keepFirstChar);
|
return ((incoming != null) ? incoming : outgoing) + '.' + server.substring(keepFirstChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to set error status on password fields that have leading or trailing spaces
|
||||||
|
*/
|
||||||
|
public static void checkPasswordSpaces(Context context, EditText passwordField) {
|
||||||
|
// STOPSHIP - there is a bug in the framework that makes these flicker.
|
||||||
|
// If the bug cannot be fixed shortly, then this should be pulled before we ship
|
||||||
|
Editable password = passwordField.getText();
|
||||||
|
int length = password.length();
|
||||||
|
if (length > 0) {
|
||||||
|
if (password.charAt(0) == ' ' || password.charAt(length-1) == ' ') {
|
||||||
|
passwordField.setError(context.getString(R.string.account_password_spaces_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -362,6 +362,9 @@ public class AccountSetupBasics extends AccountSetupActivity
|
|||||||
&& Utility.isTextViewNotEmpty(mPasswordView)
|
&& Utility.isTextViewNotEmpty(mPasswordView)
|
||||||
&& mEmailValidator.isValid(mEmailView.getText().toString().trim());
|
&& mEmailValidator.isValid(mEmailView.getText().toString().trim());
|
||||||
onEnableProceedButtons(valid);
|
onEnableProceedButtons(valid);
|
||||||
|
|
||||||
|
// Warn (but don't prevent) if password has leading/trailing spaces
|
||||||
|
AccountSettingsUtils.checkPasswordSpaces(this, mPasswordView);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -400,7 +403,7 @@ public class AccountSetupBasics extends AccountSetupActivity
|
|||||||
*/
|
*/
|
||||||
private void finishAutoSetup() {
|
private void finishAutoSetup() {
|
||||||
String email = mEmailView.getText().toString().trim();
|
String email = mEmailView.getText().toString().trim();
|
||||||
String password = mPasswordView.getText().toString().trim();
|
String password = mPasswordView.getText().toString();
|
||||||
String[] emailParts = email.split("@");
|
String[] emailParts = email.split("@");
|
||||||
String user = emailParts[0];
|
String user = emailParts[0];
|
||||||
String domain = emailParts[1];
|
String domain = emailParts[1];
|
||||||
|
@ -294,6 +294,10 @@ public class AccountSetupExchangeFragment extends AccountServerBaseFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
enableNextButton(enabled);
|
enableNextButton(enabled);
|
||||||
|
|
||||||
|
// Warn (but don't prevent) if password has leading/trailing spaces
|
||||||
|
AccountSettingsUtils.checkPasswordSpaces(mContext, mPasswordView);
|
||||||
|
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,6 +394,9 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
enableNextButton(enabled);
|
enableNextButton(enabled);
|
||||||
|
|
||||||
|
// Warn (but don't prevent) if password has leading/trailing spaces
|
||||||
|
AccountSettingsUtils.checkPasswordSpaces(mContext, mPasswordView);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePortFromSecurityType() {
|
private void updatePortFromSecurityType() {
|
||||||
|
@ -332,6 +332,9 @@ public class AccountSetupOutgoingFragment extends AccountServerBaseFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
enableNextButton(enabled);
|
enableNextButton(enabled);
|
||||||
|
|
||||||
|
// Warn (but don't prevent) if password has leading/trailing spaces
|
||||||
|
AccountSettingsUtils.checkPasswordSpaces(mContext, mPasswordView);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user