Package com.totalchange.jizz.services

Examples of com.totalchange.jizz.services.InvalidKeyException


        logger.trace("Confirming DJ {}'s email address with key {}", dj, key);

        if (key == null || key.length() <= 0) {
            logger.info("Tried to confirm an email address with an empty "
                    + "key {}", key);
            throw new InvalidKeyException(JizzServicesErrors.getString(
                    dj.getLocale(), "confirmEmailNoKey"));
        }

        // Re-fetch the DJ as want to ensure no cheating is going on
        dj = jizzDjDao.getDj(dj.getId());

        // If no email address then what is being validated?
        if (dj.getEmail() == null || dj.getEmail().length() <= 0) {
            if (logger.isInfoEnabled()) {
                logger.info("Tried to confirm an empty email address ("
                        + dj.getEmail() + ") with key " + key + " for DJ " + dj);
            }
            throw new InvalidKeyException(JizzServicesErrors.getString(
                    dj.getLocale(), "confirmEmailNoEmail"));
        }

        // If email is already confirmed then why try again?
        if (dj.getEmailConfirmation() == null) {
            if (logger.isInfoEnabled()) {
                logger.info("Tried to confirm email address (" + dj.getEmail()
                        + ") with key " + key + " for DJ " + dj
                        + ", but DJ's confirm key ("
                        + dj.getEmailConfirmation()
                        + ") is empty so email is already valid(ated)");
            }
            throw new InvalidKeyException(JizzServicesErrors.getString(
                    dj.getLocale(), "confirmEmailAlreadyValidated"));
        }

        // Now compare the keys and make sure they match
        if (!key.equals(dj.getEmailConfirmation())) {
            if (logger.isInfoEnabled()) {
                logger.info("Tried to confirm email address (" + dj.getEmail()
                        + ") with key " + key + " for DJ " + dj
                        + ", but DJ's confirm key ("
                        + dj.getEmailConfirmation()
                        + ") is empty so email is already valid(ated)");
            }
            throw new InvalidKeyException(JizzServicesErrors.getString(
                    dj.getLocale(), "confirmEmailInvalidKey"));
        }

        logger.trace("Looks like the key {} matches that on record of {}, "
                + "recording that email address is confirmed", key,
View Full Code Here

TOP

Related Classes of com.totalchange.jizz.services.InvalidKeyException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.