Move identicon and toID to mpw native.
Clean out all unused Java MPAlgorithm stuff. Fix master password entries stuck in memory.
This commit is contained in:
@@ -35,7 +35,7 @@ public class MPIncognitoUser extends MPBasicUser<MPIncognitoSite> {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public byte[] getKeyID() {
|
||||
public String getKeyID() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@ import javax.swing.border.Border;
|
||||
import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import javax.swing.text.*;
|
||||
import javax.swing.undo.UndoableEdit;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
|
||||
@@ -207,7 +208,13 @@ public abstract class Components {
|
||||
}
|
||||
|
||||
public static JPasswordField passwordField() {
|
||||
return new JPasswordField() {
|
||||
return new JPasswordField( new PlainDocument( new GapContent() {
|
||||
@Override
|
||||
public String getString(final int where, final int len)
|
||||
throws BadLocationException {
|
||||
return "";
|
||||
}
|
||||
} ), null, 0 ) {
|
||||
{
|
||||
setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder( Res.colors().controlBorder(), 1, true ),
|
||||
BorderFactory.createEmptyBorder( 4, 4, 4, 4 ) ) );
|
||||
|
@@ -182,7 +182,7 @@ public abstract class Res {
|
||||
|
||||
public static final class Fonts {
|
||||
|
||||
public Font emoticonsFont(final int size) {
|
||||
public Font identiconFont(final int size) {
|
||||
return MPFont.emoticonsRegular.get( size );
|
||||
}
|
||||
|
||||
|
@@ -317,7 +317,7 @@ public class UserContentPanel extends JPanel implements State.Listener, MPUser.L
|
||||
add( Components.strut() );
|
||||
|
||||
add( identiconLabel = Components.label( SwingConstants.CENTER ) );
|
||||
identiconLabel.setFont( Res.fonts().emoticonsFont( Components.TEXT_SIZE_CONTROL ) );
|
||||
identiconLabel.setFont( Res.fonts().identiconFont( Components.TEXT_SIZE_CONTROL ) );
|
||||
add( Box.createGlue() );
|
||||
|
||||
add( Components.label( "Master Password:" ) );
|
||||
@@ -330,6 +330,15 @@ public class UserContentPanel extends JPanel implements State.Listener, MPUser.L
|
||||
add( Box.createGlue() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNotify() {
|
||||
char[] password = masterPasswordField.getPassword();
|
||||
Arrays.fill( password, (char) 0 );
|
||||
masterPasswordField.setText( new String( password ) );
|
||||
|
||||
super.removeNotify();
|
||||
}
|
||||
|
||||
private void exportUser() {
|
||||
MPFileUser fileUser = (user instanceof MPFileUser)? (MPFileUser) user: null;
|
||||
if (fileUser == null)
|
||||
@@ -449,7 +458,8 @@ public class UserContentPanel extends JPanel implements State.Listener, MPUser.L
|
||||
private void updateIdenticon() {
|
||||
char[] masterPassword = masterPasswordField.getPassword();
|
||||
MPIdenticon identicon = ((masterPassword != null) && (masterPassword.length > 0))?
|
||||
new MPIdenticon( user.getFullName(), masterPassword ): null;
|
||||
user.getAlgorithm().identicon( user.getFullName(), masterPassword ): null;
|
||||
Arrays.fill( masterPassword, (char) 0 );
|
||||
|
||||
Res.ui( () -> {
|
||||
if (identicon != null) {
|
||||
@@ -779,7 +789,7 @@ public class UserContentPanel extends JPanel implements State.Listener, MPUser.L
|
||||
typeModel.selection( MPResultType.DeriveKey, t -> {
|
||||
switch (t) {
|
||||
case DeriveKey:
|
||||
stateModel.setText( Integer.toString( site.getAlgorithm().mpw_keySize_min() ) );
|
||||
stateModel.setText( "128" );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Reference in New Issue
Block a user