Fixed MP-59 Master password not recognized when no site added to mpsites file.
This commit is contained in:
parent
6961236534
commit
8f1d897660
@ -1,10 +1,11 @@
|
|||||||
package com.lyndir.masterpassword.gui;
|
package com.lyndir.masterpassword.gui;
|
||||||
|
|
||||||
import com.google.common.base.*;
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.lyndir.masterpassword.model.*;
|
import com.lyndir.masterpassword.model.*;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import javax.annotation.*;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,6 +51,7 @@ public class ModelUser extends User {
|
|||||||
throws IncorrectMasterPasswordException {
|
throws IncorrectMasterPasswordException {
|
||||||
putKey( model.authenticate( masterPassword ) );
|
putKey( model.authenticate( masterPassword ) );
|
||||||
this.masterPassword = masterPassword;
|
this.masterPassword = masterPassword;
|
||||||
|
MPUserFileManager.get().save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package com.lyndir.masterpassword.gui;
|
package com.lyndir.masterpassword.gui;
|
||||||
|
|
||||||
import static com.lyndir.lhunath.opal.system.util.ObjectUtils.ifNotNullElse;
|
|
||||||
import static com.lyndir.lhunath.opal.system.util.StringUtils.*;
|
import static com.lyndir.lhunath.opal.system.util.StringUtils.*;
|
||||||
|
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.util.concurrent.*;
|
import com.google.common.util.concurrent.*;
|
||||||
import com.lyndir.lhunath.opal.system.util.NNSupplier;
|
|
||||||
import com.lyndir.lhunath.opal.system.util.PredicateNN;
|
import com.lyndir.lhunath.opal.system.util.PredicateNN;
|
||||||
import com.lyndir.masterpassword.*;
|
import com.lyndir.masterpassword.*;
|
||||||
import com.lyndir.masterpassword.gui.util.Components;
|
import com.lyndir.masterpassword.gui.util.Components;
|
||||||
@ -98,12 +96,15 @@ public class PasswordFrame extends JFrame implements DocumentListener {
|
|||||||
siteActionButton.addActionListener(new ActionListener() {
|
siteActionButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent e) {
|
public void actionPerformed(final ActionEvent e) {
|
||||||
if (currentSite instanceof ModelSite)
|
if (currentSite == null)
|
||||||
|
return;
|
||||||
|
else if (currentSite instanceof ModelSite)
|
||||||
PasswordFrame.this.user.deleteSite(currentSite);
|
PasswordFrame.this.user.deleteSite(currentSite);
|
||||||
else
|
else
|
||||||
PasswordFrame.this.user.addSite(currentSite);
|
PasswordFrame.this.user.addSite(currentSite);
|
||||||
|
siteNameField.requestFocus();
|
||||||
|
|
||||||
updatePassword(true);
|
updatePassword( true );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sitePanel.add( siteControls );
|
sitePanel.add( siteControls );
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.lyndir.masterpassword.model;
|
package com.lyndir.masterpassword.model;
|
||||||
|
|
||||||
import static com.lyndir.lhunath.opal.system.util.StringUtils.strf;
|
import static com.lyndir.lhunath.opal.system.util.StringUtils.*;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
@ -90,7 +90,7 @@ public class MPUser implements Comparable<MPUser> {
|
|||||||
public MasterKey authenticate(final char[] masterPassword)
|
public MasterKey authenticate(final char[] masterPassword)
|
||||||
throws IncorrectMasterPasswordException {
|
throws IncorrectMasterPasswordException {
|
||||||
MasterKey masterKey = MasterKey.create( algorithmVersion, getFullName(), masterPassword );
|
MasterKey masterKey = MasterKey.create( algorithmVersion, getFullName(), masterPassword );
|
||||||
if (keyID == null)
|
if (keyID == null || keyID.length == 0)
|
||||||
keyID = masterKey.getKeyID();
|
keyID = masterKey.getKeyID();
|
||||||
else if (!Arrays.equals( masterKey.getKeyID(), keyID ))
|
else if (!Arrays.equals( masterKey.getKeyID(), keyID ))
|
||||||
throw new IncorrectMasterPasswordException( this );
|
throw new IncorrectMasterPasswordException( this );
|
||||||
|
Loading…
Reference in New Issue
Block a user