mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Create and use a decorator for background functions
This commit is contained in:
		@@ -5,7 +5,7 @@ from . import auth
 | 
			
		||||
from .forms import (LoginForm, ResetPasswordForm, ResetPasswordRequestForm,
 | 
			
		||||
                    RegistrationForm)
 | 
			
		||||
from .. import db
 | 
			
		||||
from ..email import create_message, send_async
 | 
			
		||||
from ..email import create_message, send
 | 
			
		||||
from ..models import User
 | 
			
		||||
import os
 | 
			
		||||
import shutil
 | 
			
		||||
@@ -70,7 +70,7 @@ def register():
 | 
			
		||||
        token = user.generate_confirmation_token()
 | 
			
		||||
        msg = create_message(user.email, 'Confirm Your Account',
 | 
			
		||||
                             'auth/email/confirm', token=token, user=user)
 | 
			
		||||
        send_async(msg)
 | 
			
		||||
        send(msg)
 | 
			
		||||
        flash('A confirmation email has been sent to you by email.')
 | 
			
		||||
        return redirect(url_for('auth.login'))
 | 
			
		||||
    return render_template('auth/register.html.j2',
 | 
			
		||||
@@ -107,7 +107,7 @@ def resend_confirmation():
 | 
			
		||||
    token = current_user.generate_confirmation_token()
 | 
			
		||||
    msg = create_message(current_user.email, 'Confirm Your Account',
 | 
			
		||||
                         'auth/email/confirm', token=token, user=current_user)
 | 
			
		||||
    send_async(msg)
 | 
			
		||||
    send(msg)
 | 
			
		||||
    flash('A new confirmation email has been sent to you by email.')
 | 
			
		||||
    return redirect(url_for('auth.unconfirmed'))
 | 
			
		||||
 | 
			
		||||
@@ -126,7 +126,7 @@ def reset_password_request():
 | 
			
		||||
            msg = create_message(user.email, 'Reset Your Password',
 | 
			
		||||
                                 'auth/email/reset_password', token=token,
 | 
			
		||||
                                 user=user)
 | 
			
		||||
            send_async(msg)
 | 
			
		||||
            send(msg)
 | 
			
		||||
        flash('An email with instructions to reset your password has been '
 | 
			
		||||
              'sent to you.')
 | 
			
		||||
        return redirect(url_for('auth.login'))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user