com.cerebro.gorgone.commons.PasswordValidator.java Source code

Java tutorial

Introduction

Here is the source code for com.cerebro.gorgone.commons.PasswordValidator.java

Source

/*
 * 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 com.cerebro.gorgone.commons;

import com.vaadin.data.Validator;

/**
 *
 * @author matteo
 */
public class PasswordValidator implements Validator {

    @Override
    public void validate(Object value) throws InvalidValueException {
        if (!(value instanceof String && ((String) value).matches(".*\\d.*") && ((String) value).length() > 8))
            throw new InvalidValueException("Password non valida");
    }

}