fix password change default tip
authorChristian Schwarzinger <christian.schwarzinger@proclos.com>
Wed, 12 Jul 2017 09:15:44 +0200
changeset 427d1ee1c2004c
parent 41 70925dbb524f
fix password change
dist/PalOOCa.jar
dist/PalOOCa.oxt
dist/external_jars/jars.properties
src/org/palooca/dialogs/PasswordDialog.java
src/org/palooca/paloutil/PaloUser.java
     1.1 Binary file dist/PalOOCa.jar has changed
     2.1 Binary file dist/PalOOCa.oxt has changed
     3.1 --- a/dist/external_jars/jars.properties	Wed May 25 10:32:32 2016 +0200
     3.2 +++ b/dist/external_jars/jars.properties	Wed Jul 12 09:15:44 2017 +0200
     3.3 @@ -1,3 +1,3 @@
     3.4  #PackageActionDescription
     3.5 -#Wed May 25 10:27:43 CEST 2016
     3.6 +#Wed Jul 12 09:10:00 CEST 2017
     3.7  external.jars=external_jars/dom4j-1.6.1.jar external_jars/swing-layout-1.0.4.jar external_jars/appframework-1.0.3.jar external_jars/swing-worker-1.1.jar external_jars/AbsoluteLayout.jar external_jars/log4j-1.2.16.jar external_jars/xercesImpl.jar external_jars/h2-1.3.172.jar external_jars/olap4j-1.2.0-SNAPSHOT.jar external_jars/olap4j-xmla-1.2.0-SNAPSHOT.jar external_jars/palojlib-5.1.jar external_jars/jdom-2.0.5.jar
     4.1 --- a/src/org/palooca/dialogs/PasswordDialog.java	Wed May 25 10:32:32 2016 +0200
     4.2 +++ b/src/org/palooca/dialogs/PasswordDialog.java	Wed Jul 12 09:15:44 2017 +0200
     4.3 @@ -22,6 +22,9 @@
     4.4  
     4.5  package org.palooca.dialogs;
     4.6  
     4.7 +import java.math.BigInteger;
     4.8 +import java.security.MessageDigest;
     4.9 +import java.security.NoSuchAlgorithmException;
    4.10  import javax.swing.JOptionPane;
    4.11  
    4.12  /**
    4.13 @@ -31,6 +34,7 @@
    4.14  public class PasswordDialog extends javax.swing.JDialog {
    4.15      private String      password;
    4.16      private String      newPassword;
    4.17 +    private final String salt = "\t1\t";
    4.18  
    4.19      public String getNewPassword() {
    4.20          return newPassword;
    4.21 @@ -166,11 +170,29 @@
    4.22  
    4.23  }//GEN-LAST:event_btnCancelActionPerformed
    4.24  
    4.25 +    private String encrpytPassword(String password){
    4.26 +        String hashword = null;
    4.27 +	try {
    4.28 +            MessageDigest md5 = MessageDigest.getInstance("MD5");
    4.29 +            md5.update(password.getBytes());
    4.30 +	    BigInteger hash = new BigInteger(1, md5.digest());
    4.31 +            hashword = hash.toString(16);
    4.32 +	    int old_length = hashword.length();
    4.33 +            for(int i=old_length-1;i<31;i++){
    4.34 +		hashword = "0" + hashword;
    4.35 +            }
    4.36 +	} catch (NoSuchAlgorithmException nsae) {
    4.37 +            // ignore
    4.38 +	}
    4.39 +	return salt+hashword;
    4.40 +    }
    4.41 +
    4.42      private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
    4.43          newPassword = new String(edtNewPassword.getPassword());
    4.44          oldPassword = new String(edtOldPassword.getPassword());
    4.45  
    4.46 -        if (oldPassword.equals(password)) {
    4.47 +        if (encrpytPassword(oldPassword).equals(password)) {
    4.48 +            newPassword = encrpytPassword(newPassword);
    4.49              modalResult = JOptionPane.OK_OPTION;
    4.50              setVisible(false);
    4.51          } else {
     5.1 --- a/src/org/palooca/paloutil/PaloUser.java	Wed May 25 10:32:32 2016 +0200
     5.2 +++ b/src/org/palooca/paloutil/PaloUser.java	Wed Jul 12 09:15:44 2017 +0200
     5.3 @@ -92,7 +92,7 @@
     5.4  
     5.5          String[] coords = new String[2];
     5.6  
     5.7 -		coords[0] = getName();
     5.8 +	coords[0] = getName();
     5.9          coords[1] = new String("password");
    5.10  
    5.11      	Object value = PaloLibUtil.getData(groupRoleCube, coords);
    5.12 @@ -105,9 +105,8 @@
    5.13          if (groupRoleCube == null)
    5.14              return;
    5.15  
    5.16 -		String[] coords = new String[2];
    5.17 -
    5.18 -		coords[0] = getName();
    5.19 +	String[] coords = new String[2];
    5.20 +	coords[0] = getName();
    5.21          coords[1] = new String("password");
    5.22          PaloLibUtil.setData(groupRoleCube, coords, newPassword);
    5.23