mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Reset server preferences on login error
This commit is contained in:
parent
acf8525cfd
commit
bc6fc5be0f
2 changed files with 12 additions and 1 deletions
|
|
@ -93,6 +93,7 @@ public class ServerAdapter extends RecyclerView.Adapter<ServerAdapter.ViewHolder
|
|||
systemRepository.checkUserCredential(new SystemCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
resetServerPreference();
|
||||
Toast.makeText(context, exception.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
|
@ -128,5 +129,15 @@ public class ServerAdapter extends RecyclerView.Adapter<ServerAdapter.ViewHolder
|
|||
|
||||
App.getSubsonicClientInstance(context, true);
|
||||
}
|
||||
|
||||
private void resetServerPreference() {
|
||||
PreferenceUtil.getInstance(context).setServerId(null);
|
||||
PreferenceUtil.getInstance(context).setServer(null);
|
||||
PreferenceUtil.getInstance(context).setUser(null);
|
||||
PreferenceUtil.getInstance(context).setPassword(null);
|
||||
PreferenceUtil.getInstance(context).setLowSecurity(false);
|
||||
|
||||
App.getSubsonicClientInstance(context, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue