예제 #1
0
def register():
    if request.method == 'GET':
        return redirect('/')
    logging.debug('add profile form : %s', str(request.form))
    logging.info('receive socket from /register-data -> profile: %s',
                 request.form['profile-name'])
    form = request.form
    profile = Profile()
    profile.name = form['profile-name']
    profile.firstname = form['profile-firstname']
    profile.address = form['profile-address']
    profile.comp_address = form['profile-comp_address']
    profile.city = form['profile-city']
    profile.zipcode = form['profile-zipcode']
    profile.country = form['profile-country']
    profile.phone = form['profile-phone']
    profile.email = form['profile-email']
    profile.siret = form['profile-siret']
    pdao = ProfileDAO()
    if pdao.insert(profile):
        logging.info('add profile %s OK', profile.name)
        session['logged_in'] = pdao.field(pdao.where('email', profile.email),
                                          'id')[0][0]
    else:
        logging.info('add profile %s FAILED', profile.name)
    return redirect('/')
예제 #2
0
def register():
    logging.debug('add profile form : %s', str(request.form))
    logging.info('receive socket from /register-data -> profile: %s', request.form['profile-name'])
    form = request.form
    if form['profile-password'] != form['profile-repassword']:
        return render_template('v3-login.html', error=_('Your confirmation password does not match the password you entered'))
    profile = Profile()
    profile.name = form['profile-name']
    profile.firstname = form['profile-firstname']
    profile.address = form['profile-address']
    profile.comp_address = form['profile-comp_address']
    profile.city = form['profile-city']
    profile.zipcode = form['profile-zipcode']
    profile.country = form['profile-country']
    profile.phone = form['profile-phone']
    profile.email = form['profile-email']
    profile.siret = form['profile-siret']
    profile.password = form['profile-password']
    pdao = ProfileDAO()
    if pdao.insert(profile):
        logging.info('add profile %s OK', profile.name)
        session['logged_in'] = pdao.field(pdao.where('email', profile.email), 'id')[0][0]
    else:
        logging.info('add profile %s FAILED', profile.name)
        return render_template('v3-login.html', error=_('Impossible to create new user, please contact an admin !'))

    return redirect('/')