Commit 9e29cb65 authored by markus's avatar markus

Merge branch 'hotfix/v2.0.1_RC3'

parents 5b2337b4 e5aefbc6
......@@ -35,5 +35,13 @@ SELF_REG_VALIDATION_ENDPOINT = 'http://' + 'localhost:4200' + '/setpassword'
SELF_REG_DEFAULT_ROLES = ['standarduser']
SELF_REG_MAIL_FROM_ADDRESS = 'test@didimos.de'
SELF_REG_MAIL_SUBJECT = 'TESTSUBJECT'
SELF_REG_MAIL_BODY_HEADER = 'Header'
SELF_REG_MAIL_BODY_FOOTER = 'Footer'
# Import credentials
from .credentials import *
......@@ -49,3 +49,21 @@ SELF_REG_VALIDATION_ENDPOINT = @SELF_REG_VALIDATION_ENDPOINT@ #'http://' + 'loc
SELF_REG_VALIDATION_IS_ACTIV = 480
SELF_REG_DEFAULT_ROLES = ['standarduser']
# Settings for Mail
SELF_REG_MAIL_FROM_ADDRESS = @SELF_REG_MAIL_FROM_ADDRESS@
SELF_REG_MAIL_SUBJECT = @SELF_REG_MAIL_SUBJECT@
SELF_REG_MAIL_BODY_HEADER = @SELF_REG_MAIL_BODY_HEADER@
SELF_REG_MAIL_BODY_FOOTER = @SELF_REG_MAIL_BODY_FOOTER@
EMAIL_PASSWORD_RESET_FROM_ADDRESS = @EMAIL_PASSWORD_RESET_FROM_ADDRESS@
EMAIL_PASSWORD_RESET_SUBJECT = @EMAIL_PASSWORD_RESET_SUBJECT@
EMAIL_PASSWORD_RESET_BODY_HEADER = @EMAIL_PASSWORD_RESET_BODY_HEADER@
EMAIL_PASSWORD_RESET_BODY_FOOTER = @EMAIL_PASSWORD_RESET_BODY_FOOTER@
\ No newline at end of file
......@@ -3,6 +3,7 @@ import ldap_app.settings as settings
from datetime import datetime, timedelta
import json
from email.message import EmailMessage
from email.headerregistry import Address
import random
import smtplib
import string
......@@ -97,11 +98,18 @@ class Custom_Selfregrequest(AddRequest):
def send_registration_mail(self):
message = EmailMessage()
message.set_content(getattr(settings, 'SELF_REG_VALIDATION_ENDPOINT')+ '/' + self.reg_password_token + '\n'
'Username:' + self.generated_login)
message['Subject'] = 'Selfregistration for didmos 2'
message['From'] = getattr(settings, 'EMAIL_LOGIN')
message_string = getattr(settings, 'SELF_REG_MAIL_BODY_HEADER')
message_string += '\r\n'
message_string += r'Vist the following URL to set your password: ' + getattr(settings, 'SELF_REG_VALIDATION_ENDPOINT')+ '/' + self.reg_password_token
message_string += '\r\n'
message_string += 'Your login username is: ' + self.generated_login
message_string += '\r\n'
message_string += getattr(settings, 'SELF_REG_MAIL_BODY_FOOTER')
message.set_content(message_string)
message['Subject'] = getattr(settings, 'SELF_REG_MAIL_SUBJECT')
message['From'] = getattr(settings, 'SELF_REG_MAIL_FROM_ADDRESS')
message['To'] = self.mail
server = smtplib.SMTP(getattr(settings, 'EMAIL_SMTP_SERVER'))
server.starttls()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment