Exemplo n.º 1
0
    def post():
        context = libs.select_keys(request.form, ['email', 'f_name', 'l_name'])
        if request.form['password'] != request.form['password2']:
            context['error_message'] = 'fields password and password2 must be equal'
        else:
            context['password']=request.form['password']
            res = libs.make_request(server_url='https://goods.itvik.com/api/register/', method="post", params=context)
            if not 'error' in res:
                return template_page(page='message.html', message="You are registred")

            context['error_message'] = res['error']
          
        return template_page(page='regist.html', **context)
Exemplo n.º 2
0
    def post():
        response=libs.make_request(server_url='https://goods.itvik.com/api/login/', method="post", params=libs.select_keys(request.form, ['email', 'password']))
        if 'data' in response:
            session['token'] = response['data']['token']
            session['user'] = request.form['email']

            return redirect(url_for('plitka'))

        return template_page(page='login.html', error_message=response['error'] + "; Try again")