public UnifiedUser save(String username, String email, String password,
String ip, Boolean activation, EmailSender sender,
MessageTemplate msgTpl) throws UnsupportedEncodingException, MessagingException {
Date now = new Timestamp(System.currentTimeMillis());
UnifiedUser user = new UnifiedUser();
user.setUsername(username);
user.setEmail(email);
user.setPassword(pwdEncoder.encodePassword(password));
user.setRegisterIp(ip);
user.setRegisterTime(now);
user.setLastLoginIp(ip);
user.setLastLoginTime(now);
user.setActivation(activation);
user.init();
dao.save(user);
if (!activation) {
String uuid = StringUtils.remove(UUID.randomUUID().toString(), '-');
user.setActivationCode(uuid);
senderEmail(username, email, uuid, sender, msgTpl);
}
return user;
}