Exemplo n.º 1
0
def register(req):
    logo_image = fun.get_site_logo(req)
    cate_name = '用户注册'
    if req.method == 'GET':
        data = {}
        express, express_id = controller.get_valid_code()
        fun.get_valid_code()
        return render_to_response("zhiyuw/register.html",
                                  locals(),
                                  context_instance=RequestContext(req))
    elif req.method == 'POST':
        data = fun.warp_data(req.POST)
        if data['password'] != data['password2']:
            msg = '两次密码不一致'
        else:
            if req.META.has_key('HTTP_X_FORWARDED_FOR'):
                data['ip'] = req.META['HTTP_X_FORWARDED_FOR']
            else:
                data['ip'] = req.META['REMOTE_ADDR']
            r = controller.reg_user(req, data)
            # print r
            if r > 0:
                info = controller.auth(req, data)
                req.session['isLogin'] = True
                req.session['info'] = info
                return render_to_response("zhiyuw/reg_yd.html",
                                          locals(),
                                          context_instance=RequestContext(req))
            else:
                msg = '该用户名或邮箱已注册,'
        express, express_id = controller.get_valid_code()
        fun.get_valid_code()
        return render_to_response("zhiyuw/register.html",
                                  locals(),
                                  context_instance=RequestContext(req))
Exemplo n.º 2
0
Arquivo: views.py Projeto: five3/zyw
def ydy(req):
    logo_image = fun.get_site_logo(req)
    cate_name = '用户注册'
    req.session['banner_list_ydy']  = global_settings['banner_list_ydy']
    req.session['settings'] = global_settings['settings']
    if req.method=='GET':
        express, express_id = controller.get_valid_code()
        fun.get_valid_code()
        return render_to_response("ydy.html", locals(), context_instance = RequestContext(req))
Exemplo n.º 3
0
def ydy(req):
    logo_image = fun.get_site_logo(req)
    cate_name = '用户注册'
    req.session['banner_list_ydy'] = global_settings['banner_list_ydy']
    req.session['settings'] = global_settings['settings']
    if req.method == 'GET':
        express, express_id = controller.get_valid_code()
        fun.get_valid_code()
        third_appid = qq_appid
        return render_to_response("ydy.html",
                                  locals(),
                                  context_instance=RequestContext(req))
Exemplo n.º 4
0
Arquivo: views.py Projeto: five3/zyw
def register(req):
    logo_image = fun.get_site_logo(req)
    cate_name = '用户注册'
    if req.method=='GET':
        express, express_id = controller.get_valid_code()
        fun.get_valid_code()
        return render_to_response("zhiyuw/register.html", locals(), context_instance = RequestContext(req))
    elif req.method=='POST':
        data = fun.warp_data(req.POST)
        if data['password']!=data['password2']:
            msg = '两次密码不一致'
        else:
            if req.META.has_key('HTTP_X_FORWARDED_FOR'):
                data['ip'] =  req.META['HTTP_X_FORWARDED_FOR']
            else:
                data['ip'] = req.META['REMOTE_ADDR']
            r = controller.reg_user(req, data)
            # print r
            if r>0:
                msg = '注册用户成功,你现在可以登录了'
            else:
                msg = '该用户名或邮箱已注册,'
        return render_to_response("zhiyuw/msg.html", locals(), context_instance = RequestContext(req))