当前位置: 首页>>代码示例>>Java>>正文


Java JudgelsPlayUtils.hashMD5方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:24,代码来源:UserAccountServiceImpl.java

示例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());
}
 
开发者ID:judgels,项目名称:uriel,代码行数:24,代码来源:ContestTeamServiceImpl.java

示例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);
}
 
开发者ID:judgels,项目名称:uriel,代码行数:17,代码来源:ContestTeamServiceImpl.java

示例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;
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:14,代码来源:UserAccountServiceImpl.java

示例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;
}
 
开发者ID:judgels-deprecated,项目名称:judgels-jophiel,代码行数:14,代码来源:UserProfileServiceImpl.java


注:本文中的org.iatoki.judgels.play.JudgelsPlayUtils.hashMD5方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。