OK Thadeus & Massimo, I agree now that you're right that the way to do it is as you showed using SQLFORM.factory and then a custom form. Then do my own form validation etc. and forget using the default registration code.
Doing the custom controller is the same as any other controller and gives you all the control and flexibility you need. I guess I was just being lazy. Thanks again, Richard On May 24, 11: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.- Hide quoted text - > > - Show quoted text -