FUTURE LOGIC INC.
on T3

This page contains forum extracts regarding the authentication module (auth)

From http://groups.google.com/group/web2py/browse_thread/thread/b4aa14e11dc89d27
From: annet <annet.verm...@gmail.com>
Date: Mon, 18 May 2009 05:49:52 -0700 (PDT)
Local: Mon, May 18 2009 8:49 am 
Subject: Decorators in logical expressions
Is it possible to combine decorators using logical operators? e.g. 
executing a function requires membership of the group 'site' or 
membership of the group 'core' 
@auth.requires_membership('site') OR auth.requires_membership('core') 
Kind regards, 
Annet 
From: mdipierro <mdipie...@cs.depaul.edu>
Date: Mon, 18 May 2009 07:33:49 -0700 (PDT)
Local: Mon, May 18 2009 10:33 am 
Subject: Re: Decorators in logical expressions
 
not with current decorators. 
I could implement it but only with "|" not "or" since "or" cannot be 
overloaded in Python (why?). 
Massimo 
From: Yarko Tymciurak <yark...@gmail.com>
Date: Mon, 18 May 2009 17:03:27 -0500
Local: Mon, May 18 2009 6:03 pm 
Subject: Re: [web2py:22083] Re: Decorators in logical expressions
hmmmm..... do you need this?  Couldn't your decorator w/ arguments be 
written: 
@auth.requires_any_membership( *list ) 
see, for example, http://www.artima.com/weblogs/viewpost.jsp?thread=240845 
From: annet.verm...@gmail.com
Date: Tue, 19 May 2009 00:16:25 -0700 (PDT)
Local: Tues, May 19 2009 3:16 am 
Subject: Re: Decorators in logical expressions
 
Yarko, 
> Couldn't your decorator w/ arguments be written: 
> @auth.requires_any_membership( *list ) 
Like this?: 
@auth.requires_membership(['site','core']) 
def crud_address(): 
   return dict() 
@auth.requires_membership('site') 
def crud_event(): 
   return dict() 
Core is an intersection of site, for example, core manager and site 
manager both have permission to crud the address table, 
but only sitemanager has permission to create, update and delete the 
event table. 
Kind regards,
Annet.
======================================================================================

from  http://groups.google.com/ group/web2py/browse_thread/ thread/85482675720982a1

           

From: Jurgis Pralgauskis < jurgis.pralgaus...@gmail.com >

Date: Wed, 6 May 2009 06:12:29 -0700 (PDT)

Local: Wed, May 6 2009 9:12 am

Subject: weird errors (probably with crud)

 

there seems to be crud+auth problem

becauase if I not enable auth4crud

# crud.settings.auth=auth                         # (optional) enforces

authorization on crud

things work nicely

 

 

by the way,

the registration confirmation email contains very incomplete link :/

Click on the link http://...verify_email/ 6a2cd595-17a1-4044-b5ef- 1153e272f78e

to verify your email

 

 

From: mdipierro < mdipie...@cs.depaul.edu >

Date: Wed, 6 May 2009 11:48:29 -0700 (PDT)

Local: Wed, May 6 2009 2:48 pm

Subject: Re: weird errors (probably with crud)

|

It is a feature, not a bug. You are supposed to customize the message

auth.messages.verify_email =    'Click on the link

http://hostname/appname/ default/user/verify_email/%( key)s  to verify

your email'

else web2py does not know what the public URL is.

Massimo

====================================================================================

 

From http://groups.google.com/group/web2py/browse_thread/thread/63c5c76ce4f99e5d  

 

From: annet <annet.verm...@gmail.com>

Date: Wed, 6 May 2009 10:17:44 -0700 (PDT)

Local: Wed, May 6 2009 1:17 pm

Subject: requires_login(next='')

 

In t2 you could do:

@t2.requires_login(next='login') 

In tools.py

@auth.requires_login(next='../authtool/login')

doesn't work:

TypeError: requires_login() got an unexpected keyword argument 'next'

 

What's the equivalent of t2.requires_login(next='login') in tools.py?

 

In the online documentation I read:

    In your controller (for example in default.py) expose the auth

object (for example via a user action)

 

I created a controller authtool and defined the actions like this:

def register():

    return dict(form=auth.register())

def login():

    return dict(form=auth.login(next='../crudtool/index'))

....

 

Furthermore I created a controller crudtool in which I will define

crud actions. When I expose the index function in crudtool:

@auth.requires_login()

def index():

    return dict(message="hello from crudtool.py")

 

it redirects to: http://127.0.0.1:8000/mock/crudtool/user/login, but

there is no function user and args login. Whereas it should redirect

me to http://127.0.0.1:8000/mock/authtool/login I thought I would

solve this using the next attribute... 

 

Kind regards,

Annet 

 

From: mdipierro <mdipie...@cs.depaul.edu>

