async def authenticate(self, handler, data):
     _username = data['username'].strip()
     _password = data['password']
     if '@' in _username:
         # Prevent use of email as login
         return None
     api = Api(_username, _password)
     try:
         if api.check_credential():
             ret = {
                 'name': _username,
                 'auth_state': {
                     'userdata': {
                         'authenticator': 'iotlab',
                         'username': _username,
                         'password': _password,
                     }
                 }
             }
             return ret
     except:
         pass
     return None
Ejemplo n.º 2
0
def check_user_credentials(username, password):
    """ Check that the given credentials are valid """
    api = Api(username, password)
    return api.check_credential()
Ejemplo n.º 3
0
def check_user_credentials(username, password):
    """ Check that the given credentials are valid """
    api = Api(username, password)
    return api.check_credential()