4df2848cf8e1658eca12f2ce9165cf5635cc3e22
2 from Products
.CMFCore
.utils
import getToolByName
3 from Products
.realis
.utils
import translate
4 from ZTUtils
import make_query
as mq
5 _
= lambda msg
: translate(msg
, context
)
6 ptool
= getToolByName(script
, 'portal_properties')
7 atool
= getToolByName(script
, 'portal_actions')
8 validate_email
= ptool
.getProperty('validate_email')
10 options
['validate_email'] = validate_email
15 fg
= lambda name
: form
.get(name
,'').strip()
19 context
.validatePassword(**form
) and \
20 context
.customer_add_control(**form
) :
21 came_from
= fg('came_from')
23 return context
.setRedirect( atool
, 'user/logged_in'
24 , came_from
= came_from
25 , __ac_name
=fg('member_id')
26 , __ac_password
=fg('password'))
27 #return resp.redirect('%s?%s' % ( came_from, mq(__ac_name=fg('member_id'), __ac_password=fg('password'), noajax='1')) )
29 options
['member_id'] = fg('member_id')
30 options
['password'] = fg('password')
31 options
['form_action'] = target
= atool
.getActionInfo('user/logged_in')['url']
32 return context
.confirm_join_template(**options
)
34 continuationFields
= [
50 for name
in continuationFields
:
51 options
[name
] = fg(name
)
53 # TODO try to be more clever...
54 if not options
['country']:
55 options
['country'] = 'FR'
56 options
['came_from'] = fg('came_from')
57 return context
.customer_join_template(**options
)