after successful registration user should be logged in

This commit is contained in:
Edin Dazdarevic
2015-03-03 22:19:41 +01:00
parent 9ebb4769af
commit 38de717da9
5 changed files with 26 additions and 18 deletions

View File

@@ -36,7 +36,8 @@ post '/user' do
user.from_json(json, false)
if user.save
{:status => "ok"}.to_json
response.set_cookie('ribica_auth', :path=> '/', :httponly => true, :value=>user.id, :expires=>Time.now+100.year)
user.to_json(except: 'password_digest')
else
status 400
user.errors.to_json