コード例 #1
0
 def test_user_creation(self):
     util.createUser(self.ref, 'Test User', '*****@*****.**', 150)
     time.sleep(1)
     expected_data = {u'email': u'*****@*****.**', u'name': u'Test User'}
     path = '/users/simplelogin:150'
     actual_data = self.ref.get(path, None)
     self.assertEqual(expected_data, actual_data)
コード例 #2
0
ファイル: app.py プロジェクト: dlevylambert/forebrains
def signup():
    if request.method=="GET":
        return render_template("signup.html")
    else:
        pending = request.form.keys()[0]
        if "tab" in pending:
            return handleTabs(pending)
        user = str(request.form["user"])
        password = str(request.form["pass1"])
        if request.form.has_key("back"):
            return redirect(url_for("home"))
        if user == "":
            return render_template("signup.html",nouser=True)
        if password == "":
            return render_template("signup.html",nopassword=True)
        elif password != str(request.form["pass2"]):
            return render_template("signup.html",notmatching=True)
        if util.createUser(user,password):
            return redirect(url_for("login"))
        else:
            return render_template("signup.html",taken=True)
コード例 #3
0
ファイル: app.py プロジェクト: dlevylambert/Vikings
def signup():
    if request.method=="GET":
        return render_template("signup.html")
    else:
        # adding some testing functions for signing up users
        # DK: UPDATE, 12:35 PM 4/30. Saving profiles works. For some reason, my dkurk account saved every field as 'dkurk' and I was worried but it looks like this was fixed along the way!
        if request.form.has_key("submitsignup"):
            user = str(request.form["Username"])
            #print user
            password = str(request.form["Password"])
            #print password
            age = str(request.form["Age"])
            #print age
            realname = str(request.form["RealName"])
            #print realname
            gender = str(request.form["Gender"])
            #print gender
            hobbies = str(request.form["Hobbies"])
            #print hobbies
            youtube = str(request.form["Youtube"])
            print youtube
            reached = False
            i = 0
            youtubeID=""
            index = youtube.find('=')
            #print index
            if (index):
                youtubeID= youtube[index + 1:len(youtube)]
            #for letter in youtube:
                #if (reached):
                    #youtubeID=youtubeID + letter
                    #if (letter == "=")
                    #reached = True
                    #if (reached == False):
                    #youtubeID="9ZEURntrQOg"
                    #print youtubeID
                    #validate = util.createUser(user,password,age,realname,gender,hobbies)
            validate = util.createUser(user,password,age,realname,gender,hobbies,youtubeID)
            if validate == 0:
                print "no"
                return render_template("signup.html", failure = True)
            if validate == True:
                session['user'] = user
                print "worked"
                return redirect(url_for("home"))
            if validate == False:
                print "no"
                return render_template("signup.html", failure = True)
        if request.form.has_key("tablogin"):
            return redirect(url_for("login"))
        if request.form.has_key("tabhome"):
            return redirect(url_for("home"))
        if request.form.has_key("tabsignup"):
            return redirect(url_for("signup"))
        if request.form.has_key("tabcreate"):
            return redirect(url_for("create"))
        if request.form.has_key("tabprofile"):
            return redirect(url_for("myprofile"))
        if request.form.has_key("tabsurvey"):
            return redirect(url_for("survey"))
        if request.form.has_key("tabresults"):
            return redirect(url_for("results"))