def pre_command_proccess(event):
    player = get_py_player(event.getPlayer())
    if player.logging_in:
        args = event.getMessage().split(" ")
        if not args[0].lower() == "/login":
            msg(player.player, "&4You need to login before you do that!")
            event.setCancelled(True)
Exemplo n.º 2
0
def pre_command_proccess(event):
    player = get_py_player(event.getPlayer())
    if player.logging_in:
        args = event.getMessage().split(" ")
        if not args[0].lower() == "/login":
            msg(player.player, "&4You need to login before you do that!")
            event.setCancelled(True)
def login_command(sender, command, label, args):
    py_player = get_py_player(sender)

    if not py_player.logging_in:
        msg(sender,"&cAlready logged in!")

    password = args[0]
    matches(password, sender)
Exemplo n.º 4
0
def login_command(sender, command, label, args):
    py_player = get_py_player(sender)

    if not py_player.logging_in:
        msg(sender, "&cAlready logged in!")

    password = args[0]
    matches(password, sender)
Exemplo n.º 5
0
def matches_thread(password, user):
    hashed = get_pass(uid(user))
    py_player = get_py_player(user)
    if crypt.verify(password, hashed):
        if py_player.logging_in:
            py_player.logging_in = False
            msg(user, "&aLogged in successfully!")
    else:
        if py_player.logging_in:
            msg(user, "&cInvalid password!")
def matches_thread(password, user):
    hashed = get_pass(uid(user))
    py_player = get_py_player(user)
    if crypt.verify(password, hashed):
        if py_player.logging_in:
            py_player.logging_in = False
            msg(user, "&aLogged in successfully!")
    else:
        if py_player.logging_in:
            msg(user, "&cInvalid password!")
def on_join(event):
    user = event.getPlayer()
    py_player = get_py_player(event.getPlayer())
    if is_registered(uid(user)):
        msg(event.getPlayer(), "&4You will be disconnected after 60 seconds if you don't &alogin")
        msg(user, "&cUse /login <password>")
        py_player.logging_in = True
        py_player.login_time = time.time()
        return
    elif user.hasPermission(admin_perm):
        pass #Do what? force them to make a password, lots of code, maybe just message us on slack?
Exemplo n.º 8
0
def on_join(event):
    user = event.getPlayer()
    py_player = get_py_player(event.getPlayer())
    if is_registered(uid(user)):
        msg(
            event.getPlayer(),
            "&4You will be disconnected after 60 seconds if you don't &alogin")
        msg(user, "&cUse /login <password>")
        py_player.logging_in = True
        py_player.login_time = time.time()
        return
    elif user.hasPermission(admin_perm):
        pass  #Do what? force them to make a password, lots of code, maybe just message us on slack?
Exemplo n.º 9
0
def rmpass_command(sender, command, label, args):

    py_player = get_py_player(sender)

    if py_player.logging_in:
        return "&cYou are not logged in"

    if not is_registered(uid(sender)):
        return "&cYou are not registered!"

    if py_player.logging_in == False:
        delete_pass(uid(sender))
        return "&aPassword removed successfully. You will not be prompted anymore."
    return "&cFailed to remove password, please contact a staff member"
def rmpass_command(sender, command, label, args):

    py_player = get_py_player(sender)

    if py_player.logging_in:
        return "&cYou are not logged in"

    if not is_registered(uid(sender)):
        return "&cYou are not registered!"

    if py_player.logging_in == False:
        delete_pass(uid(sender))
        return "&aPassword removed successfully. You will not be prompted anymore."
    return "&cFailed to remove password, please contact a staff member"
def change_pass_command(sender, command, label, args):
    
    py_player = get_py_player(sender)

    if py_player.logging_in:
        return "&cYou are not logged in"
    if not len(args) == 2:
        return "&cInvalid arguments"

    password = args[0]
    new_password = args[1]
    uuid = uid(sender)

    if is_registered(uuid):
        change_pass(uuid, crypt.encrypt(new_password, rounds=200000, salt_size=16))
        return "&aPassword changed"
    return "&cYou are not registered"
Exemplo n.º 12
0
def register_command(sender, command, label, args):

    py_player = get_py_player(sender)

    if len(args) > 1:
        return "&cPassword can only be one word!"

    uuid = uid(sender)
    if is_registered(uuid):
        return "&cYou are already registered!"

    password = args[0]

    if len(password) < min_pass_length:
        return "&cThe password has to be made up of at least %s characters!" % min_pass_length

    create_pass(uuid, password)
    return "&cPassword set. Use /login <password> upon join."
Exemplo n.º 13
0
def change_pass_command(sender, command, label, args):

    py_player = get_py_player(sender)

    if py_player.logging_in:
        return "&cYou are not logged in"
    if not len(args) == 2:
        return "&cInvalid arguments"

    password = args[0]
    new_password = args[1]
    uuid = uid(sender)

    if is_registered(uuid):
        change_pass(uuid,
                    crypt.encrypt(new_password, rounds=200000, salt_size=16))
        return "&aPassword changed"
    return "&cYou are not registered"
def register_command(sender, command, label, args):

    py_player = get_py_player(sender)

    if len(args) > 1:
        return "&cPassword can only be one word!"

    uuid = uid(sender)
    if is_registered(uuid):
        return "&cYou are already registered!"

    password = args[0]

    if len(password) < min_pass_length:
        return "&cThe password has to be made up of at least %s characters!" % min_pass_length

    create_pass(uuid, password)
    return "&cPassword set. Use /login <password> upon join."
def rmotherpass_command(sender, command, label, args):
    
    py_player = get_py_player(sender)

    if py_player.logging_in:
        return "&cYou are not logged in"
    
    if not sender.hasPermission(admin_perm):
        noperm(sender)
        return

    user = server.getOfflinePlayer(args[0])
    
    if is_registered(uid(user)):
        delete_pass(uid(user))
        runas(server.getConsoleSender(), colorify("mail send %s &cYour password was reset by a staff member. Use &6/register&c to set a new one." % user.getName()))
        return "&aPassword of %s reset successfully" % user.getName()
    return "&cThat player could not be found (or is not registered)"
Exemplo n.º 16
0
def rmotherpass_command(sender, command, label, args):

    py_player = get_py_player(sender)

    if py_player.logging_in:
        return "&cYou are not logged in"

    if not sender.hasPermission(admin_perm):
        noperm(sender)
        return

    user = server.getOfflinePlayer(args[0])

    if is_registered(uid(user)):
        delete_pass(uid(user))
        runas(
            server.getConsoleSender(),
            colorify(
                "mail send %s &cYour password was reset by a staff member. Use &6/register&c to set a new one."
                % user.getName()))
        return "&aPassword of %s reset successfully" % user.getName()
    return "&cThat player could not be found (or is not registered)"
 def on_blocked_event(event):
     user = get_py_player(event.getPlayer())
     if user.logging_in:
         event.setCancelled(True)
Exemplo n.º 18
0
 def on_blocked_event(event):
     user = get_py_player(event.getPlayer())
     if user.logging_in:
         event.setCancelled(True)