20 lines
508 B
CoffeeScript
20 lines
508 B
CoffeeScript
|
|
module.exports = (SHARE) ->
|
||
|
|
url: '/user/register'
|
||
|
|
method: 'POST'
|
||
|
|
schema: SHARE.jsonschemas.user
|
||
|
|
|
||
|
|
handler: (request, reply) ->
|
||
|
|
SHARE.fftcgdb.register(request.body.login, request.body.password)
|
||
|
|
.then (user) ->
|
||
|
|
SHARE.logger.info "OK registration '#{request.body.login}'"
|
||
|
|
reply.send
|
||
|
|
success: true
|
||
|
|
user: user
|
||
|
|
return
|
||
|
|
|
||
|
|
.catch (err) ->
|
||
|
|
SHARE.logger.debug "FAIL registration '#{request.body.login}'"
|
||
|
|
reply.send
|
||
|
|
success: false
|
||
|
|
err: err
|