Search in sources :

Example 11 with DesRun

use of com.bc.pmpheep.back.util.DesRun in project pmph by BCSquad.

the class JavaMailSenderUtil method JavaMailSenderConfig.

/**
 * <pre>
 * 功能描述:邮件配置
 * 使用示范:
 *
 * @return
 * </pre>
 */
private MimeMessage JavaMailSenderConfig(JavaMailSenderImpl senderImpl) {
    properties = PropsUtil.loadProps("mail.properties");
    // senderImpl.setHost("smtp.qq.com");// 发送邮件服务器
    // 发送邮件服务器
    senderImpl.setHost(PropsUtil.getString(properties, "mail.smtp.host"));
    // 端口号,腾讯邮箱使用SSL协议端口号:465/587,163邮箱使用SSL协议端口号:465/994
    // 腾讯邮箱使用非SSL协议,163邮箱,新浪邮箱端口号都是:25
    senderImpl.setPort(PropsUtil.getInt(properties, "mail.smtp.port"));
    // 用户名
    senderImpl.setUsername(PropsUtil.getString(properties, "mail.smtp.username"));
    // 密码
    senderImpl.setPassword(new DesRun(PropsUtil.getString(properties, "mail.smtp.password")).depsw);
    // 参数配置
    Properties prop = new Properties();
    // 使用SSL协议
    prop.put("mail.smtp.ssl.enable", PropsUtil.getString(properties, "mail.smtp.ssl.enable"));
    prop.put("mail.smtp.socketFactory.class", PropsUtil.getString(properties, "mail.smtp.socketFactory.class"));
    // 是否需要验证密码
    prop.put("mail.smtp.auth", PropsUtil.getString(properties, "mail.smtp.auth"));
    // 超时时间
    prop.put("mail.smtp.timeout", PropsUtil.getString(properties, "mail.smtp.timeout"));
    senderImpl.setJavaMailProperties(prop);
    // 创建一个邮件消息
    MimeMessage mailMessage = senderImpl.createMimeMessage();
    return mailMessage;
}
Also used : MimeMessage(javax.mail.internet.MimeMessage) DesRun(com.bc.pmpheep.back.util.DesRun) Properties(java.util.Properties)

Example 12 with DesRun

use of com.bc.pmpheep.back.util.DesRun in project pmph by BCSquad.

the class WriterLoginController method logout.

/**
 * <pre>
 * 功能描述:退出
 * 使用示范:
 *
 * &#64;param model
 * &#64;return
 * </pre>
 */
@ResponseBody
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public ResponseBean logout(HttpServletRequest request, @RequestParam("loginType") Short loginType) {
    String sessionId = CookiesUtil.getSessionId(request);
    HttpSession session = SessionContext.getSession(new DesRun(sessionId).depsw);
    if (ObjectUtil.notNull(session)) {
        if (Const.LOGIN_TYPE_WRITER == loginType) {
            // 清除User信息
            session.removeAttribute(Const.SESSION_WRITER_USER);
            // 清除token
            session.removeAttribute(Const.SEESION_WRITER_USER_TOKEN);
        }
    }
    return new ResponseBean();
}
Also used : HttpSession(javax.servlet.http.HttpSession) DesRun(com.bc.pmpheep.back.util.DesRun) ResponseBean(com.bc.pmpheep.controller.bean.ResponseBean) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

DesRun (com.bc.pmpheep.back.util.DesRun)12 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)9 PmphUser (com.bc.pmpheep.back.po.PmphUser)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 WriterUser (com.bc.pmpheep.back.po.WriterUser)4 ResponseBean (com.bc.pmpheep.controller.bean.ResponseBean)4 HashMap (java.util.HashMap)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 PmphRole (com.bc.pmpheep.back.po.PmphRole)3 OrgUser (com.bc.pmpheep.back.po.OrgUser)2 PmphUserWechat (com.bc.pmpheep.back.po.PmphUserWechat)2 OAuthRequired (com.bc.pmpheep.wechat.interceptor.OAuthRequired)2 ArrayList (java.util.ArrayList)2 HttpSession (javax.servlet.http.HttpSession)2 Org (com.bc.pmpheep.back.po.Org)1 PmphDepartment (com.bc.pmpheep.back.po.PmphDepartment)1 PmphUserRole (com.bc.pmpheep.back.po.PmphUserRole)1 WriterProfile (com.bc.pmpheep.back.po.WriterProfile)1 SsoHelper (com.bc.pmpheep.utils.SsoHelper)1 Gson (com.google.gson.Gson)1