Fix log-in after entering the wrong master password.
This commit is contained in:
parent
83fcde5bd0
commit
778533ac7f
@ -58,12 +58,19 @@ public class ModelUser extends User {
|
||||
if (!model.hasKeyID()) {
|
||||
model.setKeyID( key.getKeyID() );
|
||||
MPUserFileManager.get().save();
|
||||
} else if (!model.hasKeyID( key.getKeyID() ))
|
||||
} else if (!model.hasKeyID( key.getKeyID() )) {
|
||||
reset();
|
||||
throw new MasterKeyException( strf( "Incorrect master password for user: %s", getFullName() ) );
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
masterPassword = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Site> findSitesByName(final String query) {
|
||||
return FluentIterable.from( model.findSitesByName( query ) ).transform( new Function<MPSiteResult, Site>() {
|
||||
|
@ -32,14 +32,22 @@ public abstract class User {
|
||||
@Nonnull
|
||||
public MasterKey getKey() throws MasterKeyException {
|
||||
if (key == null) {
|
||||
if (!hasKey())
|
||||
String masterPassword = getMasterPassword();
|
||||
if (masterPassword == null || masterPassword.isEmpty()) {
|
||||
reset();
|
||||
throw new MasterKeyException( strf( "Master password unknown for user: %s", getFullName() ) );
|
||||
key = new MasterKey( getFullName(), getMasterPassword() );
|
||||
}
|
||||
|
||||
key = new MasterKey( getFullName(), masterPassword );
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
key = null;
|
||||
}
|
||||
|
||||
public abstract Iterable<Site> findSitesByName(final String siteName);
|
||||
|
||||
public abstract void addSite(final Site site);
|
||||
|
Loading…
Reference in New Issue
Block a user