Пример #1
0
def send_varification_link(request):
    if request.method == "POST":
        user_email = request.POST["email"]
        if User.objects.filter(email=user_email).exists():
            get_user_instant = User.objects.get(email=user_email)
            uid = urlsafe_base64_encode(force_bytes(get_user_instant.id))
            token = account_activation_token.make_token(get_user_instant)
            user_info = Ar_user.objects.get(user_id=get_user_instant.id)
            varification_link = settings.BASE_URL + "account/activate/" + uid + "/" + token
            ################################################ EMAL SEND CODE START ##############
            logo_image = 'http://203.190.153.20/agile/assets/img/basic/logo.png'
            email_content = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=euc-jp"><meta name="viewport" content="width=device-width"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="x-apple-disable-message-reformatting"><title>Agile | New Registration</title><style>html,body{background-color:#fff!important;margin:0 auto !important;padding:0 !important;height:100% !important;width:100% !important;color:#888!important}.email-container{max-width:600px!important;margin:0 auto!important}*{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}div[style*="margin: 16px 0"]{margin:0 !important}table,td{mso-table-lspace:0pt !important;mso-table-rspace:0pt !important}table{width:100%;border-spacing:0 !important;border-collapse:collapse !important;table-layout:fixed !important;margin:0 auto !important}img{-ms-interpolation-mode:bicubic}a{text-decoration:none!important}*[x-apple-data-detectors], .unstyle-auto-detected-links *,.aBn{border-bottom:0 !important;cursor:default !important;color:inherit !important;text-decoration:none !important;font-size:inherit !important;font-weight:inherit !important;line-height:inherit !important}@media only screen and (min-device-width: 320px) and (max-device-width: 374px){u ~ div .email-container{min-width:320px !important}}@media only screen and (min-device-width: 375px) and (max-device-width: 413px){u ~ div .email-container{min-width:375px !important}}@media only screen and (min-device-width: 414px){u ~ div .email-container{min-width:414px !important}}</style></head><body><div class="email-container"><table style="border-bottom: 2px solid #c52241; "><tr><td><h2 style="color:#c52241; padding-top: 62px; margin-bottom: 0px;">Activate Account</h2></td><td> <img src="' + logo_image + '" style="width: 60%; float: right;"></td></tr></table><table style="color: #000;font-size: 20px;"><tr><td style="padding: 10px 0px;">Dear ' + user_info.user_name + ',</td></tr><tr><td style="padding: 10px 0px;">Welcome to the next generation of Agile Ready.</td></tr><tr><td style="padding: 10px 0px;">To activate your account, press the button below.</td></tr><tr><td style="padding: 10px 0px;text-align:center;"> <button style="padding: 10px 45px;background-color: #c52241;border-radius: 10px;border: none;font-size:20px;color: #fff;"> <a href="' + varification_link + '" style="color: #fff; text-decoration: none;">Activate</a></button></td></tr></table><table style="border-top: 1px solid #000; color: #000; font-size: 20px;"><tr><td><h4>MANAGE Your New Account</h4></td></tr><tr><td><a href="' + settings.BASE_URL + '">Change your password</a></td></tr><tr><td><a href="' + settings.BASE_URL + '"> Get Help with your account </a></td></tr><tr><td style="font-weight: bold; padding-top: 30px;">Thank you for Joining!</td></tr><tr><td style="font-weight: bold;padding-bottom: 30px;">The Agile Ready Team</tr></table><table style="background-color: #f2f2f2; font-size: 20px;"><tr><td style="padding: 35px 30px; text-align: center;">DigiMonk Technologies, Software Technology Parks Of India Gwalior, Madhya Pradesh 474005</td></tr></table></div></body></html>'
            msg = email.message.Message()
            msg['Subject'] = 'Account Varification Link'
            msg['From'] = settings.EMAIL_HOST_USER
            msg['To'] = user_email
            password = settings.EMAIL_HOST_PASSWORD
            msg.add_header('Content-Type', 'text/html')
            msg.set_payload(email_content)
            s = smtplib.SMTP(settings.EMAIL_HOST + ':' +
                             str(settings.EMAIL_PORT))
            s.starttls()
            # Login Credentials for sending the mail
            s.login(msg['From'], password)
            s.sendmail(msg['From'], [msg['To']], msg.as_string())
            status = "1"
            message = "Link is send to your email id."
        else:
            status = "0"
            message = "Email is not registered."
        return JsonResponse({"status": status, "message": message})
