The user_signature functionality expects auth.hmac_key in the session, so,
you could add something like the following in a model file:
from gluon.storage import Storage
from gluon.utils import web2py_uuid
if not 'auth' in session:
session.auth = Storage(hmac_key=web2py_uuid())
Anthony
On Wednesday, June 21, 2017 at 3:05:38 AM UTC-4, T.R.Rajkumar wrote:
>
> Yes, Anthony now with user_signature = True prevents tampering of urls
> generated by smartgrid.
> This is when I use auth and signup and then call the grid.
> But in my app I am using custom login form with user credentials from a
> legacy table.
> Can I achieve the same result with custom login form?
> As of now in login form I set session.logged_id = True if credentials are
> OK.
> In db.py I have this function.
>
> def check_logged_in(callee):
> def wrapper():
> if session.logged_in == None:
> session.flash = 'Please login.'
> redirect(URL('login', 'login'))
> else:
> return callee()
> return wrapper
>
> and in controller I do this
> @check_logged_in
> def new_contract():
>
> With this set up if I set user_signature = True in grid it does not allow
> editing and inserting. It allows only viewing.
> How to achieve the same effect as auth using my check_logged_in function.
> Thank you for the help.
> Regards.
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.