mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	rename blueprint variables (blueprint_name -> bp) and view files (views.py -> routes.py)
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
from flask import Blueprint
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
auth = Blueprint('auth', __name__)
 | 
			
		||||
from . import views
 | 
			
		||||
bp = Blueprint('auth', __name__)
 | 
			
		||||
from . import routes
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
from datetime import datetime
 | 
			
		||||
from flask import abort, flash, redirect, render_template, request, url_for
 | 
			
		||||
from flask_login import current_user, login_user, login_required, logout_user
 | 
			
		||||
from . import auth
 | 
			
		||||
from . import bp
 | 
			
		||||
from .forms import (LoginForm, ResetPasswordForm, ResetPasswordRequestForm,
 | 
			
		||||
                    RegistrationForm)
 | 
			
		||||
from .. import db
 | 
			
		||||
@@ -11,7 +11,7 @@ import logging
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@auth.before_app_request
 | 
			
		||||
@bp.before_app_request
 | 
			
		||||
def before_request():
 | 
			
		||||
    """
 | 
			
		||||
    Checks if a user is unconfirmed when visiting specific sites. Redirects to
 | 
			
		||||
@@ -27,7 +27,7 @@ def before_request():
 | 
			
		||||
            return redirect(url_for('auth.unconfirmed'))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@auth.route('/login', methods=['GET', 'POST'])
 | 
			
		||||
@bp.route('/login', methods=['GET', 'POST'])
 | 
			
		||||
def login():
 | 
			
		||||
    if current_user.is_authenticated:
 | 
			
		||||
        return redirect(url_for('main.dashboard'))
 | 
			
		||||
@@ -46,7 +46,7 @@ def login():
 | 
			
		||||
    return render_template('auth/login.html.j2', form=form, title='Log in')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@auth.route('/logout')
 | 
			
		||||
@bp.route('/logout')
 | 
			
		||||
@login_required
 | 
			
		||||
def logout():
 | 
			
		||||
    logout_user()
 | 
			
		||||
@@ -54,7 +54,7 @@ def logout():
 | 
			
		||||
    return redirect(url_for('main.index'))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@auth.route('/register', methods=['GET', 'POST'])
 | 
			
		||||
@bp.route('/register', methods=['GET', 'POST'])
 | 
			
		||||
def register():
 | 
			
		||||
    if current_user.is_authenticated:
 | 
			
		||||
        return redirect(url_for('main.dashboard'))
 | 
			
		||||
@@ -83,7 +83,7 @@ def register():
 | 
			
		||||
                           title='Register')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@auth.route('/confirm/<token>')
 | 
			
		||||
@bp.route('/confirm/<token>')
 | 
			
		||||
@login_required
 | 
			
		||||
def confirm(token):
 | 
			
		||||
    if current_user.confirmed:
 | 
			
		||||
@@ -97,7 +97,7 @@ def confirm(token):
 | 
			
		||||
        return redirect(url_for('.unconfirmed'))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@auth.route('/unconfirmed')
 | 
			
		||||
@bp.route('/unconfirmed')
 | 
			
		||||
def unconfirmed():
 | 
			
		||||
    if current_user.is_anonymous:
 | 
			
		||||
        return redirect(url_for('main.index'))
 | 
			
		||||
@@ -106,7 +106,7 @@ def unconfirmed():
 | 
			
		||||
    return render_template('auth/unconfirmed.html.j2', title='Unconfirmed')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@auth.route('/confirm')
 | 
			
		||||
@bp.route('/confirm')
 | 
			
		||||
@login_required
 | 
			
		||||
def resend_confirmation():
 | 
			
		||||
    token = current_user.generate_confirmation_token()
 | 
			
		||||
@@ -117,7 +117,7 @@ def resend_confirmation():
 | 
			
		||||
    return redirect(url_for('auth.unconfirmed'))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@auth.route('/reset', methods=['GET', 'POST'])
 | 
			
		||||
@bp.route('/reset', methods=['GET', 'POST'])
 | 
			
		||||
def reset_password_request():
 | 
			
		||||
    if current_user.is_authenticated:
 | 
			
		||||
        return redirect(url_for('main.dashboard'))
 | 
			
		||||
@@ -136,7 +136,7 @@ def reset_password_request():
 | 
			
		||||
                           title='Password Reset')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@auth.route('/reset/<token>', methods=['GET', 'POST'])
 | 
			
		||||
@bp.route('/reset/<token>', methods=['GET', 'POST'])
 | 
			
		||||
def reset_password(token):
 | 
			
		||||
    if current_user.is_authenticated:
 | 
			
		||||
        return redirect(url_for('main.dashboard'))
 | 
			
		||||
		Reference in New Issue
	
	Block a user