3f5beacce0066ecf240f4d999818985a10b7d53a
2 from Products
.CMFCore
.utils
import getToolByName
3 from Products
.Plinn
.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
) and \
21 context
.validatePrivateAccess(**form
) :
22 came_from
= fg('came_from')
24 return context
.setRedirect( atool
, 'user/logged_in'
25 , came_from
= came_from
26 , __ac_name
=fg('member_id')
27 , __ac_password
=fg('password'))
28 #return resp.redirect('%s?%s' % ( came_from, mq(__ac_name=fg('member_id'), __ac_password=fg('password'), noajax='1')) )
30 options
['member_id'] = fg('member_id')
31 options
['password'] = fg('password')
32 options
['form_action'] = target
= atool
.getActionInfo('user/logged_in')['url']
33 return context
.confirm_join_template(**options
)
35 continuationFields
= [
43 , 'collection_password'
44 , 'collection_password_confirm'
52 for name
in continuationFields
:
53 options
[name
] = fg(name
)
55 # TODO try to be more clever...
56 if not options
['country']:
57 options
['country'] = 'FR'
58 options
['came_from'] = fg('came_from')
59 return context
.customer_join_template(**options
)