Resend features
This commit is contained in:
parent
e8f0487e05
commit
c8d9092ffc
@ -75,3 +75,18 @@ def index():
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
return json.dumps({}, indent = 2).encode()
|
||||
|
||||
@app.route('/api/auth/registration/resend', method='GET')
|
||||
def index():
|
||||
try:
|
||||
params = {
|
||||
"email" : request.query.email,
|
||||
"mako" : {
|
||||
"email" : template_email.main(directory.page["email"], "verification")
|
||||
}
|
||||
}
|
||||
response.content_type = 'application/json'
|
||||
return json.dumps(api_auth.auth().resend(params), indent = 2).encode()
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
return json.dumps({}, indent = 2).encode()
|
||||
|
@ -170,14 +170,12 @@ class auth:
|
||||
token = result_unverified["token"].decode()
|
||||
if result_unverified["count"] >= 1:
|
||||
loggorilla.prcss(APIADDR, "Generate URL")
|
||||
# TODO: set expired time
|
||||
expired = datetime.datetime.now() + datetime.timedelta(minutes=30) # Can be hours or minutes
|
||||
expired_isoformat = expired.isoformat()
|
||||
payload = {
|
||||
"token" : token,
|
||||
"expired": expired_isoformat
|
||||
}
|
||||
# TODO: Config SSH key for tokenguard and set verification URL
|
||||
token_encrypt = tokenguard.encode(payload, globalvar.ssh['key']['private'], globalvar.ssh['passphrase'])
|
||||
verification_url = globalvar.verification_url(token_encrypt)
|
||||
notme_url = globalvar.notme_url(token_encrypt)
|
||||
@ -187,12 +185,12 @@ class auth:
|
||||
self.smtpconfig['text' ] = f"Please visit this link to complete the registration: {verification_url}. You are not registering this? report on this: {notme_url}."
|
||||
self.smtpconfig['html' ] = Template(params["mako"]["email"]['index']).render(
|
||||
title = globalvar.title,
|
||||
heading = self.smtpconfig['subject'],
|
||||
image = "https://colorlib.com/etc/email-template/10/images/email.png",
|
||||
unsubscribe = "#",
|
||||
header = globalvar.title,
|
||||
copyright = globalvar.copyright,
|
||||
container = Template(params["mako"]["email"]['container']).render(
|
||||
verify = verification_url,
|
||||
notme = notme_url
|
||||
header = self.smtpconfig['subject'],
|
||||
verify = verification_url,
|
||||
notme = notme_url
|
||||
)
|
||||
)
|
||||
sendwave.smtp(self.smtpconfig)
|
||||
|
Loading…
Reference in New Issue
Block a user