account service checks that password is at least 8 characters

This commit is contained in:
woodser 2023-02-26 10:59:30 -05:00
parent b585e0f105
commit 99653fe40d

View File

@ -117,6 +117,7 @@ public class CoreAccountService {
public void changePassword(String oldPassword, String newPassword) {
if (!isAccountOpen()) throw new IllegalStateException("Cannot change password on unopened account");
if (!StringUtils.equals(this.password, oldPassword)) throw new IllegalStateException("Incorrect password");
if (newPassword != null && newPassword.length() < 8) throw new IllegalStateException("Password must be at least 8 characters");
keyStorage.saveKeyRing(keyRing, oldPassword, newPassword);
this.password = newPassword;
synchronized (listeners) {