Пример #2
0
def send_varification_link(request):
    if request.method == "POST":
        user_email = request.POST["email"]
        if User.objects.filter(email=user_email).exists():
            get_user_instant = User.objects.get(email=user_email)
            uid = urlsafe_base64_encode(force_bytes(get_user_instant.id))
            token = account_activation_token.make_token(get_user_instant)
            user_info = Ar_user.objects.get(user_id=get_user_instant.id)
            varification_link = settings.BASE_URL + "account/activate/" + uid + "/" + token
            ################################################ EMAL SEND CODE START ##############
            logo_image = settings.BASE_URL + 'static/img/basic/logo.png'
            data_content = {
                "BASE_URL": settings.BASE_URL,
                "logo_image": logo_image,
                "user_name": user_info.user_name,
                "varification_link": varification_link
            }
            email_content = render_to_string(
                'email_template/email_send_for_send_varification_link.html',
                data_content)
            msg = email.message.Message()
            msg['Subject'] = 'Account Varification Link'
            msg['From'] = settings.EMAIL_HOST_USER
            msg['To'] = user_email
            password = settings.EMAIL_HOST_PASSWORD
            msg.add_header('Content-Type', 'text/html')
            msg.set_payload(email_content)
            s = smtplib.SMTP(settings.EMAIL_HOST + ':' +
                             str(settings.EMAIL_PORT))
            s.starttls()
            # Login Credentials for sending the mail
            s.login(msg['From'], password)
            s.sendmail(msg['From'], [msg['To']], msg.as_string())
            status = "1"
            msg = get_object_or_404(Notification,
                                    page_name="Sign_Up",
                                    notification_key="Send")
            msg_data = msg.notification_desc
            message = msg_data
        else:
            status = "0"
            msg = get_object_or_404(Notification,
                                    page_name="Sign_Up",
                                    notification_key="Not_Send")
            msg_data = msg.notification_desc
            message = msg_data
        return JsonResponse({"status": status, "message": message})
Пример #3
0
def index(request):
    ###########################
    get_user_instant = User.objects.get(email='*****@*****.**')
    uid = urlsafe_base64_encode(force_bytes(get_user_instant.id))
    token = account_activation_token.make_token(get_user_instant)
    email_content = settings.BASE_URL + "account/activate/" + uid + "/" + token
    msg = email.message.Message()
    msg['Subject'] = 'Account Create successfully'
    msg['From'] = settings.EMAIL_HOST_USER
    msg['To'] = '*****@*****.**'
    password = settings.EMAIL_HOST_PASSWORD
    msg.add_header('Content-Type', 'text/html')
    msg.set_payload(email_content)
    s = smtplib.SMTP(settings.EMAIL_HOST + ':' + str(settings.EMAIL_PORT))
    s.starttls()
    # Login Credentials for sending the mail
    s.login(msg['From'], password)
    s.sendmail(msg['From'], [msg['To']], msg.as_string())
    return HttpResponse("test")
Пример #4
0
def send_email(ar_user_ins,user_ins,org_info,password):
    # corrent_user_info => user_ins
    user_email = user_ins.username
    uid = urlsafe_base64_encode(force_bytes(user_ins.id))
    token = account_activation_token.make_token(user_ins)
    varification_link = settings.BASE_URL + "account/activate/" + uid + "/" + token
    logo_image = settings.BASE_URL + 'static/img/basic/logo.png'
    data_content = {"BASE_URL": settings.BASE_URL, "user_name": ar_user_ins.user_name,
                    "organization_name": org_info.organization_name, "user_email": user_email, "password": password,
                    "logo_image": logo_image, "varification_link": varification_link}
    email_content = render_to_string('email_template/email_send_for_invite_user.html', data_content)
    msg = email.message.Message()
    msg['Subject'] = 'Invitation Link From Agile Ready'
    msg['From'] = settings.EMAIL_HOST_USER
    msg['To'] = user_email
    password = settings.EMAIL_HOST_PASSWORD
    msg.add_header('Content-Type', 'text/html')
    msg.set_payload(email_content)
    s = smtplib.SMTP(settings.EMAIL_HOST + ':' + str(settings.EMAIL_PORT))
    s.starttls()
    # Login Credentials for sending the mail
    s.login(msg['From'], password)
    s.sendmail(msg['From'], [msg['To']], msg.as_string())
