I had a working login form for my web2py app.
I don’t know what I changed but after login is performed the app returns me the invalid function default/user msg.
I was using auth.settings.controller=”user” to be redirected to the right controler. Now it doesn’t work.
App should go back to the page it came from. only with logged in user
Right after solving this i am installing myself a SVN but until then.
I really don’t know what to do
I am alo using auth.navbar()
my auth in view is {{=’auth’ in globals() and
auth.navbar(separators=(‘ ‘,’ | ‘,”))}}
my user controler user.py is
def user():
form = auth()
return dict(form=form)
and my user.py model is
if (request.controller==’user’ or request.controller==’school’ or request.controller==’timetable’ and request.cookies.has_key(‘mycookie’)):
response.generic_patterns = [‘*’] if request.is_local else []
database = request.cookies[‘mycookie’].value
baza = DAL(‘postgres://postgres:postgres@localhost/’ + database, migrate=True)
from gluon.tools import Mail
auth = Auth(baza)
auth.settings.logout_next=URL('school','index?school=' + database)
auth.settings.registration_requires_approval = True
#auth.settings.reset_password_requires_verification = True
#auth.settings.login_after_registration = False
auth.settings.register_onaccept=lambda form: mail.send(to=['vid.ogris@algit.si'],
subject='web2py registration',
# If reply_to is omitted, then mail.settings.sender is used
reply_to='us@example.com',
message='Kreiral se je nov uporabnik, ki ga je potrebno potrditi')
auth.settings.expiration = 3600
auth.define_tables()
mail=Mail()
auth.settings.mailer=mail
mail.settings.server='smtp.gmail.com:587'
mail.settings.sender='xxx@gmail.com'
mail.settings.login='xxx@gmail.com:xxx'
#auth.settings.registration_requires_verification = True
auth.messages.registration_pending = u'Registracija je v postopku odobritve. Ko bo vaš račun potrjen boste prejeli e-mail.'
auth.messages.invalid_login = 'Nepravilno geslo'
auth.messages.invalid_user = 'Uporabnik ne obstaja'
auth.settings.controller="user"
## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in private/janrain.key
from gluon.contrib.login_methods.rpx_account import use_janrain
use_janrain(auth,filename='private/janrain.key')
Sometimes comments in html are not only comments 🙂 I removed a line containing auth.register(), even though I though it was commented, and now it works