1. This should work @auth.requires_login_or_token() @auth.requires_membership('whatever') def youtfunction():....
2. yes that is correct (except it is _token=, not token=). Just mind that the token is as good as a password and may be unsafe to send it via email. If if you need it, you can do it. On Monday, 29 June 2015 12:01:36 UTC-5, Pablo Angulo wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > ok, thanks! > > But I have two questions: > 1. what can I do with auth.requires_membership and > auth.requires(custom_function), which I use a lot? > 2. so if I have to send an email, all I have to do is find the use token > in the database with: > > user_token = db.auth_token(user_id).token > > and then use that in the url: > > body = template%dict(link=URL(c=controller, f=function, vars=dict(a=1,b=2, > token=user_token))) > > is that correct? If it is, it's awesome! > > El 29/06/15 a las 17:32, Massimo Di Pierro escribió: > > You can use these tokens for your purpose. You would also have to do (in > models/db.py) > > > > auth.requires_login = auth.requires_login_or_token > > > > In the general case the user many want to allow the token only on some > API so we want to distinguish. > > > > Massimo > > > > On Monday, 29 June 2015 09:25:35 UTC-5, p...@cancamusa.net wrote: > > > > Hello: > > > > I'm actually interested in a way to send user notification emails > with custom links, so that a click sends the user to the website and also > logs the user in automatically. > > > > Is that what these tokens are for? If they are, I don't see why I > would use the decorator requires_login some times, and > requires_login_or_token other times. > > > > But I'm afraid this is not their goal, is it? > > > > -- > > 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 a topic in the > Google Groups "web2py-users" group. > > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/QtP9re5WqqE/unsubscribe. > > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com > <mailto:web2py+unsubscr...@googlegroups.com> > <web2py+unsubscr...@googlegroups.com>. > > For more options, visit https://groups.google.com/d/optout. > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2 > > iQIcBAEBCAAGBQJVkXneAAoJEATsOw+FDrzIFloQAIYv09fk+uXW+kynEW4ZyxrP > HwjxVlEcDKUtFVLTpCCAI11nI4Mw/h+OSxfZ59wYVwEHGrz3bVrpwvB5auIwWvRR > 1AH1h50TW6s/vkjF6/23NEYm2nLV6oPpKN/Evj4YDhAYFTb9VuWQoxEuW/Sjyf47 > cUADobtBXKCAsXhXwGdZeO3bNRr+RNN5M3tmrOo4qxorK+gB3ExRLLS6NUCHHy+0 > JHKTF4T2aP9GZoWDVElu+yrHwWsGf9qduf0Jj+YT8U4/5ac/f8fYCAPHQ8RmZa38 > 8GJKXh0Gb1c03aeu11ygPSFGxcuuZumQwpmcWFnH15qvs2UJtnEiy0xZOMEYe/cl > qcttu7GApclDTeYro6zHrmDKTFQHZ2FRmab/JsOBri705qGoB7i3O8QgnYb/57gf > 5TamJsQD4rVkxKz2J7M66/vA+bYJ7O0HtgVyI2tuBnkVWjJ/p+FdvurPOF9pH9Le > AgzNaoh0OcuXQBgHcGORPIs07hLRppxQ0A1aiXYsu5asTW9q4CiZO/phfxdIX3da > 8NpDgINhxjAEBJfnBmE3Qijoae9ysxW6z/BcaywjEWlXL7g9P3m3D0ZNKQ4pM+VP > u6PWvbbYrxZKpLEdyIsCr99EWleKUggvhagWtw5cZKFcF3auHppI2ZESTv5I919L > DMJPaZsu0diR4lOVIr6i > =0m8I > -----END PGP SIGNATURE----- > > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.