f5f0f7cab9456771c2b3a1cbf650d941667e38d5
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
= [
44 , 'collection_password'
45 , 'collection_password_confirm'
54 for name
in continuationFields
:
55 options
[name
] = fg(name
)
57 # TODO try to be more clever...
58 if not options
['country']:
59 options
['country'] = 'FR'
60 options
['came_from'] = fg('came_from')
61 return context
.customer_join_template(**options
)