I use auth.login_bare function. Just post user and password to it. It will do the rest of the job.
http://zerp.ly/rochacbruno Em 28/09/2011 06:15, "Marek Mollin" <rog...@gmail.com> escreveu: > Hello, > > I am wondering how to properly do an ajax login. I will be doing the > whole thing with jquery ajax. I use it for a lot of stuff, I hav ajax > controller that handles getting data from models and returns jsons. It > works just fine... > > Yet when it comes to login, the whole auth seems to me to be too > closely coupled with view. > What I would like to have is function in my ajax controller. Named > login it would take from request.vars.login, request.vars.password. > Then I would just fire up auth.login(request.vars.login, > request.vars.password) and I am logged. > > Do I have to go all the way to getting a user from database, hashing a > password, and checking if its ok, than manually adding session.vars?