Ejemplo n.º 1
0
    def post(self):
        self.user_username = self.request.get('username')
        self.user_password = self.request.get('password')
        self.user_verify = self.request.get('verify')
        self.user_email = self.request.get('email')
        
        username_error = helpers.check_username(self.user_username)
        password_error = helpers.check_password(self.user_password)
        verify_error = ''
        if not password_error:
            verify_error = helpers.check_verify(self.user_verify, self.user_password)
        email_error = helpers.check_email(self.user_email)

        if (username_error or password_error or verify_error or email_error):
            self.write_form(self.user_username, '', '',
                self.user_email, username_error, password_error, verify_error, 
                email_error)
        else:
            self.done()
Ejemplo n.º 2
0
    def post(self):
        user_username = self.request.get('username')
        user_password = self.request.get('password')
        user_verify = self.request.get('verify')
        user_email = self.request.get('email')
        
        username_error = helpers.check_username(user_username)
        password_error = helpers.check_password(user_password)
        verify_error = ''
        if not password_error:
            verify_error = helpers.check_verify(user_verify, user_password)
        email_error = helpers.check_email(user_email)

        if (username_error or password_error or verify_error or email_error):
            self.write_form(user_username, '', '',
                user_email, username_error, password_error, verify_error, 
                email_error)
        else:
            self.redirect('/welcome?username=%s' % user_username)
Ejemplo n.º 3
0
def handle_name_setup(proto_inst, name, mppass):
    if name in proto_inst.factory.data.ops:
       proto_inst.player.set_op(True)
    if name in proto_inst.factory.data.silentbanned:
        proto_inst.transport.loseConnection()
        return False
    if name in proto_inst.factory.data.crashbanned:
        pass
        return False
    if name in proto_inst.factory.data.banned:
        helpers.disconnect_protocol(proto_inst, "You are banned!")
        return False
    
    if config.CHECK_USERNAMES:
        if not helpers.check_username(name, mppass, proto_inst.factory.data.salt):
            helpers.disconnect_protocol(proto_inst, "Wrong MPPASS!")
            return False

    proto_inst.player.set_username(name)
    return True