Ejemplo n.º 1
0
    def authenticate(self, data):
        try:
            username, password = data['username'], data['password']
        except KeyError:
            return  # Bad form data, don't authenticate

        users = current_app.config['AUTH_USERS']

        if username in users and utils.check_password(
                password, users[username]['password']):
            return username  # Good
Ejemplo n.º 2
0
    def authenticate(self, data):
        try:
            username, password = data['username'], data['password']
        except KeyError:
            return # Bad form data, don't authenticate

        users = current_app.config['AUTH_USERS']

        if username in users and utils.check_password(password,
                                                      users[username]['password']):
            return username # Good
Ejemplo n.º 3
0
    def test_set_password(self):
        user = mongoengine_auth.User(username="******")
        user.set_password("password")

        self.assertTrue(utils.check_password("password", user.password))
Ejemplo n.º 4
0
 def test_encodepassword(self):
     result = utils.encode_password("password")
     
     self.assertTrue(utils.check_password("password", result))
Ejemplo n.º 5
0
    def test_check_password(self):
        enc_password = '******'

        self.assertTrue(utils.check_password("password", enc_password))
        self.assertFalse(utils.check_password("notpassword", enc_password))
Ejemplo n.º 6
0
    def test_encodepassword(self):
        result = utils.encode_password("password")

        self.assertTrue(utils.check_password("password", result))
Ejemplo n.º 7
0
    def test_check_password(self):
        enc_password = '******'

        self.assertTrue(utils.check_password("password", enc_password))
        self.assertFalse(utils.check_password("notpassword", enc_password))
Ejemplo n.º 8
0
 def check_password(self, raw_password):
     """
     Returns a boolean of whether the raw_password was correct. Handles
     encryption formats behind the scenes.
     """
     return utils.check_password(raw_password, self.password)        
Ejemplo n.º 9
0
 def check_password(self, raw_password):
     """
     Returns a boolean of whether the raw_password was correct. Handles
     encryption formats behind the scenes.
     """
     return utils.check_password(raw_password, self.password)