Authenticate for identity creation

This commit is contained in:
str4d
2014-08-28 03:15:50 +00:00
parent 72583479d6
commit 2fd88627ba
2 changed files with 22 additions and 2 deletions

1
TODO
View File

@@ -1,6 +1,5 @@
Fixes:
- Auto-comma the To: field when it loses focus
- Ask to login when opening "Create new identity"
- Fix tick over selected emails
- Refine view email page
-- Delete/read/unread/move actions that don't break everything

View File

@@ -110,10 +110,31 @@ public class EditIdentityFragment extends EditPictureFragment {
mDescField = (EditText) view.findViewById(R.id.description);
mDefaultField = (CheckBox) view.findViewById(R.id.default_identity);
mError = (TextView) view.findViewById(R.id.error);
mCryptoField = (Spinner) view.findViewById(R.id.crypto_impl);
if (I2PBote.getInstance().isPasswordRequired()) {
// Request a password from the user.
BoteHelper.requestPassword(getActivity(), new BoteHelper.RequestPasswordListener() {
@Override
public void onPasswordVerified() {
initializeIdentity();
}
@Override
public void onPasswordCanceled() {
getActivity().setResult(Activity.RESULT_CANCELED);
getActivity().finish();
}
});
} else {
// Password is cached, or not set.
initializeIdentity();
}
}
private void initializeIdentity() {
if (mKey == null) {
// Show the encryption choice field
mCryptoField = (Spinner) view.findViewById(R.id.crypto_impl);
CryptoAdapter adapter = new CryptoAdapter(getActivity());
mCryptoField.setAdapter(adapter);
mCryptoField.setSelection(mDefaultPos);