Direct login after successful registration on the plone website

I have a custom BrowserView registration where you need to expand some user data (z3c.form with some fields, including password). after successfully saving this data, I want the user to automatically register and redirect to another page on the site.

Thanks in advance for the tips.

+4
source share
2 answers

So here is my working solution (thanks to Mikko who pointed in the right direction):

  • authenticate credentials in PAS

    member = portal.acl_users.authenticate(username, password, portal.REQUEST) 
  • to redirect you need to set an authentication cookie. You can do this with "updateCredentials" (see Pas / plugins / cookie_handler)

     if member: portal.acl_users.updateCredentials(portal.REQUEST, portal.REQUEST.RESPONSE, username, password) 
  • redirect to next page

     portal.REQUEST.RESPONSE.redirect(url) 
+5
source

If you want to expand user data for new members and add new fields to the registration form, it is best to expand the program that provides the default user data scheme and make it so that you can easily connect to existing registration mechanisms.

There is an example product collect.examples.userdata strong> that you can use 0 and extend for this purpose. It also has good documentation that explains all the necessary steps for you.

http://plone.org/products/collective.examples.userdata

0
source

Source: https://habr.com/ru/post/1390797/


All Articles