The salt and token are now calculated at each new access starting from the password saved in the database, based on the type of access

This commit is contained in:
CappielloAntonio 2022-02-05 23:33:08 +01:00
parent cc9afb8057
commit d408b82503
4 changed files with 38 additions and 38 deletions

View file

@ -50,12 +50,18 @@ public class App extends Application {
String password = PreferenceUtil.getInstance(context).getPassword();
String token = PreferenceUtil.getInstance(context).getToken();
String salt = PreferenceUtil.getInstance(context).getSalt();
boolean isLowSecurity = PreferenceUtil.getInstance(context).isLowScurity();
SubsonicPreferences preferences = new SubsonicPreferences();
preferences.setServerUrl(server);
preferences.setUsername(username);
preferences.setPassword(password);
preferences.setAuthentication(password, token, salt);
preferences.setAuthentication(password, token, salt, isLowSecurity);
if (preferences.getAuthentication() != null) {
if (preferences.getAuthentication().getPassword() != null) PreferenceUtil.getInstance(context).setPassword(preferences.getAuthentication().getPassword());
if (preferences.getAuthentication().getToken() != null) PreferenceUtil.getInstance(context).setToken(preferences.getAuthentication().getToken());
if (preferences.getAuthentication().getSalt() != null) PreferenceUtil.getInstance(context).setSalt(preferences.getAuthentication().getSalt());
}
return new Subsonic(context, preferences);
}