def register_user(self, username, user_salt, user_verifier):
     if (database.userExists(username)):
         raise TypeError("Username Taken")
     database.newUser(username, [
         base64.b64encode(self.login_lib.hexToBytes(user_salt)),
         base64.b64encode(self.login_lib.hexToBytes(user_verifier)), b''
     ], [])
     return True
 def register_user_encrypted(self, username, user_salt, user_verifier):
     if (database.userExists(username)):
         raise TypeError("Username Taken")
     database.newUser(username, [
         base64.b64encode(self.crypto_lib.rsa_decrypt(user_salt)),
         base64.b64encode(self.crypto_lib.rsa_decrypt(user_verifier)), b''
     ], [])
     return True
Exemple #3
0
def osuSignManager(osuid,
                   osuname,
                   osuOauthData,
                   osuUserData,
                   requestInfo=None):
    database.osuTokenSave(osuid, osuOauthData)
    user = database.getUserByosuid(osuid)
    # user not exists? register
    if user == None:
        if database.newUser(osuid, osuname, osuUserData):
            info, status = '注册登录成功', 1
        else:
            info, status = '创建用户时失败', -1
        authorization = handleUserLogin(osuid,
                                        osuUserData,
                                        requestInfo,
                                        status,
                                        loginType=2)
        return info, status, authorization
    # exists? done
    info, status = '登录成功', 1
    database.updateUserInfo(user, osuUserData)
    authorization = handleUserLogin(osuid,
                                    osuUserData,
                                    requestInfo,
                                    status,
                                    loginType=1,
                                    user=user)
    return info, status, authorization
def signup():
    if request.method == "GET":
        if session.get('user') != None:
            return redirect("/")
        else:
            return render_template("/signup.html", current_user=session.get('user'))
    else:
        if request.form.get("password") == request.form.get("password2"):
            if database.newUser(request.form.get("login"), request.form.get("password")):
                return redirect("/login")
            else:
                error = "Username has already been taken"
                return render_template("signup.html", error=error, current_user=None)
        else:
            error = "Passwords do not match"
            return render_template("signup.html", error=error, current_user=None)
def signup():
    if request.method == "GET":
        if session.get('user') != None:
            return redirect("/")
        else:
            return render_template("/signup.html", current_user = session.get('user'))
    else:
        if request.form.get("password") == request.form.get("password2"):
            if database.newUser(request.form.get("login"), request.form.get("password")):
                return redirect("/login")
            else:
                error = "Username has already been taken"
                return render_template("signup.html", error=error, current_user = None)
        else:
            error = "Passwords do not match"
            return render_template("signup.html", error=error, current_user = None)
Exemple #6
0
def testing():
     database.newUser("Johnny", "testingtesting123")