Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6906419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:18:27+00:00 2026-05-27T08:18:27+00:00

When a user enters their info into the sign-up page and clicks submit, usernameCheck()

  • 0

When a user enters their info into the sign-up page and clicks “submit”, usernameCheck() is called. In theory, it should send an AJAX request to the server, which checks to see if the username is taken. If it is, then the user is alerted and nothing else happens. Otherwise it checks that the password is valid. In a previous question, I was told that I needed a callback function to stop the form from submitting before AJAX returned asynchronously. Instead, I put the form submit in the success: part of the AJAX request, so it should only get called iff the username is unique and the password is valid.

However, it doesn’t seem to ever get to the password check phase, or display any alert…

function usernameCheck(){ //returns true if username is free
    var ajaxHeaders = {}; //create header object
    ajaxHeaders["X-CSRFToken"] = getCookie('csrftoken'); //add csrftoken from cookies for authentication server-side
    $.ajax({
        type:'POST',
        url:"http://omnicloud.me/signup", 
      data:{username: $("#username").val()}, 
      success:function(response){
        if(response=="true"){
           $('#passAlert').innerHTML("Sorry, that username is already taken") 
           //passalert is where all of the errors (username taken, invalid password) show up
        } else {
            if (passwordCheck()){
                $('#signup_form').submit();
            }
        }
        },
    headers: ajaxHeaders //settings for ajax request
    });

    return !($('#passAlert').value == "Sorry, that username is already taken")
}

function passwordCheck(){
    var pattern =  /[a-z,A-Z,0-9,$,#,@,!,&,%,+,_,-,?]{10,}/  //regexp for valid charachers
    var text = document.getElementById('password').value;
    var msg = document.getElementById('passAlert');
    if(text.length < 10){
        msg.innerHTML = "Passwords need to be at least 10 characters long :(";
        return false;
    } else if (!text.match(pattern)){
        msg.innerHTML = "You have entered an invalid digit (sorry)";
        return false;
    } else if (unacceptable(text)){
        msg.innerHTML = "You can be more creative than that...";
        return false;
    } else if(text != document.getElementById('pass_repeat').value){
        msg.innerHTML = "Your passwords do not match.";
        return false;
    }
    return true;
}

function unacceptable(pwd){ //joins the array, if it matches any one of them 
                                                        //(g means at any point, i means case insensitive) password rejected
    var re = new RegExp(unforgivable.join("|"),"gi");
    return (pwd.toString().match(re) != null);
}

Django signup view:

def signup(request):
if request.method == 'GET':
    return render_to_response('signup.html', context_instance=RequestContext(request))
elif request.is_ajax(): 
#query db for user with username provided via ajax, return if it exists
    try:    
        user = User.objects.get(username=request.POST.get("username")) 
    except User.DoesNotExist:
        return HttpResponse("false",context_instance=RequestContext(request))
    else:
        return HttpResponse("true", context_instance=RequestContext(request))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:18:27+00:00Added an answer on May 27, 2026 at 8:18 am

    The fact that you mention the full qualified domain name;

    http://omnicloud.me/signup

    suggest to me that you are calling a server from a domain which is different from where you are loading the page and that you are running into cross domain name browser restrictions. Cross domain is possible, but requires more setup — try first to make it work using the same domian as where you are loading the page,

    i.e.use the

       /signup
    

    on the same server rather than using the http://omni.... part.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a registration page where the user enters their contact information and their username
I'm creating a 'forgot password' page where the user enters their email address and
I have a cell in which the user enters their name, a serial number
I am creating an app in C# where the user enters their name and
When a user enters a search query, I'd like to track: 1) Their search
I have an activity that has an EditText. After a user enters their text,
I have a form that when the user enters their name it automatically capitalise's
I created a basic purchase script where a user enters their desired username and
On a website that I'm working on for my school, the user enters their
Basically i'm trying to set something where a user enters some text into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.