Examples of HPersonEmailValidationKey


Examples of org.zanata.model.HPersonEmailValidationKey

    @Transactional
    public String validate() throws LoginException {
        String returnUrl = "/home.xhtml";

        if (activationKey != null && !activationKey.isEmpty()) {
            HPersonEmailValidationKey entry =
                    emailChangeService.getActivationKey(activationKey);
            if (entry == null) {
                throw new KeyNotFoundException("activation key: "
                        + activationKey);
            }

            String checkResult = checkExpiryDate(entry.getCreationDate());

            if (StringUtils.isEmpty(checkResult)) {
                HPerson person = entry.getPerson();
                HAccount account = person.getAccount();
                if (!account.getUsername().equals(
                        identity.getCredentials().getUsername())) {
                    throw new LoginException();
                }

                person.setEmail(entry.getEmail());
                account.setEnabled(true);
                personDAO.makePersistent(person);
                personDAO.flush();
                emailChangeService.removeEntry(entry);
                FacesMessages.instance().add(
                        "You have successfully changed your email account.");
                log.info("update email address to {}  successfully",
                        entry.getEmail());
            } else {
                returnUrl = checkResult;
            }
        }
        return returnUrl;
View Full Code Here

Examples of org.zanata.model.HPersonEmailValidationKey

    public String generateActivationKey(HPerson person, String email) {
        String var = person.getId() + email + System.currentTimeMillis();
        String hash = HashUtil.generateHash(var);

        HPersonEmailValidationKey entry =
                personEmailValidationKeyDAO.findByPersonId(person.getId());
        if (entry == null) {
            entry = new HPersonEmailValidationKey(person, email, hash);
        } else {
            entry.setCreationDate(new Date());
            entry.setEmail(email);
            entry.setKeyHash(hash);
        }

        personEmailValidationKeyDAO.makePersistent(entry);
        personEmailValidationKeyDAO.flush();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.