/**
 * 登录路由分发
 *
 * @author CaiAoLin
 * @date 2017/6/1
 * @version
 */
const express = require("express");
const LoginController = require("../controllers/login_controller");


module.exports = function (app) {
    let  router = express.Router();
    let loginController = new LoginController();
    // 登录页面action
    router.get('/login', loginController.index);
    router.get('/', loginController.firstPage);

// 登录操作
    router.post('/login', loginController.login);

    router.get('/wap/reg', loginController.regPage);

    router.post('/wap/reg', loginController.reg);

    router.get('/wap/checkuser', loginController.checkUser);

    router.post('/wap/checkuser', loginController.checkUserAjax);

    // router.post('/accountIsPro', loginController.accountIsPro);

    // 验证码相关
    router.get('/captcha', loginController.captcha);

    router.get("/logout", function (req, res) {
        delete req.session.sessionUser;
        delete req.session.sessionCompilation;
        res.redirect("/login");
    });
    app.use('/',router)
};
