Re: Plone Benutzer mit Skript automatisch einloggen
Nico Grubert <[email protected]>
| Newsgroups | gmane.comp.web.zope.german |
|---|---|
| Message-ID | <[email protected]> |
> pw_tool = getToolByName(context, 'portal_password_reset')
> try:
> pw_tool.resetPassword(userid, randomstring, password)
> except 'ExpiredRequestError':
> status = "expired"
> except 'InvalidRequestError':
> status = "invalid"
> else:
> REQUEST = context.REQUEST
> RESPONSE = REQUEST.RESPONSE
> portal = context.portal_url.getPortalObject()
> REQUEST.set('__ac_name', userid)
> REQUEST.set('__ac_password', password)
> auth = context.acl_users.credentials_cookie_auth
> auth.login()
> RESPONSE.redirect(context.portal_url())
> #auth.updateCredentials(REQUEST, RESPONSE, userid, password)
Hallo Carsten
Vielen Dank für deine Antwort.
Folgendes Python-Script habe ich innerhalb der Plone Site erstellt.
Leider ist der User nach dem Absenden des Formulars, welches dieses
Script aufruft, nicht eingeloggt:
=====================================================================
from Products.CMFCore.utils import getToolByName
REQUEST = context.REQUEST
RESPONSE = REQUEST.RESPONSE
username = REQUEST.get('__ac_username', '')
password = REQUEST.get('__ac_password', '')
REQUEST.set('__ac_name', username)
REQUEST.set('__ac_password', password)
auth = context.acl_users.credentials_cookie_auth
auth.login()
pt = getattr(context, 'welcome.html')
RESPONSE.redirect(pt.absolute_url())
=====================================================================
Hab ich noch etwas übersehen?
Gruss
Nico
_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope