Re: [Phplib-users] User Self-Registration
Brought to you by:
nhruby,
richardarcher
From: Nathaniel P. <np...@te...> - 2003-07-22 20:00:40
|
Hmmm... I don't personally use default authentication much in any of my apps, and haven't yet done anything with it that involves self-registration, but, as far as I can tell, 'reg' mode with default auth works just like 'log' mode with default auth. In other words, it shouldn't matter what mode you use with default auth, logging in should work just the same with either. As with 'log' mode, you will still need to make sure there is a link or something to allow the user to start the login/registration process when s/he is on a page with default auth, but that should work exactly the same in either case. You'll want to experiment with it to see what works, of course, but I don't see any reason why it shouldn't. Hope that helps... _________________________________ Nathaniel Price <np...@te...> Webmaster ----- Original Message ----- From: "Virilo Tejedor Aguilera" <vi...@su...> To: "Nathaniel Price" <np...@te...>; <php...@li...> Sent: Tuesday, July 22, 2003 11:46 AM Subject: Re: [Phplib-users] User Self-Registration > Thanks for your help. > I've already seem the scheme ( > http://www.drostan.org/Application/webdev/uod/auth_phplib.php ). It's so > explanatory. > > My problem is that im using default authentication -all users begin being > user: nobody- and I want allow users register/login when they prefer. In > this manner you can visit the page without login, and you arent forced to > register/login as first step. > > I've understood that I'm supposed to write a register form, and a register > script (that I would like to auto login user as the new identity -like > Daniel Cunningham example-) without the necessity to write doregister() > function. Perhaps I will have to do the same with login form. > > In other words, i haven't seen in the scheme the path using reg mode and > default authentication at the same time (there is no scheme for default > authentication). > > I think that this escapes to the normal way to use phplib authentication > with 'reg' mode. I would like to be mistaken! > > Thanks again. > > Virilo Tejedor. Email: vi...@su... > > > ----- Original Message ----- > From: "Nathaniel Price" <np...@te...> > To: "Virilo Tejedor" <vi...@su...>; > <php...@li...> > Sent: Tuesday, July 22, 2003 6:51 PM > Subject: Re: [Phplib-users] User Self-Registration > > > > > > ----- Original Message ----- > > From: "Virilo Tejedor" <vi...@su...> > > To: <php...@li...> > > Sent: Monday, July 21, 2003 2:41 PM > > Subject: [Phplib-users] User Self-Registration > > > > > > > Some years ago Daniel Cunningham wrote: > > > > > > (this is an extract from the original message: > > > http://marc.theaimsgroup.com/?l=phplib&m=94101973230198 ) > > > > > > > ... > > > > > > > > > > > I'd like for my users to be able to push a button and go to another > > > > form and setup a username/password for their account. In > > > > other words, self-registration, using a form, and overrides of the > > > > auth_registerform() and auth_doregister() methods. > > > > > > > There are great examples of the former ( auth_loginform() and > > > > auth_validatelogin() ) but not the latter ( auth_registerform() > > > > and auth_doregister() ). There are also examples for an admin > > > > type user to add user records, but that's not what we want. > > > > > > > We just want a form with straight-forward self-service > non-privileged > > > > "enter your own test username and password" , and once we've > > > > validated the username against other entries in the auth_users > table, > > > > we would setup a username/password and priv="user" entry. > > > > > > > And also hopefully synchronize this auth_user entry with the > > > > existing session ID so that the user is not forced to re-login via > > > > the auth_login() and auth_validatelogin() methods. > > > > > > Im interested in the same. Finally he ofers us his own implementation. > Has > > > anybody a better solution? anymore about it? > > > > > > > > > Thanks in advance. Sorry for my english, my spanish is better. > > > > > > Virilo Tejedor. Email: vi...@su... > > > > > > > If all you are doing is wanting to use the same form for both user login > and > > user registration, it should be fairly straightforward. In your Auth > > subclass, you would set the $mode to 'reg', setup auth_registerform() to > > display the registration form (if this is the same as the normal login > form, > > you could probably just have it in turn call auth_loginform() to display > > it), then you would set up auth_doregister() to first check to see if the > > login name and password provided are valid, and if they aren't, then go > > ahead and register the user in the system. > > > > The code might look something like this. > > > > ExampleAuth extends Auth { > > //...other settings variables go here > > var $mode = 'reg'; > > > > function auth_registerform() { > > //code to display the registration form goes here; usually you can > > just copy > > //and modify the code for auth_loginform() to suit your purposes. > > } > > > > function auth_doregister() > > //validate the login... you can probably use the existing > > //auth_validatelogin to do this > > if (!$uid = $this->auth_validatelogin()) { > > //A valid uid wasn't returned, so go ahead and register the > > user. > > //...registration code goes here; be sure to set the uid and > > perms for the new > > //user > > ... > > $uid = (something); > > $this->auth['perm'] = 'user'; > > } > > return $uid; //return the uid to PHPlib so that it recognizes the > > user as valid. > > } > > > > function auth_validatelogin() { > > //Code to login a user goes here > > return $uid; > > } > > > > ... > > } > > > > I have also found in working with the Auth class that this flow chart has > > helped me immensely: > > http://www.drostan.org/Application/webdev/uod/auth_phplib.php > > > > P.D. Si necesita algu'n explanacio'n en espan~ol, puedo intentar > clarificar > > lo que dije. Quizas tendre' que buscar mi diccionario. :) > > > > _________________________________ > > Nathaniel Price <np...@te...> > > Webmaster > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: VM Ware > > With VMware you can run multiple operating systems on a single machine. > > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the > > same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 > > _______________________________________________ > > Phplib-users mailing list > > Php...@li... > > https://lists.sourceforge.net/lists/listinfo/phplib-users > > > > ------------------------------------------------------- > This SF.net email is sponsored by: VM Ware > With VMware you can run multiple operating systems on a single machine. > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the > same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 > _______________________________________________ > Phplib-users mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phplib-users > |