当前位置: 首页>>代码示例>>Python>>正文


Python LoginForm.is_valid方法代码示例

本文整理汇总了Python中apps.reader.forms.LoginForm.is_valid方法的典型用法代码示例。如果您正苦于以下问题:Python LoginForm.is_valid方法的具体用法?Python LoginForm.is_valid怎么用?Python LoginForm.is_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apps.reader.forms.LoginForm的用法示例。


在下文中一共展示了LoginForm.is_valid方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: login

# 需要导入模块: from apps.reader.forms import LoginForm [as 别名]
# 或者: from apps.reader.forms.LoginForm import is_valid [as 别名]
def login(request):
    if request.method == "POST":
        form = LoginForm(request.POST, prefix='login')
        if form.is_valid():
            login_user(request, form.get_user())
            logging.info(" ---> [%s] Login" % form.get_user())
            return HttpResponseRedirect(reverse('index'))

    return index(request)
开发者ID:tosh,项目名称:NewsBlur,代码行数:11,代码来源:views.py

示例2: login

# 需要导入模块: from apps.reader.forms import LoginForm [as 别名]
# 或者: from apps.reader.forms.LoginForm import is_valid [as 别名]
def login(request):
    code = -1
    if request.method == "POST":
        form = LoginForm(data=request.POST)
        if form.is_valid():
            login_user(request, form.get_user())
            logging.user(form.get_user(), "~FG~BB~SKAPI Login~FW")
            code = 1

    return dict(code=code)
开发者ID:adamjernst,项目名称:NewsBlur,代码行数:12,代码来源:views.py

示例3: login

# 需要导入模块: from apps.reader.forms import LoginForm [as 别名]
# 或者: from apps.reader.forms.LoginForm import is_valid [as 别名]
def login(request):
    form = LoginForm()

    if request.method == "POST":
        form = LoginForm(data=request.POST)
        if form.is_valid():
            login_user(request, form.get_user())
            logging.user(form.get_user(), "~FG~BBOAuth Login~FW")
            return HttpResponseRedirect(request.POST['next'] or reverse('index'))

    return render_to_response('accounts/login.html', {
        'form': form,
        'next': request.REQUEST.get('next', "")
    }, context_instance=RequestContext(request))
开发者ID:linuxayn,项目名称:NewsBlur,代码行数:16,代码来源:views.py

示例4: login

# 需要导入模块: from apps.reader.forms import LoginForm [as 别名]
# 或者: from apps.reader.forms.LoginForm import is_valid [as 别名]
def login(request):
    code = -1
    errors = None

    if request.method == "POST":
        form = LoginForm(data=request.POST)
        if form.errors:
            errors = form.errors
        if form.is_valid():
            login_user(request, form.get_user())
            logging.user(request, "~FG~BB~SKAPI Login~FW")
            code = 1

    return dict(code=code, errors=errors)
开发者ID:saidimu,项目名称:NewsBlur,代码行数:16,代码来源:views.py

示例5: login

# 需要导入模块: from apps.reader.forms import LoginForm [as 别名]
# 或者: from apps.reader.forms.LoginForm import is_valid [as 别名]
def login(request):
    form = LoginForm()

    if request.method == "POST":
        form = LoginForm(data=request.POST)
        if form.is_valid():
            login_user(request, form.get_user())
            logging.user(form.get_user(), "~FG~BBOAuth Login~FW")
            return HttpResponseRedirect(request.POST["next"] or reverse("index"))

    return render_to_response(
        "accounts/login.html",
        {"form": form, "next": request.REQUEST.get("next", "")},
        context_instance=RequestContext(request),
    )
开发者ID:jmorahan,项目名称:NewsBlur,代码行数:17,代码来源:views.py

示例6: login