Пример #5
0
def index(request):
    if request.user.is_authenticated:
        if request.method == "POST":
            user_email = request.POST["email"]
            if User.objects.filter(email=user_email).exists():
                messages.error(request, "Email already exists.")
            else:
                corrent_user_info = Ar_user.objects.get(
                    user_id=request.user.id)
                org_info = AR_organization.objects.get(
                    created_by=request.user.id)
                password = ''.join([
                    random.choice(string.digits + string.ascii_letters)
                    for i in range(0, 10)
                ])
                user = User.objects.create_user(username=user_email,
                                                email=user_email,
                                                password=password,
                                                is_active=False)
                user.save()
                get_user_info = User.objects.get(username=user_email)
                state = "state"
                number = "0"
                zip_code = "0"
                ar_users = Ar_user(user_id=user.id,
                                   user_name="",
                                   state=state,
                                   zip=zip_code,
                                   phone=number,
                                   org_id=org_info.id,
                                   user_type="User",
                                   created_by=str(corrent_user_info.user_id),
                                   updated_by=str(corrent_user_info.user_id))
                ar_users.save()
                #########################################################################
                uid = urlsafe_base64_encode(force_bytes(get_user_info.id))
                token = account_activation_token.make_token(get_user_info)
                varification_link = settings.BASE_URL + "account/activate/" + uid + "/" + token
                logo_image = 'http://203.190.153.20/agile/assets/img/basic/logo.png'
                email_content = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=euc-jp"><meta name="viewport" content="width=device-width"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="x-apple-disable-message-reformatting"><title>Agile | New Registration</title><style>html,body{background-color:#fff!important;margin:0 auto !important;padding:0 !important;height:100% !important;width:100% !important;color:#888!important}.email-container{max-width:600px!important;margin:0 auto!important}*{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}div[style*="margin: 16px 0"]{margin:0 !important}table,td{mso-table-lspace:0pt !important;mso-table-rspace:0pt !important}table{width:100%;border-spacing:0 !important;border-collapse:collapse !important;table-layout:fixed !important;margin:0 auto !important}img{-ms-interpolation-mode:bicubic}a{text-decoration:none!important}*[x-apple-data-detectors], .unstyle-auto-detected-links *,.aBn{border-bottom:0 !important;cursor:default !important;color:inherit !important;text-decoration:none !important;font-size:inherit !important;font-weight:inherit !important;line-height:inherit !important}@media only screen and (min-device-width: 320px) and (max-device-width: 374px){u ~ div .email-container{min-width:320px !important}}@media only screen and (min-device-width: 375px) and (max-device-width: 413px){u ~ div .email-container{min-width:375px !important}}@media only screen and (min-device-width: 414px){u ~ div .email-container{min-width:414px !important}}</style></head><body><div class="email-container"><table style="border-bottom: 2px solid #c52241; "><tr><td><h2 style="color:#c52241; padding-top: 62px; margin-bottom: 0px;">Activate Account</h2></td><td> <img src="' + logo_image + '" style="width: 60%; float: right;"></td></tr></table><table style="color: #000;font-size: 20px;"><tr><td style="padding: 10px 0px;">Welcome to the next generation of being Agile Ready.</td></tr><tr><td style="padding: 10px 0px;">You are invited by <b>"' + corrent_user_info.user_name + ' from (' + org_info.organization_name + ')"</b> to join their teams using Agile Ready.</td></tr><tr><td style="padding: 10px 0px;">To activate your account, press the button below.</td></tr><tr><td style="padding: 10px 0px;text-align:center;"> <button style="padding: 10px 45px;background-color: #c52241;border-radius: 10px;border: none;font-size:20px;color: #fff;"> <a href="' + varification_link + '" style="color: #fff; text-decoration: none;">Activate</a></button></td></tr><tr> <td style="padding: 10px 0px;">After activation, please log in to your account using your email address <b>"[' + user_email + ']"</b> and your password <b>"[' + password + ']".</b> We recommend you to change your password after first login.</td></tr></table><table style="border-top: 1px solid #000; color: #000; font-size: 20px;"><tr><td><h4>MANAGE Your New Account</h4></td></tr><tr><td><a href="' + settings.BASE_URL + '">Change your password</a></td></tr><tr><td><a href="' + settings.BASE_URL + '"> Get Help with your account </a></td></tr><tr><td style="font-weight: bold; padding-top: 30px;">Thank you for Joining!</td></tr><tr><td style="font-weight: bold;padding-bottom: 30px;">The Agile Ready Team</tr></table><table style="background-color: #f2f2f2; font-size: 20px;"><tr><td style="padding: 35px 30px; text-align: center;">DigiMonk Technologies, Software Technology Parks Of India Gwalior, Madhya Pradesh 474005</td></tr></table></div></body></html>'
                msg = email.message.Message()
                msg['Subject'] = 'Invitation Link From Agil'
                msg['From'] = settings.EMAIL_HOST_USER
                msg['To'] = user_email
                password = settings.EMAIL_HOST_PASSWORD
                msg.add_header('Content-Type', 'text/html')
                msg.set_payload(email_content)
                s = smtplib.SMTP(settings.EMAIL_HOST + ':' +
                                 str(settings.EMAIL_PORT))
                s.starttls()
                # Login Credentials for sending the mail
                s.login(msg['From'], password)
                s.sendmail(msg['From'], [msg['To']], msg.as_string())
                #########################################################################
                messages.info(request, "Invitation link has been sent.")
            redirect(settings.BASE_URL + "invite-user")
        return render(
            request, "admin/invite_user/index.html", {
                'user_name': request.session['user_name'],
                "BASE_URL": settings.BASE_URL
            })
    else:
        return redirect(settings.BASE_URL)
Пример #6
0
def register(request):
    if request.method == "POST":
        print(request.POST)
        yourname = request.POST["yourname"]
        user_email = request.POST["user_email"]
        user_in_dis = user_email.split("@")
        username = user_in_dis[0]
        password = request.POST["password"]
        city = request.POST["city"]
        state = request.POST["state"]
        zip_code = request.POST["zip_code"]
        country = request.POST["country"]
        number = request.POST["number"]
        organization = request.POST["organization"]
        organization_url = request.POST["organization_url"]
        if User.objects.filter(email=user_email).exists():
            return JsonResponse({
                "status": "0",
                "message": "E-mail is already exists"
            })
        else:
            if Ar_user.objects.filter(phone=number).exists():
                return JsonResponse({
                    "status": "0",
                    "message": "Phone no. is already exists"
                })
            else:
                if AR_organization.objects.filter(
                        organization_url=organization_url).filter(~Q(
                            organization_url="")).exists():
                    return JsonResponse({
                        "status":
                        "0",
                        "message":
                        "Organization URL is already exists"
                    })
                else:
                    org_id = ''.join([
                        random.choice(string.digits + string.ascii_letters)
                        for i in range(0, 10)
                    ])
                    while AR_organization.objects.filter(
                            org_id=org_id).exists():
                        org_id = ''.join([
                            random.choice(string.digits + string.ascii_letters)
                            for i in range(0, 10)
                        ])

                    user = User.objects.create_user(username=user_email,
                                                    email=user_email,
                                                    password=password,
                                                    is_active=False)
                    user.save()
                    get_user_instant = User.objects.get(email=user_email)
                    Ar_users = Ar_user(user_id=user.id,
                                       user_name=yourname,
                                       country=country,
                                       city=city,
                                       state=state,
                                       zip=zip_code,
                                       phone=number)
                    Ar_users.save()
                    # if AR_organization_status.objects.filter(status_key="Active").exists():
                    #     ar_org_status = AR_organization_status.objects.get(status_key="Active")
                    # else:
                    #     ar_org_status = AR_organization_status.objects.none()
                    ar_org = AR_organization(org_id=org_id,
                                             organization_name=organization,
                                             organization_url=organization_url,
                                             created_by=user,
                                             update_by=user)
                    ar_org.save()
                    # get_user_instant = User.objects.get(email='*****@*****.**')
                    uid = urlsafe_base64_encode(
                        force_bytes(get_user_instant.id))
                    token = account_activation_token.make_token(
                        get_user_instant)
                    varification_link = settings.BASE_URL + "account/activate/" + uid + "/" + token
                    ################################################ EMAL SEND CODE START ##############
                    logo_image = 'http://203.190.153.20/agile/assets/img/basic/logo.png'
                    email_content = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=euc-jp"><meta name="viewport" content="width=device-width"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="x-apple-disable-message-reformatting"><title>Agile | New Registration</title><style>html,body{background-color:#fff!important;margin:0 auto !important;padding:0 !important;height:100% !important;width:100% !important;color:#888!important}.email-container{max-width:600px!important;margin:0 auto!important}*{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}div[style*="margin: 16px 0"]{margin:0 !important}table,td{mso-table-lspace:0pt !important;mso-table-rspace:0pt !important}table{width:100%;border-spacing:0 !important;border-collapse:collapse !important;table-layout:fixed !important;margin:0 auto !important}img{-ms-interpolation-mode:bicubic}a{text-decoration:none!important}*[x-apple-data-detectors], .unstyle-auto-detected-links *,.aBn{border-bottom:0 !important;cursor:default !important;color:inherit !important;text-decoration:none !important;font-size:inherit !important;font-weight:inherit !important;line-height:inherit !important}@media only screen and (min-device-width: 320px) and (max-device-width: 374px){u ~ div .email-container{min-width:320px !important}}@media only screen and (min-device-width: 375px) and (max-device-width: 413px){u ~ div .email-container{min-width:375px !important}}@media only screen and (min-device-width: 414px){u ~ div .email-container{min-width:414px !important}}</style></head><body><div class="email-container"><table style="border-bottom: 2px solid #c52241; "><tr><td><h2 style="color:#c52241; padding-top: 62px; margin-bottom: 0px;">WELCOME</h2></td><td> <img src="' + logo_image + '" style="width: 60%; float: right;"></td></tr></table><table style="color: #000;font-size: 20px;"><tr><td style="padding: 10px 0px;">Dear ' + yourname + ',</td></tr><tr><td style="padding: 10px 0px;">Welcome to the next generation of being Agile Ready.Your new Agile Ready account has been created.</td></tr><tr><td style="padding: 10px 0px;">To activate your account, press the button below.</td></tr><tr><td style="padding: 10px 0px;text-align:center;"> <button style="padding: 10px 45px;background-color: #c52241;border-radius: 10px;border: none;font-size:20px;color: #fff;"> <a href="' + varification_link + '" style="color: #fff; text-decoration: none;">Activate</a></button></td></tr><tr><td style="padding: 10px 0px;">After activation, please log in to your account using your email address "' + user_email + '" and your password "' + password + '".</td></tr></table><table style="border-top: 1px solid #000; color: #000; font-size: 20px;"><tr><td><h4>MANAGE Your New Account</h4></td></tr><tr><td><a href="' + settings.BASE_URL + '">Change your password</a></td></tr><tr><td><a href="' + settings.BASE_URL + '"> Get Help with your account </a></td></tr><tr><td style="font-weight: bold; padding-top: 30px;">Thank you for Joining!</td></tr><tr><td style="font-weight: bold;padding-bottom: 30px;">The Agile Ready Team</tr></table><table style="background-color: #f2f2f2; font-size: 20px;"><tr><td style="padding: 35px 30px; text-align: center;">DigiMonk Technologies, Software Technology Parks Of India Gwalior, Madhya Pradesh 474005</td></tr></table></div></body></html>'
                    msg = email.message.Message()
                    msg['Subject'] = 'Account Create successfully'
                    msg['From'] = settings.EMAIL_HOST_USER
                    msg['To'] = user_email
                    password = settings.EMAIL_HOST_PASSWORD
                    msg.add_header('Content-Type', 'text/html')
                    msg.set_payload(email_content)
                    s = smtplib.SMTP(settings.EMAIL_HOST + ':' +
                                     str(settings.EMAIL_PORT))
                    s.starttls()
                    # Login Credentials for sending the mail
                    s.login(msg['From'], password)
                    s.sendmail(msg['From'], [msg['To']], msg.as_string())
                    ################################################ EMAL SEND CODE END ##############

                    return JsonResponse({
                        "status":
                        "1",
                        "message":
                        "Registration is done successfully verification link is sent to your email."
                    })
Пример #7
0
def index(request):
    if product_view.check_permition(request, 'Invite New User', 0):
        get_edit_permission = product_view.check_permition(request, 'Invite New User', 1)
        if request.user.is_authenticated:
            if request.method == "POST":
                user_email = request.POST["email"]
                user_emails  = user_email.split(";")
                for email_get in user_emails:
                    user_email = email_get
                    if User.objects.filter(email=user_email).exists():
                        msg = get_object_or_404(Notification, page_name="E mail",
                                                notification_key="Exists")
                        msg_data = msg.notification_desc
                        messages.error(request, user_email + " " + msg_data)
                    else:
                        try:

                            corrent_user_info = Ar_user.objects.get(user_id=request.user.id)
                            org_info = get_object_or_404(AR_organization, pk=request.session['org_id'])
                            password = ''.join([random.choice(string.digits + string.ascii_letters) for i in range(0, 10)])
                            user = User.objects.create_user(username=user_email, email=user_email, password=password,is_active=False)
                            user.save()
                            get_user_info = User.objects.get(username=user_email)
                            state = "state"
                            number = "0"
                            zip_code = "0"
                            ar_users = Ar_user(user_id=user.id,user_name="",state=state,zip=zip_code,phone=number,org_id=org_info,user_type="User",created_by=corrent_user_info.user_id,updated_by=corrent_user_info.user_id)
                            ar_users.save()
                        #########################################################################
                            uid = urlsafe_base64_encode(force_bytes(get_user_info.id))
                            token = account_activation_token.make_token(get_user_info)
                            varification_link = settings.BASE_URL + "account/activate/" + uid + "/" + token
                            logo_image = 'http://203.190.153.20/agile/assets/img/basic/logo.png'
                            email_content = ''

                            logo_image = settings.BASE_URL + 'static/img/basic/logo.png'
                            data_content = {"BASE_URL": settings.BASE_URL, "user_name": corrent_user_info.user_name, "organization_name": org_info.organization_name,"user_email": user_email,"password":password, "logo_image": logo_image,"varification_link": varification_link}
                            email_content = render_to_string('email_template/email_send_for_invite_user.html',data_content)
                            msg = email.message.Message()
                            msg['Subject'] = 'Invitation Link From Agile Ready'
                            msg['From'] = settings.EMAIL_HOST_USER
                            msg['To'] = user_email
                            password = settings.EMAIL_HOST_PASSWORD
                            msg.add_header('Content-Type', 'text/html')
                            msg.set_payload(email_content)
                            s = smtplib.SMTP(settings.EMAIL_HOST + ':' + str(settings.EMAIL_PORT))
                            s.starttls()
                        # Login Credentials for sending the mail
                            s.login(msg['From'], password)
                            s.sendmail(msg['From'], [msg['To']], msg.as_string())
                        #########################################################################
                            msg = get_object_or_404(Notification, page_name="Invitation", notification_key="Sent")
                            msg_data = msg.notification_desc
                            messages.info(request, msg_data+" "+user_email+"' !")
                        except:
                            msg = get_object_or_404(Notification, page_name="Invitation", notification_key="NOt_Sent")
                            msg_data = msg.notification_desc
                            messages.error(request, msg_data)
                redirect(settings.BASE_URL+"invite-user")
            return render(request,"admin/invite_user/index.html",{'get_edit_permission':get_edit_permission,'date':datetime.now(),'user_name':request.session['user_name'],"BASE_URL":settings.BASE_URL})
        else:
            return redirect(settings.BASE_URL)
    else:
        return render(request, 'admin/dashboard/no_permssion.html', {'BASE_URL': settings.BASE_URL})
