I am trying to make a simple authentication system for a Sinatra app, and I found that warden is probably the best bet. I have found numerous examples on how to use it. I started working from the examples by sklise.
I quickly run into the problem of signing up. See that it is possible to create a new user with something like
post '/auth/signup' do
u = User.new(:username => params[:username], :password => params[:password])
u.save
But then what? How can I authenticate / sign this brand new user in? I cannot seem to find any single reference to how a sign up feature should be built with sinatra + warden. As a matter of fact, I can't seem to find anything for warden at all. None of the examples on the Warden wiki has a sign up feature. Do anyone have a solution for this?
Thanks
Not exactly a warden aficionado, but this looks like where you want to look:
From your example I think you'd want to do something like this:
post '/auth/signup' do
u = User.new(:username => params[:username], :password => params[:password])
u.save
env['warden'].success!(u)
...