Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package MainPackage;
- import javax.swing.JOptionPane;
- /**
- *
- * @author benja
- */
- public class evalpasswd {
- public String userpass;
- public evalpasswd (String userpass) {
- this.userpass = userpass;
- }
- public String getPass() {
- String passwd = userpass;
- String pattern = "(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=])(?=\\S+$).{8,}";
- //Equation to validate password must contain: at least one uppper case and at least one lower case letter, at least one special character, at least one digit
- String validstatus = String.valueOf(passwd.matches(pattern)); //Checks if password matches the equation
- return validstatus; //Returns whether or not the password entered is valid
- } //End of method
- } //End of class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement