Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Allow POST Request to /api/auth
Browse files Browse the repository at this point in the history
  • Loading branch information
xfoxfu committed Jul 27, 2015
1 parent 7152e6d commit 0820fdf
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions routes/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@ router.post('/login', require('./login'));
router.post('/reg', require('./reg'));
// GET /user/(:token)
router.get('/user', require('./user'));
// GET /auth
router.get('/auth', function (req, res, next) {
// GET /auth & POST /auth
var auth = function (req, res, next) {
var querystring = require('querystring');
var getParam = function (name) {
return req.query[name] || req.body[name];
};
res.render('api/auth', {
title: config.get('site.front'),
banner: config.get('content.front.banner'),
home_title: config.get('site.front'),
callUrl: 'rapid://authorize/?' + querystring.stringify({ app: req.query.app, callback: req.query.callback })
callUrl: 'rapid://authorize/?' + querystring.stringify(
{
app: getParam('app'),
callback: getParam('callback')
})
});
});
};
router.get('/auth', auth);
router.post('/auth', auth);

module.exports = router;

0 comments on commit 0820fdf

Please sign in to comment.