Allow auth providers to influence is_active (#15557)

* Allow auth providers to influence is_active

* Fix auth script test
This commit is contained in:
Paulus Schoutsen
2018-07-19 22:10:36 +02:00
committed by GitHub
parent a42288d056
commit 2fcacbff23
11 changed files with 82 additions and 23 deletions

View File

@@ -75,14 +75,16 @@ class ExampleAuthProvider(AuthProvider):
Will be used to populate info when creating a new user.
"""
username = credentials.data['username']
info = {
'is_active': True,
}
for user in self.config['users']:
if user['username'] == username:
return {
'name': user.get('name')
}
info['name'] = user.get('name')
break
return {}
return info
class LoginFlow(data_entry_flow.FlowHandler):