Date: Wed, 6 May 2009 10:45:46 -0700 (PDT)

Local: Wed, May 6 2009 1:45 pm

Subject: Re: requires_login(next='')

 

auth.settings.login_next='.....'

 

Massimo

 

 

 

===================================================================
Dutch opera  
Hi, I am trying to style the auth.login() fields and access them indivialuall 
so I can place them in separate div tags. in the html
 I tried form.custom.label.email form.custom.label.password Seemed to work. 
 What about the widget type? 
 using form.custom.input.email gave me this error AttributeError: 'NoneType' object
 has no attribute 'email' How do I also access the submit widget? 
 e.g. form.custom.submit... Thanks
  Aug 8, 10:28 am
 
Fran  
Aug 8, 10:35 am
On Aug 8, 3:28 pm, Dutch opera <dutchop...@gmail.com> wrote: 
> I am trying to style the auth.login() fields and access them 
> indivialuall so I can place them in separate div tags. 
> in the html I tried 
> form.custom.label.email 
> form.custom.label.password 
> Seemed to work.  What about the widget type?  using 
> form.custom.input.email gave me this error 
> AttributeError: 'NoneType' object has no attribute 'email' 
form.custom.widget.email 
> How do I also access the submit widget?  e.g. form.custom.submit... 
Yes: form.custom.submit 
F
 
Dutch opera  
Aug 8, 10:36 am
PS... 
I tried the following.. 
<input type="text" value="{ {=form.custom.inpval.email} }"/> 
<input type="password" value="{ {=form.custom.inpval.password} }"/> 
This the correct? 
If so...all that is left to do is to get the submit widget.  How do I 
do that? 
Thanks 
 
Dutch Opera  
Aug 8, 11:16 am
Oh...widget is literal...lol.... 
I added 
<form method=post/> 
{ {=form.custom.widget.email} } 
{ {=form.custom.widget.password} } 
{ {=form.custom.submit} } 
</form> 
but...would not work...just brought be back to the login page.  form 
{ {=form} } works... 
 
Dutch opera  
View profile  
 More options Aug 8, 12:00 pm
Thanks 
I just added I justed added { {=form.hidden_fields()} } and it 
worked...and it worked..yeah... 
 
mdipierro  
View profile  
 More options Aug 8, 12:12 pm
If you use 
{ {=form.custom.begin} } 
{ {=form.custom.widget.email} } 
{ {=form.custom.widget.password} } 
{ {=form.custom.submit} } 
{ {=form.custom.end} } 
you do not need to add the hidden fields. 
Dutch opera  
Hi, I am trying to style the auth.login() fields and access them indivialuall 
so I can place them in separate div tags. in the html
 I tried form.custom.label.email form.custom.label.password Seemed to work. 
 What about the widget type? 
 using form.custom.input.email gave me this error AttributeError: 'NoneType' object
 has no attribute 'email' How do I also access the submit widget? 
 e.g. form.custom.submit... Thanks
  Aug 8, 10:28 am
 
Fran  
Aug 8, 10:35 am
On Aug 8, 3:28 pm, Dutch opera <dutchop...@gmail.com> wrote: 
> I am trying to style the auth.login() fields and access them 
> indivialuall so I can place them in separate div tags. 
> in the html I tried 
> form.custom.label.email 
> form.custom.label.password 
> Seemed to work.  What about the widget type?  using 
> form.custom.input.email gave me this error 
> AttributeError: 'NoneType' object has no attribute 'email' 
form.custom.widget.email 
> How do I also access the submit widget?  e.g. form.custom.submit... 
Yes: form.custom.submit 
F
 
Dutch opera  
Aug 8, 10:36 am
PS... 
I tried the following.. 
<input type="text" value="{ {=form.custom.inpval.email} }"/> 
<input type="password" value="{ {=form.custom.inpval.password} }"/> 
This the correct? 
If so...all that is left to do is to get the submit widget.  How do I 
do that? 
Thanks 
 
Dutch Opera  
Aug 8, 11:16 am
Oh...widget is literal...lol.... 
I added 
<form method=post/> 
{ {=form.custom.widget.email} } 
{ {=form.custom.widget.password} } 
{ {=form.custom.submit} } 
</form> 
but...would not work...just brought be back to the login page.  form 
{ {=form} } works... 
 
Dutch opera  
View profile  
 More options Aug 8, 12:00 pm
Thanks 
I just added I justed added { {=form.hidden_fields()} } and it 
worked...and it worked..yeah... 
 
mdipierro  
View profile  
 More options Aug 8, 12:12 pm
If you use 
{ {=form.custom.begin} } 
{ {=form.custom.widget.email} } 
{ {=form.custom.widget.password} } 
{ {=form.custom.submit} } 
{ {=form.custom.end} } 
you do not need to add the hidden fields. 
====================================================================