Pregunta

When logging in/out using the default Auth forms, a flash notification message appears in a box, "Logged in" and "Logged out" respectively. How do I make it so these messages do not appear?

¿Fue útil?

Solución 2

user3283690 answer gave me the idea that setting the message to the empty string was all that was needed to stop the flash message from showing. This makes sense because the following line in layout.html:

<div class="flash">{{=response.flash or ''}}</div>

Looking at the Auth class in [web2py-root-directory]/gluon/tools.py I saw there was dictionary called default_messages with entries for logged_in and logged_out. So I tried setting the following in db.py:

auth.messages.logged_in = None
auth.messages.logged_out = None

And it worked

Otros consejos

In language folder I edited default.py from

'Logged in': 'Logged in',

to

'Logged in': '',

That removes the message. But I guess you have to do the same change for all language files you wanna use.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top