From b5fdfa70dedce9a799fb24cda8872a42bf4edaf3 Mon Sep 17 00:00:00 2001 From: Christopher Van Date: Fri, 16 Jan 2015 04:17:41 -0800 Subject: [PATCH] add URL route for steam authentication (issue #270) --- api/controllers/user.js | 14 ++++++++++++++ api/models/user.js | 9 +++++++++ api/routes.js | 8 ++++++++ 3 files changed, 31 insertions(+) diff --git a/api/controllers/user.js b/api/controllers/user.js index ad9a93a..4d95f7a 100644 --- a/api/controllers/user.js +++ b/api/controllers/user.js @@ -1 +1,15 @@ 'use strict'; + +var User = require('../models/user'); + + +exports.login = { + handler: function (request, reply) { + + return User.login(request.params) + .then(function (user) { + + reply(User.getPublicObj(user)); + }); + } +}; diff --git a/api/models/user.js b/api/models/user.js index 7a41455..d31ca61 100644 --- a/api/models/user.js +++ b/api/models/user.js @@ -20,6 +20,15 @@ User.getPublicObj = function (row) { }; +User.login = function () { + + return new Promise(function () { + + // TODO: Log in via Steam. + }); +}; + + User.objects = {}; diff --git a/api/routes.js b/api/routes.js index 3a85257..489de93 100644 --- a/api/routes.js +++ b/api/routes.js @@ -1,6 +1,7 @@ 'use strict'; var Game = require('./controllers/game'); +var User = require('./controllers/user'); module.exports = function (server) { @@ -109,4 +110,11 @@ EOF path: '/games/{idOrSlug}', config: Game.update }); + + + server.route({ + method: 'POST', + path: '/user/login', + config: User.login + }); };