Exemplo n.º 1
0
def register_page():
    try:
        form = LR.RegistrationForm(request.form)
        if request.method == "POST" and form.validate():
            username  = form.username.data
            email = form.email.data
            password = sha256_crypt.encrypt(str(form.password.data))
            userCollection = dbclient["TicketedIssues"]["Users"]
            if not re.match(emailRegex, email):
                flash("Email Invalid")
                time.sleep(5)
                return redirect(url_for("login"))
            for users in userCollection.find():
                if users["username"].casefold() == username.casefold():
                    flash("Username is already taken, case-insensitive")
                    time.sleep(5)
                    return redirect(url_for("login"))
                if users["email"].casefold() == email.casefold():
                    flash("Email is already taken.")
                    time.sleep(5)
                    return redirect(url_for("login"))
            else:
                newUser = {
                    "username" : username,
                    "email" : email,
                    "passHash" : password, 
                    "auth" : Auth.getAuthVal()
                }
                userCollection.insert_one(newUser)
                flash("User Registered")
                time.sleep(5)
                return redirect(url_for("login"))
        return render_template("register.html", form=form)
    except Exception as e:
        return(str(e))
Exemplo n.º 2
0
def initialize():
    global token_pair
    global tokens
    global user
    global friend

    token_pair = Auth.GrabNewTokens(setting["grab_token"])
    if token_pair == None:
        return False

    tokens["oauth"] = token_pair[0]
    tokens["refresh"] = token_pair[1]
    user = User(tokens)
    friend = Friend(tokens)

    return True
Exemplo n.º 3
0
import time
import screenshots

TEXT = 1
PICTURE = 3

group_id = "c2f1553c7ec794caaa6a09d63da5ef0e6654c572-854"
email = "*****@*****.**"
password = "******"
# uuid = "eab93af0-cbcd-4c50-95f1-211806ea585c"
uuid = "4c2ea08e-24e0-4769-a1b1-5226181f931c"
uuid = "fe1fdbfa-f1a1-47ac-b793-e648fba25e86"
# verification_code = "075420"
verification_code = "146355"
directory = "../tournaments/PS4/01-06-2018"
auth = Auth(email, password, uuid, verification_code)
tokens = auth.get_tokens()
print(tokens)
exit()
friend = Friend(tokens)
messaging = Messaging(tokens)

subscribed_teams = None
subscribed_teams_filename = "{}/inscriptions/inscrits_update.json".format(
    directory)
with open(subscribed_teams_filename) as data_file:
    subscribed_teams = json.load(data_file)


def split_message_by_length(message):
    message_length = 512
Exemplo n.º 4
0
from src.Auth import Auth
from src.Friend import Friend
from src.User import User
from src.Messaging import Messaging

auth = Auth('YOUR EMAIL', 'YOUR PASSWORD')
tokens = auth.get_tokens()

friend = Friend(tokens)
friend_list = friend.my_friends()

friend_string = ''
if bool(friend_list):
    for key, value in friend_list.items():
        friend_string += key + ' is playing ' + value + "\n"
else:
    friend_string = 'No friends online'

print(friend_string)
Exemplo n.º 5
0
        pass

    def run(self):
        pass


if __name__ == "__main__":
    # (   mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime) = os.stat('/home/thomas/gitrepos/google-drive-for-linux/main.py')
    # print("last modified: %s" % time.ctime(mtime))
    # print(mtime)

    JSONData().refresh()
    # # before everything, check if Drive directory exists, if not, create one
    doFullSync = IOHelpers().checkIfDriveDirectoryExists()
    # # run logic, maybe make run return some status or similiar
    Auth()

    if doFullSync:
        DriveSync().firstRun()
    else:
        DriveSync().sync()

    # # pprint(GoogleFile('1kjDoCyCuJfNM3jYzX7icIGY3hTbFJidx').getFilePath())

    # ## full sync

    # # reload JSON files (token.json)
    JSONData().refresh()
    # print(Auth.token)

    # iMain = Main()