This may be a stupid question but...

Why are you not using form.custom ?


{{form.custom.start}}

<fieldset>{{form.custom.email.widget}}</fieldset>
--
Thadeus





On Mon, May 24, 2010 at 11:15 PM, Thadeus Burgess <thade...@thadeusb.com> wrote:
> Wait... Doesn't web2py already have this built in?
>
> Maybe I don't understand the question...
>
> Using a plain vanilla `form = auth()` You get a register form...
>
> http://thadeusb.com/admin/user/register
>
> --
> Thadeus
>
>
>
>
>
> On Mon, May 24, 2010 at 10:57 PM, Thadeus Burgess <thade...@thadeusb.com> 
> wrote:
>> Stick the following code in a controller
>>
>>
>> import copy
>>
>> user_table = [copy.copy(f) for f in db.auth_user]
>> form = SQLFORM.factory(
>>    *user_table,
>>    Field('password2', 'password', length=512,
>> requires=db.auth_user.password.requires),
>> )
>>
>> if form.accepts(request.vars, session):
>>    if form.vars.password == form.vars.password2:
>>        user = db.auth_user.insert(
>>            first_name = form.vars.first_name,
>>            last_name = form.vars.last_name,
>>            username = form.vars.username,
>>            password = form.vars.password,
>>            registration_key = web2py_uuid(),
>>        )
>>
>>        if auth.settings.create_user_groups:
>>            group_id = auth.create_group("user_%s" user.id)
>>
>>        # etc etc for sending mail
>>
>>        # to auto log them in
>>        session.auth = Storage(user = user, last_visit = request.now,
>>                expiration = auth.settings.expiration)
>>    else:
>>        form.errors.password = form.errors.password2 = "Passwords do not 
>> match"
>>
>> Of course, you lose some of the finer things such as sending emails,
>> which could be added by looking at tools.py
>>
>> --
>> Thadeus
>>
>>
>>
>>
>>
>> On Mon, May 24, 2010 at 7:39 PM, weheh <richard_gor...@verizon.net> wrote:
>>> @mdp: It isn't obvious to me how to mix the auth code with
>>> SQLFORM.factory and accept. The problem is that auth is such a black
>>> box that I don't know where to break into the flow of it.
>>>
>>> I believe this issue has come up enough times and been such a
>>> consistent stumbling block that I suggest you or someone else spell it
>>> out concretely (show the model, controller, and view) and put it
>>> either in the doc or in Alterego or somewhere findable. I can't
>>> imagine it's more than 20 or 30 lines of code total and would save
>>> loads of time and effort in the long run.
>>>
>>
>

Reply via email to