Fixes login_bare + register_bare w/ custom login_userfield
This commit is contained in:
+10
-6
@@ -775,8 +775,8 @@ class Mail(object):
|
|||||||
if attachments:
|
if attachments:
|
||||||
result = mail.send_mail(
|
result = mail.send_mail(
|
||||||
sender=sender, to=origTo,
|
sender=sender, to=origTo,
|
||||||
subject=to_unicode(subject, encoding),
|
subject=to_unicode(subject, encoding),
|
||||||
body=to_unicode(text or '', encoding),
|
body=to_unicode(text or '', encoding),
|
||||||
html=html,
|
html=html,
|
||||||
attachments=attachments, **xcc)
|
attachments=attachments, **xcc)
|
||||||
elif html and (not raw):
|
elif html and (not raw):
|
||||||
@@ -794,7 +794,7 @@ class Mail(object):
|
|||||||
try:
|
try:
|
||||||
raw = {'Data': payload.as_string()}
|
raw = {'Data': payload.as_string()}
|
||||||
response = client.send_raw_email(RawMessage=raw,
|
response = client.send_raw_email(RawMessage=raw,
|
||||||
Source=sender,
|
Source=sender,
|
||||||
Destinations=to)
|
Destinations=to)
|
||||||
return True
|
return True
|
||||||
except ClientError as e:
|
except ClientError as e:
|
||||||
@@ -2161,7 +2161,10 @@ class Auth(AuthAPI):
|
|||||||
user = None
|
user = None
|
||||||
checks = []
|
checks = []
|
||||||
# make a guess about who this user is
|
# make a guess about who this user is
|
||||||
for fieldname in ['registration_id', 'username', 'email']:
|
guess_fields = ['registration_id', 'username', 'email']
|
||||||
|
if self.settings.login_userfield:
|
||||||
|
guess_fields.append(self.settings.login_userfield)
|
||||||
|
for fieldname in guess_fields:
|
||||||
if fieldname in table_user.fields() and \
|
if fieldname in table_user.fields() and \
|
||||||
keys.get(fieldname, None):
|
keys.get(fieldname, None):
|
||||||
checks.append(fieldname)
|
checks.append(fieldname)
|
||||||
@@ -2255,7 +2258,8 @@ class Auth(AuthAPI):
|
|||||||
def _get_login_settings(self):
|
def _get_login_settings(self):
|
||||||
table_user = self.table_user()
|
table_user = self.table_user()
|
||||||
userfield = self.settings.login_userfield or 'username' \
|
userfield = self.settings.login_userfield or 'username' \
|
||||||
if 'username' in table_user.fields else 'email'
|
if self.settings.login_userfield or 'username' \
|
||||||
|
in table_user.fields else 'email'
|
||||||
passfield = self.settings.password_field
|
passfield = self.settings.password_field
|
||||||
return Storage({'table_user': table_user,
|
return Storage({'table_user': table_user,
|
||||||
'userfield': userfield,
|
'userfield': userfield,
|
||||||
@@ -3630,7 +3634,7 @@ class Auth(AuthAPI):
|
|||||||
onaccept = self.settings.profile_onaccept
|
onaccept = self.settings.profile_onaccept
|
||||||
if log is DEFAULT:
|
if log is DEFAULT:
|
||||||
log = self.messages['profile_log']
|
log = self.messages['profile_log']
|
||||||
|
|
||||||
form = SQLFORM(
|
form = SQLFORM(
|
||||||
table_user,
|
table_user,
|
||||||
self.user.id,
|
self.user.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user