Why are you reinventing the wheel? Why are you not using?

def login(): return dict(form=auth.login())

We can make your form work but it would still miss lots and lots of
stuff from auth.

On May 16, 8:20 pm, "[email protected]" <[email protected]>
wrote:
> i have made a form using the controller:
> def login():
>     store.person.email.requires=IS_NOT_EMPTY()
>     form=SQLFORM(store.person,fields=['email','password'])
>     if FORM.accepts(form,request.vars,session):
>        users=store(store.person.email==form.vars.email)\
>                (store.person.password==form.vars.password).select()
>        if len(users):
>           session.authorized=users[0].id
>           session.email=users[0].email
>           session.alias=users[0].alias
>           session.flash='user logged in'
>           redirect(URL(r=request,f='index'))
>        else:
>           form.errors['password']='invdalid password'
>     return dict(form=form)
>
> I could try to get from the scaffolding html that {{=form}} makes. the
> dicv:  #person_password and #person_email
> and style a bit the forms. but thats almost like. i have the most
> beautiful LCD in the world but renders just the half of the image.
> anyways i am not a css expert to take those tables and arrange them on
> the page.
> i'd like the login form horizontal and with different sizez how can i
> do that ?
> i even tried replacing the :
>     store.person.email.requires=IS_NOT_EMPTY()
>     form=SQLFORM(store.person,fields=['email','password'])
>
> with :
>
>  form=FORM(TABLE(TR("User
> Name:",INPUT(_name="email",requires=IS_NOT_EMPTY())),
>
> TR("Password:",INPUT(_name="password",_type='password',
>
> requires=[IS_NOT_EMPTY(),CRYPT()])),
>                     TR("",INPUT(_type="submit",_value="login"))))
>
> But hell knows why is not working. i get invalid password (i have
> tried with long passwords - i tried all knid of password. even asked
> on irc on freenode nobody seems to know why this trick is not working)
>
> I also tried to follow the example from the slide. when i try to login
> nothing happens.
> tried about two methods that i found here in the group even nobody
> said they will work . still nothing. tried to follow examples from
> other apps but not a single app has a login form costumized.
> Please i lost a night
> PLease someone...light me!!!
>
> Its such a pity that so common and easy things have such hard ways.

Reply via email to