Are you sure min form IS_STRONG is apply?
It may be override by the empty CRYPT()??
CRYPT has min_length that could be used for that and if you want to use the
default of auth here you go :
CRYPT(min_length=auth.settings.password_min_length,
error_message=T('too short'))
Richard
On Mon, Mar 12, 2012 at 3:38 PM, Cliff <[email protected]> wrote:
> This works.
>
> custom_auth_table.password.requires = CRYPT()
> if request.args(0) != 'login':
> custom_auth_table.password.requires = [
> IS_STRONG(min=12, max=128, upper=None, lower=None,
> number=None, special=None, error_message=' '),
> CRYPT()
> ]
>
> Could also be handled in default.py.
>
> On Mar 12, 3:06 pm, Bruce Wade <[email protected]> wrote:
> > error_message = '' and error_message = None are treated as the samething.
> >
> > Try:
> > error_message = ' '
> >
> > Haven't tried but that may give you a black message like you want.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Mar 12, 2012 at 12:02 PM, Cliff <[email protected]> wrote:
> > > My login is pretty much vanilla Web2py. No changes to default.py
> > > users.
> >
> > > In the model I have this:
> >
> > > comment = ''
> > > if request.controller=='auth_user':
> > > comment = SPAN('Must be at least 12 characters in length',
> > > _style='color:orange;'
> > > )
> > > db.define_table(
> > > auth.settings.table_user_name,
> > > Field('first_name', length=128, default=''),
> > > Field('middle_name', length=128, default=''),
> > > Field('last_name', length=128, default=''),
> > > Field('generation', length=128, default=''),
> > > Field('email', length=128, default='', unique=True,
> > > comment=email_comment), # required
> > > Field('password', 'password', length=128, # required
> > > readable=False, label='Password',
> > > comment=comment),
> > > ),
> > > # .... blah blah more details + required fields
> > > )
> >
> > > custom_auth_table.password.requires = [
> > > IS_STRONG(min=12, max=128, upper=None, lower=None,
> > > number=None, special=None,), CRYPT()
> > > ]
> >
> > > If I set error_message to an empty string or None in the model,
> > > attempting to log in with password 'foo' causes the error banner
> > > to appear with "None" as the caption. If I don't set error_message
> > > I get the banner with the error message from IS_STRONG().
> >
> > > What am I doing wrong? What can I do about this?
> >
> > --
> > --
> > Regards,
> > Bruce Wadehttp://
> ca.linkedin.com/in/brucelwadehttp://www.wadecybertech.comhttp://www.warplydesigned.comhttp://www.fitnessfriendsfinder.com
>