]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/util/PasswordStrengthChecker.java
Implement and test change password form.
[gigi.git] / src / org / cacert / gigi / util / PasswordStrengthChecker.java
index cad2aba58106f21a872a41d32f80f5094174f4e6..3e4760bbf2b86c47fd53766fbbe5be89b26e0327 100644 (file)
@@ -2,6 +2,7 @@ package org.cacert.gigi.util;
 
 import java.util.regex.Pattern;
 
+import org.cacert.gigi.GigiApiException;
 import org.cacert.gigi.User;
 
 public class PasswordStrengthChecker {
@@ -70,6 +71,13 @@ public class PasswordStrengthChecker {
                return light;
        }
 
+       public static void assertStrongPassword(String pw, User u) throws GigiApiException {
+               if (checkpw(pw, u) < 3) {
+                       throw new GigiApiException("The Pass Phrase you submitted failed to contain enough"
+                               + " differing characters and/or contained words from" + " your name and/or email address.");
+               }
+       }
+
        private static boolean contained(String pw, String check) {
                if (check == null || check.equals("")) {
                        return false;