views.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:desec-stack 作者: desec-io 项目源码 文件源码
def unlock(request, email):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':
        # create a form instance and populate it with data from the request:
        form = UnlockForm(request.POST)
        # check whether it's valid:
        if form.is_valid():
            try:
                user = User.objects.get(email=email)
                user.unlock()
                if not user.dyn:
                    context = {'token': user.get_token()}
                    send_token_email(context, user)
            except User.DoesNotExist:
                pass # fail silently, otherwise people can find out if email addresses are registered with us

            return HttpResponseRedirect(reverse('unlock/done'))

    # if a GET (or any other method) we'll create a blank form
    else:
        form = UnlockForm()

    return render(request, 'unlock.html', {'form': form})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号