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
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
def test_set_password(self): user = mongoengine_auth.User(username="******") user.set_password("password") self.assertTrue(utils.check_password("password", user.password))
def test_encodepassword(self): result = utils.encode_password("password") self.assertTrue(utils.check_password("password", result))
def test_check_password(self): enc_password = '******' self.assertTrue(utils.check_password("password", enc_password)) self.assertFalse(utils.check_password("notpassword", enc_password))
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)