Пример #8
0
def register(request):
    if request.method == "POST":
        print(request.POST)
        yourname = request.POST["yourname"]
        user_email = request.POST["user_email"]
        user_in_dis = user_email.split("@")
        username = user_in_dis[0]
        password = request.POST["password"]
        city = request.POST["city"]
        state = request.POST["state"]
        zip_code = request.POST["zip_code"]
        country = request.POST["country"]
        number = request.POST["number"]
        organization = request.POST["organization"]
        organization_url = request.POST["organization_url"]
        if User.objects.filter(email=user_email).exists():
            msg = get_object_or_404(Notification,
                                    page_name="E mail",
                                    notification_key="Exists")
            msg_data = msg.notification_desc
            # messages.error(request, title + " " + msg_data)
            return JsonResponse({
                "status": "0",
                "message": user_email + " , " + msg_data
            })

        else:
            if Ar_user.objects.filter(phone=number).exists():
                msg = get_object_or_404(Notification,
                                        page_name="Phone",
                                        notification_key="Exists")
                msg_data = msg.notification_desc
                return JsonResponse({
                    "status": "0",
                    "message": number + " , " + msg_data
                })
            else:
                if AR_organization.objects.filter(
                        organization_url=organization_url).filter(~Q(
                            organization_url="")).exists():
                    msg = get_object_or_404(Notification,
                                            page_name="Organization Url",
                                            notification_key="Exists")
                    msg_data = msg.notification_desc
                    return JsonResponse({
                        "status":
                        "0",
                        "message":
                        organization_url + " , " + msg_data
                    })
                else:
                    org_id = ''.join([
                        random.choice(string.digits + string.ascii_letters)
                        for i in range(0, 10)
                    ])
                    while AR_organization.objects.filter(
                            org_id=org_id).exists():
                        org_id = ''.join([
                            random.choice(string.digits + string.ascii_letters)
                            for i in range(0, 10)
                        ])

                    user = User.objects.create_user(username=user_email,
                                                    email=user_email,
                                                    password=password,
                                                    is_active=False)
                    user.save()
                    get_user_instant = User.objects.get(email=user_email)
                    if AR_organization.objects.filter(
                            organization_name=organization).exists():
                        pass
                    else:
                        ar_org = AR_organization(
                            org_id=org_id,
                            organization_name=organization,
                            organization_url=organization_url,
                            created_by=user,
                            update_by=user)
                        ar_org.save()
                    org_ins = get_object_or_404(AR_organization,
                                                organization_name=organization)

                    Ar_users = Ar_user(status="Active",
                                       user_id=user.id,
                                       user_name=yourname,
                                       country=country,
                                       city=city,
                                       state=state,
                                       zip=zip_code,
                                       phone=number,
                                       org_id=org_ins)
                    Ar_users.save()

                    data_res = set_default_value_for_org(
                        org_ins.id, Ar_users.id)
                    data_res = set_dummy_data(org_ins.id, Ar_users.id)

                    uid = urlsafe_base64_encode(
                        force_bytes(get_user_instant.id))
                    token = account_activation_token.make_token(
                        get_user_instant)
                    varification_link = settings.BASE_URL + "account/activate/" + uid + "/" + token
                    print(varification_link)
                    ################################################ EMAL SEND CODE START ##############
                    logo_image = settings.BASE_URL + 'static/img/basic/logo.png'
                    data_content = {
                        "BASE_URL": settings.BASE_URL,
                        "yourname": yourname,
                        "user_email": user_email,
                        "password": password,
                        "logo_image": logo_image,
                        "varification_link": varification_link
                    }
                    email_content = render_to_string(
                        'email_template/email_send_for_create_new_account.html',
                        data_content)
                    msg = email.message.Message()
                    msg['Subject'] = 'Account Create successfully'
                    msg['From'] = settings.EMAIL_HOST_USER
                    msg['To'] = user_email
                    password = settings.EMAIL_HOST_PASSWORD
                    msg.add_header('Content-Type', 'text/html')
                    msg.set_payload(email_content)
                    s = smtplib.SMTP(settings.EMAIL_HOST + ':' +
                                     str(settings.EMAIL_PORT))
                    s.starttls()
                    s.login(msg['From'], password)
                    s.sendmail(msg['From'], [msg['To']], msg.as_string())
                    ################################################ EMAL SEND CODE END ##############
                    msg = get_object_or_404(Notification,
                                            page_name="Registration",
                                            notification_key="Done")
                    msg_data = msg.notification_desc
                    # return JsonResponse({"status": "0", "message": organization_url + " " + msg_data})
                    return JsonResponse({
                        "status":
                        "1",
                        "message":
                        msg_data + " " + user_email + "' !"
                    })