mirror of
https://github.com/etesync/android
synced 2025-02-02 19:01:06 +00:00
Improve error message when using the wrong password on account creation.
This commit is contained in:
parent
4567f2347e
commit
3a1b980384
@ -107,6 +107,8 @@ public class BaseConfigurationFinder {
|
||||
|
||||
public final String logs;
|
||||
|
||||
public Throwable error;
|
||||
|
||||
@Getter
|
||||
private final boolean failed;
|
||||
}
|
||||
|
@ -89,6 +89,19 @@ public class SetupEncryptionFragment extends DialogFragment {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Configuration result) {
|
||||
if ((config.error != null) && (config.error instanceof Exceptions.IntegrityException)) {
|
||||
App.log.severe("Wrong encryption password.");
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.wrong_encryption_password)
|
||||
.setIcon(R.drawable.ic_error_dark)
|
||||
.setMessage(getString(R.string.wrong_encryption_password_content, config.error.getLocalizedMessage()))
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// dismiss
|
||||
}
|
||||
}).show();
|
||||
} else {
|
||||
try {
|
||||
if (createAccount(config.userName, config)) {
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
@ -107,6 +120,7 @@ public class SetupEncryptionFragment extends DialogFragment {
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
|
||||
dismissAllowingStateLoss();
|
||||
}
|
||||
@ -116,6 +130,7 @@ public class SetupEncryptionFragment extends DialogFragment {
|
||||
App.log.info("Started deriving key");
|
||||
config.password = Crypto.deriveKey(config.userName, config.rawPassword);
|
||||
App.log.info("Finished deriving key");
|
||||
config.error = null;
|
||||
|
||||
try {
|
||||
Crypto.CryptoManager cryptoManager;
|
||||
@ -129,12 +144,9 @@ public class SetupEncryptionFragment extends DialogFragment {
|
||||
userInfo.verify(cryptoManager);
|
||||
config.keyPair = new Crypto.AsymmetricKeyPair(userInfo.getContent(cryptoManager), userInfo.getPubkey());
|
||||
}
|
||||
} catch (Exceptions.HttpException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exceptions.IntegrityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exceptions.VersionTooNewException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
config.error = e;
|
||||
}
|
||||
|
||||
return config;
|
||||
|
@ -194,6 +194,8 @@
|
||||
<string name="login_encryption_setup">Please wait, setting up encryption…</string>
|
||||
|
||||
<string name="account_creation_failed">Account creation failed</string>
|
||||
<string name="wrong_encryption_password">Wrong encryption password</string>
|
||||
<string name="wrong_encryption_password_content">Got an integrity error while accessing your account, which most likely means you put in the wrong encryption password.\n\n%s</string>
|
||||
|
||||
<!-- SetupUserInfoFragment -->
|
||||
<string name="login_encryption_error_title">Encryption Error</string>
|
||||
|
Loading…
Reference in New Issue
Block a user