/*
 * 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.arrebol.taxiservicios.validators;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

/**
 *
 * @author Picasso
 */
@FacesValidator("loginValidator")
public class LoginValidator extends GenericValidator implements Validator {

    @Override
    public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
        loadBundlePropertyFile();
        
        switch (component.getId()) {
            case "username":
                notEmptyValidator(EMAIL_PATTERN_MIN_LENGTH_3, 3, value.toString(), "validator.username");
                break;
            case "password":
                temporalPasswordValidator(value.toString());
                break;
        }
    }

}
