Suggestion 1: check whether 'user' has a value after this line: >>user = auth.login_bare("titi",password) If user is None then maybe you didn't create the user properly.
Suggestion 2: This function may be useful: (in Auth) get_or_create_user() I don't think it is documented in the book at present. On Sunday, 25 March 2012 19:45:51 UTC+1, bussiere adrien wrote: > > It still redirect me to the the auth page with the login form .... > > Bussiere > > Le dimanche 25 mars 2012 19:37:44 UTC+2, Vasile Ermicioi a écrit : >> >> that works for me >> >> def test(): >> password="toto" >> my_crypt = CRYPT(key=auth.settings.hmac_key) >> crypt_pass = my_crypt(password)[0] >> if db(db.auth_user.email == 'email5@toto').count() == 0: >> db.auth_user.insert( >> Surnom="Surnom", >> email="email5@toto", >> username="titi", >> password=crypt_pass, >> ) >> db.commit() >> user = auth.login_bare("titi",password) >> redirect(URL(request.controller, 'inscriptioninvit')) >> return dict() >> >> @auth.requires_login() >> def inscriptioninvit(): >> return "hello" >> >