mirror of
https://github.com/etesync/android
synced 2025-02-09 06:02:42 +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 final String logs;
|
||||||
|
|
||||||
|
public Throwable error;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final boolean failed;
|
private final boolean failed;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,19 @@ public class SetupEncryptionFragment extends DialogFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Configuration result) {
|
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 {
|
try {
|
||||||
if (createAccount(config.userName, config)) {
|
if (createAccount(config.userName, config)) {
|
||||||
getActivity().setResult(Activity.RESULT_OK);
|
getActivity().setResult(Activity.RESULT_OK);
|
||||||
@ -107,6 +120,7 @@ public class SetupEncryptionFragment extends DialogFragment {
|
|||||||
}
|
}
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dismissAllowingStateLoss();
|
dismissAllowingStateLoss();
|
||||||
}
|
}
|
||||||
@ -116,6 +130,7 @@ public class SetupEncryptionFragment extends DialogFragment {
|
|||||||
App.log.info("Started deriving key");
|
App.log.info("Started deriving key");
|
||||||
config.password = Crypto.deriveKey(config.userName, config.rawPassword);
|
config.password = Crypto.deriveKey(config.userName, config.rawPassword);
|
||||||
App.log.info("Finished deriving key");
|
App.log.info("Finished deriving key");
|
||||||
|
config.error = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Crypto.CryptoManager cryptoManager;
|
Crypto.CryptoManager cryptoManager;
|
||||||
@ -129,12 +144,9 @@ public class SetupEncryptionFragment extends DialogFragment {
|
|||||||
userInfo.verify(cryptoManager);
|
userInfo.verify(cryptoManager);
|
||||||
config.keyPair = new Crypto.AsymmetricKeyPair(userInfo.getContent(cryptoManager), userInfo.getPubkey());
|
config.keyPair = new Crypto.AsymmetricKeyPair(userInfo.getContent(cryptoManager), userInfo.getPubkey());
|
||||||
}
|
}
|
||||||
} catch (Exceptions.HttpException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (Exceptions.IntegrityException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (Exceptions.VersionTooNewException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
config.error = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
@ -194,6 +194,8 @@
|
|||||||
<string name="login_encryption_setup">Please wait, setting up encryption…</string>
|
<string name="login_encryption_setup">Please wait, setting up encryption…</string>
|
||||||
|
|
||||||
<string name="account_creation_failed">Account creation failed</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 -->
|
<!-- SetupUserInfoFragment -->
|
||||||
<string name="login_encryption_error_title">Encryption Error</string>
|
<string name="login_encryption_error_title">Encryption Error</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user