summaryrefslogtreecommitdiffstats
path: root/accounts/views/default/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/views/default/__init__.py')
-rw-r--r--accounts/views/default/__init__.py34
1 files changed, 9 insertions, 25 deletions
diff --git a/accounts/views/default/__init__.py b/accounts/views/default/__init__.py
index 0a7e65d..eec173e 100644
--- a/accounts/views/default/__init__.py
+++ b/accounts/views/default/__init__.py
@@ -23,7 +23,8 @@ bp = Blueprint('default', __name__)
def register():
form = RegisterForm(request.form)
if form.validate_on_submit():
- send_register_confirmation_mail(form.username.data, form.mail.data)
+ current_app.mail_backend.send(form.mail.data, 'mail/register.txt',
+ username=form.username.data)
flash(u'Es wurde eine E-Mail an die angegebene Adresse geschickt, '
u'um diese zu überprüfen. Bitte folge den Anweisungen in der '
@@ -58,14 +59,10 @@ def register_complete(token):
current_app.user_backend.register(user)
login_user(user)
- if current_app.config.get('MAIL_REGISTER_NOTIFY'):
- current_app.mail_backend.send(
- current_app.config['MAIL_REGISTER_NOTIFY'],
- u'[accounts] Neuer Benutzer %s erstellt' % username,
- u'Benutzername: %s\nE-Mail: %s\n\nSpammer? Deaktivieren: '
- u'%s\n' % (username, mail,
- url_for('admin.disable_account', uid=username, _external=True))
- )
+ current_app.mail_backend.send(
+ current_app.config['MAIL_REGISTER_NOTIFY'],
+ 'mail/register_notify.txt',
+ username=username, mail=mail)
flash(u'Benutzer erfolgreich angelegt.', 'success')
return redirect(url_for('.index'))
@@ -86,15 +83,8 @@ def lost_password():
if form.validate_on_submit():
#TODO: make the link only usable once (e.g include a hash of the old pw)
# atm the only thing we do is make the link valid for only little time
- confirm_token = Confirmation('lost_password').dumps(form.user.uid)
- confirm_link = url_for('.lost_password_complete', token=confirm_token, _external=True)
-
- body = render_template('mail/lost_password.txt', username=form.user.uid,
- link=confirm_link)
-
current_app.mail_backend.send(
- form.user.attributes['mail'], u'Passwort vergessen', body,
- sender=current_app.config.get('MAIL_CONFIRM_SENDER'))
+ form.user.mail, 'mail/lost_password.txt', username=form.user.uid)
flash(u'Wir haben dir eine E-Mail mit einem Link zum Passwort ändern '
u'geschickt. Bitte folge den Anweisungen in der E-Mail.', 'success')
@@ -144,15 +134,9 @@ def index():
elif request.form.get('submit_main'):
if form.mail.data and form.mail.data != current_user.mail:
- confirm_token = Confirmation('change_mail').dumps((current_user.uid, form.mail.data))
- confirm_link = url_for('.change_mail', token=confirm_token, _external=True)
-
- body = render_template('mail/change_mail.txt', username=current_user.uid,
- mail=form.mail.data, link=confirm_link)
-
current_app.mail_backend.send(
- form.mail.data, u'E-Mail-Adresse bestätigen', body,
- sender=current_app.config.get('MAIL_CONFIRM_SENDER'))
+ form.mail.data, 'mail/change_mail.txt',
+ username=current_user.uid)
flash(u'Es wurde eine E-Mail an die angegebene Adresse geschickt, '
u'um diese zu überprüfen. Bitte folge den Anweisungen in der '