Closed dima23113 closed 2 years ago
Hello 👋. Which version are you using? Also do you see anything particular in the logs?
I use django 4.0 and python 3.9
Hello, the log is below. In general, something is wrong in the line of code if k is verify and v[0][0][1][0]: because I don't get anything from there
def send_email(user, thread=True, **kwargs):
try:
user.save()
if kwargs.get('custom_salt'):
default_token_generator.key_salt = kwargs['custom_salt']
expiry_ = kwargs.get('expiry')
token, expiry = default_token_generator.make_token(user, expiry_)
print(token) # it' ok
sender = _get_validated_field('EMAIL_FROM_ADDRESS')
domain = _get_validated_field('EMAIL_PAGE_DOMAIN')
subject = _get_validated_field('EMAIL_MAIL_SUBJECT')
mail_plain = _get_validated_field('EMAIL_MAIL_PLAIN')
mail_html = _get_validated_field('EMAIL_MAIL_HTML')
args = (user, token, expiry, sender, domain, subject, mail_plain, mail_html)
print(args) # it' ok
if thread:
t = Thread(target=send_email_thread, args=args)
print(t) # it' ok
t.start()
else:
send_email_thread(*args)
print(send_email_thread) # it' ok
except AttributeError:
print('hi') # it' ok
raise InvalidUserModel('The user model you provided is invalid')
def send_email_thread(user, token, expiry, sender, domain, subject, mail_plain, mail_html):
domain += '/' if not domain.endswith('/') else ''
print(domain) # it' ok
from .views import verify
link = ''
print(get_resolver(None).reverse_dict.items()) # it' ok
for k, v in get_resolver(None).reverse_dict.items():
print(k, v) # nothing
if k is verify and v[0][0][1][0]:
print(v[0][0][1][0]) # nothing
addr = str(v[0][0][0])
print(addr) # nothing
link = domain + addr[0: addr.index('%')] + token
print(link) # nothing
else:
print('not verify') # else doesn't work, then it's ok?
context = {'link': link, 'expiry': expiry, 'user': user}
print(context) # everything except link`
bmFtZWRpbWFhMTNAZ21haWwuY29t-azbl9s-f774f2c2a2f6297fa5428fc27a066f6a972e3671 - token (<CustomUser: namedimaa13@gmail.com>, 'bmFtZWRpbWFhMTNAZ21haWwuY29t-azbl9s-f774f2c2a2f6297fa5428fc27a066f6a972e3671', datetime.datetime(1991, 1, 16, 5, 25, 4), 'noreply@aliasaddress.com', 'http://127.0.0.1:8000/', 'Confirm your email', 'mail_body.txt', 'mail_body.html') - args <Thread(Thread-2, initial daemon)> - Thread method http://127.0.0.1:8000/ -domain <generator object MultiValueDict.items at 0x000001BDC3182B30> - get_resolver(None).reverse_dict.items() {'link': '', 'expiry': datetime.datetime(1991, 1, 16, 5, 25, 4), 'user': <CustomUser: namedimaa13@gmail.com>} - context
I tried to install version 3.2 and it did not solve the problem
Try installing version 0.1.1rc1 of this library. Also have you included the library urls in your urls.py?
It works! Thank you very much :3
Hey! Why is the link empty?
views.py ` class UserRegisterView(View):
`
I get this msg