Password checking utilities

Guys,
I read in some of the Java books about a password utilities which checks if passwords are legal(according to the company's policy).
They used something like this:
public static boolean isPasswordValid (String pw)
String digits = "0123456789"
String letters ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
//something with indexOf()
}and then checked if one of the chars exists in the String pw.
could anyone advise how to check it with indexOf????
I implemented it differently with this:
     public static boolean isPasswordValid(String pw)
          if (pw!=null && pw.length()>5)
               char[] c = pw.toCharArray();
               boolean digitExist  = false;
               boolean letterExist = false;
               for (int x=0; x<pw.length(); x++)
                    if (Character.isDigit(c[x]))
                         digitExist = true;
                    if (Character.isLetter(c[x]))
                         letterExist = true;
                    if (digitExist && letterExist)
                         return true;                    
          return false;
     }

I suggest:
Implementing what you want to do, by using the 'indexOf()' method, is also difficult.
But anyway...
char[] c = digits.toCharArray();
boolean digitExist  = false;
for (int i = 0; i < c.length; i++)
   if (pw.indexOf(c) != -1)
digitExist = true;
break;
//Same for the letters

Similar Messages

  • I can't get firefox to remember my passwords and open the site automacially, It did it at first when I installed firefox but now it won't and I have remember passwords checked in the tool

    I just reinstalled firefox on my computer and the password feature to remember then worked for all my sites for a couple days and now firefox does not remember my username or password and I have remember password checked in the tool section. What can I do to correct this. Does it have anything to do with me having the setting to not remember any history?

    Did you look at this? Should be helpful :)
    http://support.mozilla.com/en-US/kb/Username%20and%20password%20not%20remembered#os=win&browser=fx4

  • Username and password check problem

    I have learned Java for 3 months and I am going to finish a project for the school. I have had some problems on username & password check and authorization from SQL database using ODBC. Any source code I can learn from?
    Thanks in advance.

    I'm not too clear on what you exactly want, but here's an example from my book using "username", "password", and a "database". I can send you the db file if you need to see it. I hope this helps.
    // Fig. 18.24: TableDisplay.java
    // This program displays the contents of the Authors table
    // in the Books database.
    import java.sql.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class TableDisplay extends JFrame {
    private Connection connection;
    private JTable table;
    public TableDisplay()
    // The URL specifying the Books database to which
    // this program connects using JDBC to connect to a
    // Microsoft ODBC database.
    String url = "jdbc:odbc:Books";
    String username = "anonymous";
    String password = "guest";
    // Load the driver to allow connection to the database
    try {
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    connection = DriverManager.getConnection(
    url, username, password );
    catch ( ClassNotFoundException cnfex ) {
    System.err.println(
    "Failed to load JDBC/ODBC driver." );
    cnfex.printStackTrace();
    System.exit( 1 ); // terminate program
    catch ( SQLException sqlex ) {
    System.err.println( "Unable to connect" );
    sqlex.printStackTrace();
    getTable();
    setSize( 450, 150 );
    show();
    private void getTable()
    Statement statement;
    ResultSet resultSet;
    try {
    String query = "SELECT * FROM Authors";
    statement = connection.createStatement();
    resultSet = statement.executeQuery( query );
    displayResultSet( resultSet );
    statement.close();
    catch ( SQLException sqlex ) {
    sqlex.printStackTrace();
    private void displayResultSet( ResultSet rs )
    throws SQLException
    // position to first record
    boolean moreRecords = rs.next();
    // If there are no records, display a message
    if ( ! moreRecords ) {
    JOptionPane.showMessageDialog( this,
    "ResultSet contained no records" );
    setTitle( "No records to display" );
    return;
    setTitle( "Authors table from Books" );
    Vector columnHeads = new Vector();
    Vector rows = new Vector();
    try {
    // get column heads
    ResultSetMetaData rsmd = rs.getMetaData();
    for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
    columnHeads.addElement( rsmd.getColumnName( i ) );
    // get row data
    do {
    rows.addElement( getNextRow( rs, rsmd ) );
    } while ( rs.next() );
    // display table with ResultSet contents
    table = new JTable( rows, columnHeads );
    JScrollPane scroller = new JScrollPane( table );
    getContentPane().add(
    scroller, BorderLayout.CENTER );
    validate();
    catch ( SQLException sqlex ) {
    sqlex.printStackTrace();
    private Vector getNextRow( ResultSet rs,
    ResultSetMetaData rsmd )
    throws SQLException
    Vector currentRow = new Vector();
    for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
    switch( rsmd.getColumnType( i ) ) {
    case Types.VARCHAR:
    currentRow.addElement( rs.getString( i ) );
    break;
    case Types.INTEGER:
    currentRow.addElement(
    new Long( rs.getLong( i ) ) );
    break;
    default:
    System.out.println( "Type was: " +
    rsmd.getColumnTypeName( i ) );
    return currentRow;
    public void shutDown()
    try {
    connection.close();
    catch ( SQLException sqlex ) {
    System.err.println( "Unable to disconnect" );
    sqlex.printStackTrace();
    public static void main( String args[] )
    final TableDisplay app = new TableDisplay();
    app.addWindowListener(
    new WindowAdapter() {
    public void windowClosing( WindowEvent e )
    app.shutDown();
    System.exit( 0 );

  • I cannot get into iCloud, it sites connection error. I am online otherwise. My username and password check out. Anyone else with a similar problem?

    I Cannot getinto iCloud, it sites connection error. I am online otherwise. My username and password check out. Anyone else with this problem?

    SUCCESS! I was trying to get in with Internet Explorer, and getting the error message.
    I switched over to FireFox, and connected immediately!

  • Disabling password checking?

    Hi all,
    is it possible in Oracle to disable password checking, so that I could be connect with just
    <username>@<service name>
    without being prompted for a password?
    Now please don't condemn me... The idea is the following:
    It's all about a dedicated developer database / server.
    I have a lot of scripts which deploy the schema objects of our app, in several "connected" schemas, which are used by the app. For the sake of simplicity and speed we have been using <username>=<password>. But the consequence is, that these scripts cannot be used unchanged for deploying into production.
    It would be great, if I could only use the above mentioned connection script and by a central db-configuration, in one case it would connect me to the DB, in the other case I would be prompted for the password.
    Now please, don't value the approach. This not my idea. But is there a way disable password checking (entering question...)?
    Many thanks, in advance

    Mark D Powell wrote:
    What kind of scripts?
    What OS?
    What version of Oracle?
    We use an environment variables to hold the username and password. The OS then substitutes the current username and corresponding password into the script at run time. So the same Korn shell script we use in test can run in production unchanged and the developers do not know the production password.
    Oraclle also support global authenication via an Directory Server with the Advanced Security option.
    HTH -- Mark D Powell --I have the feeling, that you understood what I mean, still I don't understand your solution. But first I should provide more information...
    We are using 11gR2 on Linux machines, both for development as well as for production. We have a concept for continuous integration, where every schema object has it's own DDL script and then we have an allobjects.sql scripts which every single one of them (simply speaking).
    These are all SQL scripts, written to be executed in sqlplus. In SQLPLUS variables I am handling things like schema names and passwords. The "master" sql-scripts "connect"s itself to all necessary schemas for the app, and deploys every single database objects, executing its script. The consequence is, the "master" scripts contains many "connect" statements and in production every single one schema of the app, could have different password, so I can't just pass it as a parameter to the sql-script once.
    I hope, I have been more clear than the first time. So we have an app, which uses 8-9 schemas to be completely deployed. So I thought, if I could just use "<username>@<service name>" in my scripts, than the DBAs would be able to use them, unchanged, entering the production passwords, when prompted, without the developers knowing them....

  • When I try to connect to wi-fi, it asks for the password, but I got this question.  If you don't know the password, check with the Wi-Fi network administrator, but I don't know how.

    Hi All, 
    When I try to connect to wi-fi, it asks for a password.  Then I got this question.  If you don't know the password, check with the Wi-Fi network administrator, but how do I find the network administrator.

    Whomever provides the wi-fi.
    To what wi-fi network are trying to connect?

  • MDSD 3.0 - Password Check trouble

    Hi Folks!
    We have finally managed to download the tour related data to the hand held device (delivery, transport, clients, materials, etc). The problem we are having is that after we click Ok-Proceed to start the day we are getting a password check.
    We have configured the Administration of Mobile Device, we have defined:
    Group: CHECKER
    Role ID: SUPERVISOR
    And SUPERVISOR is assigned to group CHECKER, and it has a password correctly defined.
    We have tried to enter as user name: CHECKER, SUPERVISOR, the synchronization user, with the password defined and we haven't being able to go through this.
    Can anyone kindly help us through this. I've been really stuck with this.
    Thanks in advance for any help.
    Regards,
    Gilberto Li

    I made a fresh install of the device client and now it's working.

  • Password Check Failed, Fatal Error, System Halted, CNU949701P

    Hello!
    I have a HP netbook model Mini CQ 10, and I have not switched it on in a while.
    I recently went to turn it on to recover some important documents and this error message shows up;
    Password check failed
    Fatal Error... System Halted
    CNU949701P
    Canu anyone PLEASE HELP ME! I would be so grateful!
    Thank you!
    x
    This question was solved.
    View Solution.

    Try >> e9lovox132
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • Password check failed fatal error system halted CNU9384PJY

    BOOTING ENTER CURRENT PASSWORD THREE TIMES GOES TO PASSWORD CHECK FAILED FATAL ERROR SYSTEM HALTEDCNU9384PJY AFTER NETBOOK SET UP FOR A WHILE THANKS FOR ANY HELP

     Enter:    e9lofuv2wi     ( 3rd character is a llower case L ) Regards, DP-K

  • Password check failed : CNU9273LZJ - need password pls

    Need password for CNU9273LZJ
    This question was solved.
    View Solution.

    Axelin
    Which password? - BIOS or Windows?
    If BIOS admin password check failed, then try this:
    e9lo7xfk0w
    all are small letters
    third letter is small case L
    fourth letter is small case O
    ninth character is number Zero
    Regards
    Visruth
    ++Please click KUDOS / White thumb to say thanks
    ++Please click ACCEPT AS SOLUTION to help others, find this solution faster
    **I'm a Volunteer, I do not work for HP**

  • Password check failed code 2MC9360C12

    My HP Mini 110 suddenly says "Password check failed, Fatal Error......System Halted. 2MC9360C12"Can somebody help me?

    Hi,           Use the below code to reset the BIOS password 74eofg1e37 You can: 1. Use the unlock code you generated to enter the BIOS
    2. Disable all passwords that are enabled in the BIOS's security menu.
    3. If asked for current password - type the unlock code
    4. For new password, just press ENTER key
    5. Repeat the same for verify password column.

  • Password check failed CNU90243DN

    PLS HELP HP MINI PASSWORD CHECK FAILED ....CNU90243DN

    Do you have Recovery Disc to boot from and reinstall Windows?
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • System Health Checks Utilities

    Hi Linux Gurus,
    I need to understand some of the outputs of basic system health checks utilities - vmstat, netstat, iostat. As DBA point of view when I run any of the above utilities - what things I should look for. How can I know, the network traffic is high or network is not performing properly by using netstat. How can I know that the system I/O is high. Also I saw that there are many flags for these utilities which are very helpful to format or limit the output to a certain extent.
    I will really appreciate the help on this topic.
    Best Regards
    -Samar-

    Hi Samar
    A graphical tool like sourceforge.net/projects/xosview/ can make a part of the job, otherwise does oracle the OS Watcher (OSW) is a set of scripts that continually run in the background, collecting information about: Processes I/O Memory Network
    OS Watcher user’s guide in MetaLink note 301137.1
    Hope this helps.
    Regards,
    Hub

  • Hi  I'm try to set up a new Epson printer SX 445 to my router/network but each time I run the set up wizard it fails to complete saying Security Key/Password Check fail.  *entered security key/password does not match the one set for for router.  I know th

    Hi
    On my macbook pro
    I'm try to set up a new Epson printer SX 445 to my router/network but each time I run the set up wizard it fails to complete saying Security Key/Password Check fail.
    *entered security key/password does not match the one set for for router.
    I know that the password is correct and have rechecked this by changing it a few times
    and I still get the same result.
    My network internet service provider is not interested and says to call Epson.
    Anybody have any clues how I can resolve this?
    Regards

    I personally suggest the new Drobo FS. Since it has an iTunes server built in and you can use any size sata hard drive in it it is better and a NAS that has to use the same size drives.

  • HD diagnostic/checking utilities?

    Got my new HD installed but fsck.reiserfs found some problems which it fixed. System runs stable but I'd really like to make a total check to see if the drive really is ok. Any diagnostic/checking utilities for this?
    My /boot is ext2, / and /home are reiserfs.

    tlilja wrote:I've stumbled across the problem with RAM during my days as a PC support but that is not the case this time.
    i cross my fingers, hope you go lucky with your harddrive. good luck!

Maybe you are looking for

  • Mail Won't Open After System Update

    I just downloaded a system update which was a security update and now I can't open Mail. I keep getting this message: You tried to open Mail version 4.5 (1084/1085) in:  /Users/Syze/Desktop/Mail.app  It can't be used on this version of Mac OS X.

  • Windows hijacks iPod and treats like flash drive.

    every time I connect my new ipod to my computer (vista) windows explorer opens up and shows an empty drive, so I close that and then iTunes opens and try's to sync, after 40 songs windows hijacks it, disconnects it, re-connects it and opens it again

  • Second Reader Window takes 30 seconds to start.

    When clicking a PDF File, Adobe Reader X starts (in about 1-2 seconds). If i leave this window open an click another pdf, the second window takes exactly 30 seconds. Not good for workplaces who open 100 and more pdf's a day. This problem is not fixed

  • TS1424 Does anyone know about a problem 12001 downloading a movie?  The download was stopped and will not start again.

    This occurred whilst downloading.  The download stopped and now I can't start it again.  Even if I try to purchase it again I can't, as it says 'downloaded' instead of the price tag.  I'd love to know the answer as we are in the middle of the third s

  • Keep the value  after a event

    I am designing a page .on its left i place some condition for searching and a button named search. on its right one table for result. when i click the search button ,it trigger a event which do a searching according to those conditions.Then ,the tabl