Ejemplo n.º 1
0
 def newusertarget(self,**kwargs):
     #THIS IS A HACK TO PREVENT UNICODE STRINGS IN PY2.XX FROM GETTING THROUGH
     #BECAUSE QUOTE() IS USUALLY WHERE THEY CRASH. #AWFULHACK
     quote(kwargs['username'])
     pages.require("/admin/users.edit")
     #create the new user     
     auth.addUser(kwargs['username'],kwargs['password'])
     #Take the user back to the users page
     messagebus.postMessage('/system/notifications','New user "'+kwargs['username']+'" added')
     raise cherrypy.HTTPRedirect("/auth/")
    def newusertarget(self, **kwargs):
        #THIS IS A HACK TO PREVENT UNICODE STRINGS IN PY2.XX FROM GETTING THROUGH
        #BECAUSE QUOTE() IS USUALLY WHERE THEY CRASH. #AWFULHACK
        quote(kwargs['username'])
        pages.require("/admin/users.edit")
        #create the new user

        auth.addUser(kwargs['username'], kwargs['password'])
        #Take the user back to the users page
        raise cherrypy.HTTPRedirect("/auth/")
Ejemplo n.º 3
0
def register():
    if request.method == 'GET':
        return render_template('register.html')
    else:
        usr = str(request.form['usr'])
        pwd = str(request.form['pwd'])
        
        if users.find({'username':usr}).count() != 0:
            return render_template('register.html',
                                   error = 'Username already exists')
        else:
            #db[usr] = pwd
            #db.close
            auth.addUser(usr, pwd);
            return render_template("welcome.html",username=usr)
Ejemplo n.º 4
0
def register():
    if request.method == 'GET':
        return render_template('register.html')
    else:
        usr = str(request.form['usr'])
        pwd = str(request.form['pwd'])

        if users.find({'username': usr}).count() != 0:
            return render_template('register.html',
                                   error='Username already exists')
        else:
            #db[usr] = pwd
            #db.close
            auth.addUser(usr, pwd)
            return render_template("welcome.html", username=usr)
Ejemplo n.º 5
0
def register():
    if 'username' in session:
        return redirect(url_for('home'))
    elif request.method == 'GET':
        return render_template('register.html')
    username = request.form['Username']
    password = request.form['Password']
    cpassword = request.form['CPassword']
    if auth.exists(username):
        return render_template('register.html',
                               message='Username already exists')
    if password != cpassword:
        return render_template('register.html',
                               message='Passwords do not match')
    auth.addUser(username, password)
    return redirect(url_for('home'))
Ejemplo n.º 6
0
def signup():
    requestJSON = request.json
    resp = auth.addUser(requestJSON)
    if resp:
        session["username"] = requestJSON["username"]
        access_token = create_access_token(identity=requestJSON["username"])
        return jsonify({"login": "******", "auth": access_token})
    else:
        return jsonify({"login": "******"})
Ejemplo n.º 7
0
def register():
    if (request.method=="GET"):
        return render_template("register.html")
    elif (request.form['button']=="Cancel"):
        return redirect("/")
    else:
        
        if (request.form["username"]==""):
            return render_template("register.html",error="nouser")
        elif (request.form["password"]==""):
            return render_template("register.html",error="nopass")
        elif (request.form["cpassword"]==""):
            return render_template("register.html",error="badc")
        elif (request.form["username"]==request.form["password"]):
            return render_template("register.html",error="lazy")
        elif request.form["password"]!=request.form["cpassword"]:
            return render_template("register.html",error="badc")
        
        elif request.form["password"]==request.form["cpassword"]:
            if auth.addUser(str(request.form["username"]),str(request.form["password"]) ):
                return redirect("/")
Ejemplo n.º 8
0
def register():
    if (request.method == "GET"):
        return render_template("register.html")
    elif (request.form['button'] == "Cancel"):
        return redirect("/")
    else:

        if (request.form["username"] == ""):
            return render_template("register.html", error="nouser")
        elif (request.form["password"] == ""):
            return render_template("register.html", error="nopass")
        elif (request.form["cpassword"] == ""):
            return render_template("register.html", error="badc")
        elif (request.form["username"] == request.form["password"]):
            return render_template("register.html", error="lazy")
        elif request.form["password"] != request.form["cpassword"]:
            return render_template("register.html", error="badc")

        elif request.form["password"] == request.form["cpassword"]:
            if auth.addUser(str(request.form["username"]),
                            str(request.form["password"])):
                return redirect("/")