# 需要导入模块: from apps.reader.forms import LoginForm [as 别名]
# 或者: from apps.reader.forms.LoginForm import is_valid [as 别名]
def login(request):
    code = -1
    if request.method == "POST":
        form = LoginForm(request.POST, prefix='login')
        if form.is_valid():
            login_user(request, form.get_user())
            if request.POST.get('api'):
                logging.user(form.get_user(), "~FG~BB~SKiPhone Login~FW")
                code = 1
            else:
                logging.user(form.get_user(), "~FG~BBLogin~FW")
                return HttpResponseRedirect(reverse('index'))

    if request.POST.get('api'):
        return HttpResponse(json.encode(dict(code=code)), mimetype='application/json')
    else:
        return index(request)
开发者ID:heliostatic,项目名称:NewsBlur,代码行数:19,代码来源:views.py

示例7: login

# 需要导入模块: from apps.reader.forms import LoginForm [as 别名]
# 或者: from apps.reader.forms.LoginForm import is_valid [as 别名]
def login(request):
    code = -1
    if request.method == "POST":
        form = LoginForm(request.POST, prefix="login")
        if form.is_valid():
            login_user(request, form.get_user())
            if request.POST.get("api"):
                logging.info(" ---> [%s] ~FG~BB~SKiPhone Login~FW" % form.get_user())
                code = 1
            else:
                logging.info(" ---> [%s] ~FG~BBLogin~FW" % form.get_user())
                return HttpResponseRedirect(reverse("index"))

    if request.POST.get("api"):
        return HttpResponse(json.encode(dict(code=code)), mimetype="application/json")
    else:
        return index(request)
开发者ID:vvarp,项目名称:NewsBlur,代码行数:19,代码来源:views.py

示例8: login

# 需要导入模块: from apps.reader.forms import LoginForm [as 别名]
# 或者: from apps.reader.forms.LoginForm import is_valid [as 别名]
def login(request):
    code = -1
    errors = None
    user_agent = request.environ.get("HTTP_USER_AGENT", "")

    if not user_agent or user_agent.lower() in ["nativehost"]:
        errors = dict(user_agent="You must set a user agent to login.")
        logging.user(request, "~FG~BB~SK~FRBlocked ~FGAPI Login~SN~FW: %s" % (user_agent))
    elif request.method == "POST":
        form = LoginForm(data=request.POST)
        if form.errors:
            errors = form.errors
        if form.is_valid():
            login_user(request, form.get_user())
            logging.user(request, "~FG~BB~SKAPI Login~SN~FW: %s" % user_agent)
            code = 1
    else:
        errors = dict(method="Invalid method. Use POST. You used %s" % request.method)

    return dict(code=code, errors=errors)
开发者ID:pabloav,项目名称:NewsBlur,代码行数:22,代码来源:views.py

示例9: login

# 需要导入模块: from apps.reader.forms import LoginForm [as 别名]
# 或者: from apps.reader.forms.LoginForm import is_valid [as 别名]
def login(request):
    code = -1
    errors = None
    user_agent = request.environ.get('HTTP_USER_AGENT', '')

    if not user_agent or user_agent.lower() in ['nativehost']:
        errors = dict(user_agent="You must set a user agent to login.")
        ip = request.META.get('HTTP_X_REAL_IP', None) or request.META['REMOTE_ADDR']
        logging.user(request, "~FG~BB~SK~FRBlocked ~FGAPI Login~SN~FW: %s / %s" % (user_agent, ip))
    elif request.method == "POST":
        form = LoginForm(data=request.POST)
        if form.errors:
            errors = form.errors
        if form.is_valid():
            login_user(request, form.get_user())
            logging.user(request, "~FG~BB~SKAPI Login~SN~FW: %s" % user_agent)
            code = 1
    else:
        errors = dict(method="Invalid method. Use POST. You used %s" % request.method)
        
    return dict(code=code, errors=errors)
开发者ID:angelomendonca,项目名称:NewsBlur,代码行数:23,代码来源:views.py


注:本文中的apps.reader.forms.LoginForm.is_valid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。