components/visual-panels/usermgr/src/java/vpanels/app/usermgr/com/oracle/solaris/vp/panels/usermgr/client/swing/UserMgrUtils.java
branchs11-update
changeset 2805 4888f6212f94
parent 843 190d2b5889a8
equal deleted inserted replaced
2804:7546c836fd87 2805:4888f6212f94
    18  *
    18  *
    19  * CDDL HEADER END
    19  * CDDL HEADER END
    20  */
    20  */
    21 
    21 
    22 /*
    22 /*
    23  * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
    23  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    24  */
    24  */
    25 
    25 
    26 package com.oracle.solaris.vp.panels.usermgr.client.swing;
    26 package com.oracle.solaris.vp.panels.usermgr.client.swing;
    27 
    27 
    28 import java.awt.*;
    28 import java.awt.*;
    36     // Static data
    36     // Static data
    37     //
    37     //
    38     private static final int VALID_UID = 100;
    38     private static final int VALID_UID = 100;
    39     private static final int VALID_HOMEDIRLEN = 2;
    39     private static final int VALID_HOMEDIRLEN = 2;
    40 
    40 
    41     public static void clearPassword(char[] password) {
    41     public static void clearPassword(String password) {
    42 	if (password != null) {
    42 	password = null;
    43 	    for (int i = 0; i < password.length; i++) {
    43         return;
    44 		password[i] = 0;
       
    45 	    }
       
    46 	}
       
    47     }
    44     }
    48 
    45 
    49     //
    46     //
    50     // Validation methods
    47     // Validation methods
    51     //
    48     //
    80 		Finder.getString("usermgr.error.userdesc.bad"));
    77 		Finder.getString("usermgr.error.userdesc.bad"));
    81 	}
    78 	}
    82     }
    79     }
    83 
    80 
    84     public static void validatePassword(boolean bNewUser,
    81     public static void validatePassword(boolean bNewUser,
    85 	char[] pass1, char[] pass2) throws ActionFailedException {
    82 	String pass1, String pass2) throws ActionFailedException {
    86 
    83 
    87 	// Ensure that the passwords match
    84 	// Ensure that the passwords match
    88 	if (!Arrays.equals(pass1, pass2)) {
    85 	if (pass1 != null && pass2 != null && pass1.equals(pass2))
       
    86 		return;
       
    87 	else {
    89 	    throw new ActionFailedException(
    88 	    throw new ActionFailedException(
    90 		Finder.getString("usermgr.error.pass.nomatch"));
    89 		Finder.getString("usermgr.error.pass.nomatch"));
    91 	}
    90 	}
    92     }
    91     }
    93 
    92