Esempio n. 1
0
def generate_list(request):
    users_list = User.objects.all()
    email_ids = ""
    email_ids = [user.email for user in users_list]
    #    for user in users_list:
    utils.send_mail_via_gmail("pyquiz/users-list-mail.html", {}, "PyQuiz:Quiz Ready!", email_ids)
    return HttpResponse("Mail Sent")
Esempio n. 2
0
def register(request):
    context = {"error": {}}
    if request.method == "POST":
        print request.POST
        context["post_data"] = request.POST
        if User.objects.filter(email=request.POST["username"]).exists():
            context["error"]["username"] = "******"
        else:
            new_user = User.objects.create_user(
                request.POST["username"].split("@")[0],
                request.POST["username"],
                request.POST["password"],
                first_name=request.POST["first_name"],
                last_name=request.POST["last_name"],
                role=request.POST["role"],
            )
            new_user.is_active = 0
            utils.send_mail_via_gmail(
                "pyquiz/register-mail.html",
                {"domain": settings.DOMAIN, "email_id": base64.b64encode(request.POST["username"])},
                "PyQuiz:Welcome Aboard!",
                [request.POST["username"]],
            )
            context["success"] = True
    print context
    return render(request, "pyquiz/register.html", context)
Esempio n. 3
0
def forgot_password(request):
    context = {}
    if request.method == "POST":
        print request.POST
        utils.send_mail_via_gmail('pyquiz/forgot-password-mail.html', {'domain':settings.DOMAIN, 'email_id':base64.b64encode(request.POST['username'])},\
                                    'PyQuiz:reset-password', [request.POST['username']] \
                                )
        context['mail_sent'] = True
    return render(request,'pyquiz/forgot-password.html',context)
Esempio n. 4
0
def forgot_password(request):
    context = {}
    if request.method == "POST":
        print request.POST
        utils.send_mail_via_gmail('pyquiz/forgot-password-mail.html', {'domain':settings.DOMAIN, 'email_id':base64.b64encode(request.POST['username'])},\
                                    'PyQuiz:reset-password', [request.POST['username']] \
                                )
        context['mail_sent'] = True
    return render(request, 'pyquiz/forgot-password.html', context)
Esempio n. 5
0
def feedback(request):
    if request.method == "POST":
        print request.POST
        utils.send_mail_via_gmail(
            "pyquiz/feedback-mail.html",
            {"username": request.POST["username"], "message": request.POST["message"]},
            "PyQuiz:Feedback",
            ["*****@*****.**", "*****@*****.**"],
        )
    return HttpResponse("Success")
Esempio n. 6
0
def forgot_password(request):
    context = {}
    if request.method == "POST":
        print request.POST
        utils.send_mail_via_gmail(
            "pyquiz/forgot-password-mail.html",
            {"domain": settings.DOMAIN, "email_id": base64.b64encode(request.POST["username"])},
            "PyQuiz:reset-password",
            [request.POST["username"]],
        )
        context["mail_sent"] = True
    return render(request, "pyquiz/forgot-password.html", context)
Esempio n. 7
0
def register(request):
    context = {'error':{}}
    if request.method == "POST":
        print request.POST
        context['post_data'] = request.POST
        if User.objects.filter(email=request.POST['username']).exists():
            context['error']['username'] = '******' 
        else:
            new_user = User.objects.create_user(request.POST['username'].split("@")[0], request.POST['username'], request.POST['password'], \
                                                first_name=request.POST['first_name'], last_name=request.POST['last_name'], role=request.POST['role'])
            new_user.is_active = 0
            utils.send_mail_via_gmail('pyquiz/register-mail.html', {'domain':settings.DOMAIN, 'email_id':base64.b64encode(request.POST['username'])},\
                                    'PyQuiz:Welcome Aboard!', [request.POST['username']] \
                                )
            context['success'] = True
    print context
    return render(request,'pyquiz/register.html',context)
Esempio n. 8
0
def register(request):
    context = {'error': {}}
    if request.method == "POST":
        print request.POST
        context['post_data'] = request.POST
        if User.objects.filter(email=request.POST['username']).exists():
            context['error']['username'] = '******'
        else:
            new_user = User.objects.create_user(request.POST['username'].split("@")[0], request.POST['username'], request.POST['password'], \
                                                first_name=request.POST['first_name'], last_name=request.POST['last_name'], role=request.POST['role'])
            new_user.is_active = 0
            utils.send_mail_via_gmail('pyquiz/register-mail.html', {'domain':settings.DOMAIN, 'email_id':base64.b64encode(request.POST['username'])},\
                                    'PyQuiz:Welcome Aboard!', [request.POST['username']] \
                                )
            context['success'] = True
    print context
    return render(request, 'pyquiz/register.html', context)