-##parameters=member_id='', given_name='', name='', member_email='', password='', confirm='', add='', ajax=''
+##parameters=member_id='', given_name='', name='', member_email='', password='', confirm='', add='', came_from='', ajax=''
##
from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.permissions import ManageUsers
options['validate_email'] = validate_email
options['isAnonRegistration'] = rtool.getMode() == MODE_ANONYMOUS
options['isReviewedRegistration'] = rtool.getMode() == MODE_REVIEWED
+options['came_from'] = came_from
buttons = []
if is_newmember:
<form tal:attributes="action form/action" method="post">
<input type="hidden" name="__ac_name" tal:attributes="value options/member_id"/>
<input type="hidden" name="__ac_password" tal:attributes="value options/password"/>
+ <input type="hidden" name="came_from" tal:attributes="value options/came_from">
<input type="hidden" name="noAjax" value="1"/>
<metal:macro metal:use-macro="context/form_widgets/macros/buttons"/>
</form>
</td>
</tr>
</table>
+ <input type="hidden" name="came_from"
+ tal:attributes="value options/came_from"/>
</form>
<script type="text/javascript">
(function(){
now = context.ZopeTime()
last_login = member.getProperty('login_time', None)
member.setProperties(last_login_time=last_login, login_time=now)
- is_first_login = (last_login == '2000/01/01' and
- ptool.getProperty('validate_email'))
- if is_first_login:
- member.setProperties(last_login_time='1999/01/01', login_time=now)
- target = '%s/password_form' % portal_url
- context.REQUEST.RESPONSE.redirect(target)
- return
- else:
- member.setProperties(last_login_time=last_login, login_time=now)
- came_from = context.REQUEST.get('came_from', None)
- if came_from:
- return context.REQUEST.RESPONSE.redirect(came_from)
- else :
- url = atool.getActionInfo('user/logged_in', object=portal)['url']
- url = '%s?%s' %(url, mq(portal_status_message=_('Login success')))
- return context.REQUEST.RESPONSE.redirect(url)
-
-return context.logged_in_template(**decode(options, script))
+ came_from = context.REQUEST.get('came_from', None)
+ if came_from:
+ return context.REQUEST.RESPONSE.redirect(came_from)
+ else :
+ url = '%s?%s' %(portal_url, mq(portal_status_message=_('Login success')))
+ return context.REQUEST.RESPONSE.redirect(url)