This repository has been archived on 2024-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
node-fftcg/backend/routes/user/info.coffee

25 lines
593 B
CoffeeScript
Raw Normal View History

2019-05-09 12:32:28 +00:00
logger = (require 'logging').default '/user/info'
2019-05-09 12:31:54 +00:00
# session storage (volatile data)
session = (require '../../session')
module.exports =
url: '/user/info'
method: 'POST'
schema: (require './info.schema')
handler: (request, reply) ->
session.check request.body.session ? ""
.then (user) ->
# active session found
logger.debug "OK '#{user.login}' got info"
reply.send
success: true
user: user
.catch ->
# no session found
logger.info "FAIL '#{request.body.session}' session not found"
reply.send
success: false