本文整理汇总了Java中org.iatoki.judgels.play.JudgelsPlayUtils.hashMD5方法的典型用法代码示例。如果您正苦于以下问题:Java JudgelsPlayUtils.hashMD5方法的具体用法?Java JudgelsPlayUtils.hashMD5怎么用?Java JudgelsPlayUtils.hashMD5使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.iatoki.judgels.play.JudgelsPlayUtils
的用法示例。
在下文中一共展示了JudgelsPlayUtils.hashMD5方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerUser
import org.iatoki.judgels.play.JudgelsPlayUtils; //导入方法依赖的package包/类
@Override
public String registerUser(String username, String name, String email, String password) throws IllegalStateException {
try {
UserModel userModel = new UserModel();
userModel.username = username;
userModel.name = name;
userModel.password = PasswordHash.createHash(password);
userModel.profilePictureImageName = "avatar-default.png";
userModel.roles = "user";
userDao.persist(userModel, "guest", IdentityUtils.getIpAddress());
String emailCode = JudgelsPlayUtils.hashMD5(UUID.randomUUID().toString());
UserEmailModel emailModel = new UserEmailModel(email, emailCode);
emailModel.userJid = userModel.jid;
userEmailDao.persist(emailModel, "guest", IdentityUtils.getIpAddress());
return emailCode;
} catch (ConstraintViolationException | NoSuchAlgorithmException | InvalidKeySpecException e) {
throw new IllegalStateException(e);
}
}
示例2: createContestTeam
import org.iatoki.judgels.play.JudgelsPlayUtils; //导入方法依赖的package包/类
@Override
public ContestTeam createContestTeam(String contestJid, String name, File teamImage, String extension, String userJid, String userIpAddress) throws IOException {
ContestModel contestModel = contestDao.findByJid(contestJid);
ContestTeamModel contestTeamModel = new ContestTeamModel();
contestTeamModel.contestJid = contestModel.jid;
contestTeamModel.name = name;
contestTeamModel.teamImageName = "team-default.png";
contestTeamDao.persist(contestTeamModel, userJid, userIpAddress);
String newImageName = contestTeamModel.jid + "-" + JudgelsPlayUtils.hashMD5(UUID.randomUUID().toString()) + "." + extension;
teamAvatarFileSystemProvider.uploadFile(ImmutableList.of(), teamImage, newImageName);
teamAvatarFileSystemProvider.makeFilePublic(ImmutableList.of(newImageName));
contestTeamModel.teamImageName = newImageName;
contestTeamDao.edit(contestTeamModel, userJid, userIpAddress);
contestDao.edit(contestModel, userJid, userIpAddress);
return createContestTeamFromModel(contestTeamModel, ImmutableList.of(), ImmutableList.of());
}
示例3: updateContestTeam
import org.iatoki.judgels.play.JudgelsPlayUtils; //导入方法依赖的package包/类
@Override
public void updateContestTeam(String contestTeamJid, String name, File teamImage, String extension, String userJid, String userIpAddress) throws IOException {
ContestTeamModel contestTeamModel = contestTeamDao.findByJid(contestTeamJid);
String newImageName = contestTeamModel.jid + "-" + JudgelsPlayUtils.hashMD5(UUID.randomUUID().toString()) + "." + extension;
teamAvatarFileSystemProvider.uploadFile(ImmutableList.of(), teamImage, newImageName);
teamAvatarFileSystemProvider.makeFilePublic(ImmutableList.of(newImageName));
contestTeamModel.name = name;
contestTeamModel.teamImageName = newImageName;
contestTeamDao.edit(contestTeamModel, userJid, userIpAddress);
ContestModel contestModel = contestDao.findByJid(contestTeamModel.contestJid);
contestDao.edit(contestModel, userJid, userIpAddress);
}
示例4: forgotPassword
import org.iatoki.judgels.play.JudgelsPlayUtils; //导入方法依赖的package包/类
@Override
public String forgotPassword(String username, String email) {
UserModel userModel = userDao.findByUsername(username);
String code = JudgelsPlayUtils.hashMD5(UUID.randomUUID().toString());
UserForgotPasswordModel forgotPasswordModel = new UserForgotPasswordModel();
forgotPasswordModel.userJid = userModel.jid;
forgotPasswordModel.code = code;
forgotPasswordModel.used = false;
userForgotPasswordDao.persist(forgotPasswordModel, "guest", IdentityUtils.getIpAddress());
return code;
}
示例5: updateProfilePicture
import org.iatoki.judgels.play.JudgelsPlayUtils; //导入方法依赖的package包/类
@Override
public String updateProfilePicture(String userJid, File imageFile, String extension) throws IOException {
String newImageName = IdentityUtils.getUserJid() + "-" + JudgelsPlayUtils.hashMD5(UUID.randomUUID().toString()) + "." + extension;
List<String> filePath = ImmutableList.of(newImageName);
avatarFileSystemProvider.uploadFile(ImmutableList.of(), imageFile, newImageName);
avatarFileSystemProvider.makeFilePublic(filePath);
UserModel userModel = userDao.findByJid(userJid);
userModel.profilePictureImageName = newImageName;
userDao.edit(userModel, IdentityUtils.getUserJid(), IdentityUtils.getIpAddress());
return newImageName;
}