Most applications use the password for authentication of the legitimate user. These applications maintain a database of username and corresponding password. In databases, passwords are stored in the form of hash values which are irreversible. A potential hacker may use brute force attack or dictionary attack for guessing the password. In brute force attack; hacker tries all possible combinations of passwords to gain unauthorized access to user's account. In a dictionary attack, the hacker uses dictionary file containing possible passwords and tries every password from that file. It is noted that, even though password with certain patterns is accepted as strong by existing systems, they are vulnerable to dictionary attack. The proposed system allows the user to choose a password which is not present in the dictionary. Also, all possible alterations of passwords are matched against the supplied dictionary. Password containing personal information is not accepted by the system. The present study proposes a security method based on login attempts and respective security levels for the password. The concept of security levels is introduced which aims at increasing the strength of the password on detection of malicious activity such as invalid login attempts, login attempts performed for the same user account from two different locations in little time difference which are far away from each other, etc. On detection of any suspicious activity, the security level of the password gets upgraded to the higher level which increases length and strength of the password by making it more complex and hard to crack.