24 lines
587 B
CoffeeScript
24 lines
587 B
CoffeeScript
logger = (require 'logging').default 'info'
|
|
|
|
# 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
|