Allow administration through email

This commit is contained in:
RunasSudo 2018-08-23 14:31:58 +10:00
parent 05d5650f2f
commit 4bc3fcf30c
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 18 additions and 8 deletions

View File

@ -448,6 +448,14 @@ def email_login():
def email_authenticate():
user = None
for u in app.config['ADMINS']:
if isinstance(u, EmailUser):
if u.email.lower() == flask.request.form['email'].lower():
if u.password == flask.request.form['password']:
user = u
break
if user is None:
for election in Election.get_all():
for voter in election.voters:
if isinstance(voter.user, EmailUser):

View File

@ -9,9 +9,11 @@ AUTH_METHODS = [
('reddit', 'Reddit')
]
import eos.base.election
import eos.redditauth.election
ADMINS = [
#eos.redditauth.election.RedditUser(username='xxxxxxxx')
#eos.redditauth.election.RedditUser(username='xxxxxxxx'),
#eos.base.election.EmailUser(email='xxxxx@example.com', password='abc123'),
]
TASK_RUN_STRATEGY = 'eos.core.tasks.direct.DirectRunStrategy'