router.js 1.31 KB
/**
 * passport路由
 * @author: leo <qi.li@yoho.cn>
 * @date: 2017/06/26
 */
'use strict';
const express = require('express');
const sms = require('./controllers/sms');
const user = require('./controllers/user');
const login = require('./controllers/login');
const router = express.Router(); // eslint-disable-line

// SMS 短信
router.post('/sms/sendCode', sms.beforeSend, sms.sendCode);
router.post('/sms/checkCode', sms.checkCode, user.userInfo);

// 第三方登录
// wechat
router.get('/login/wechat', login.wechat.login);
router.get('/login/wechat/callback', login.wechat.callback);

// 微信授权登录
router.get('/user/wechatLogin', user.wechatUserLogin);
router.get('/user/newWechatLogin', user.newWechatLogin);
router.get('/user/wechatCallback', user.wechatUserCallback);
router.get('/user/newWechatCallback', user.newWechatUserCallback);
router.get('/user/wechatInfo', user.wechatUserInfo);
router.get('/user/newWechatInfo', user.newWechatUserInfo);

// sina
router.get('/login/sina', login.sina.login);
router.get('/login/sina/callback', login.sina.callback);

// qq
// router.get('/login/qq', login.common.beforeLogin, login.qq.login);
router.get('/login/qq', login.qq.login);
router.get('/login/qq/callback', login.qq.callback);

router.post('/user/updatePhone', user.updateUserMobileByUnionId);

module.exports = router;