示例#1
0
def generate_app():
    app = flask.Flask(__name__)

    app.config['BROWSERID_LOGIN_URL'] = "/login"
    app.config['BROWSERID_LOGOUT_URL'] = "/logout"
    app.config['SECRET_KEY'] = "deterministic"
    app.config['TESTING'] = True

    login_manager = LoginManager()
    login_manager.user_loader(get_user_by_id)
    login_manager.init_app(app)

    browserid = BrowserID()
    browserid.user_loader(get_user)
    browserid.init_app(app)

    app.route('/')(index)

    return app
示例#2
0
    def _generate_app(self):
        app = Flask(__name__)
        app.config['PROPAGATE_EXCEPTIONS'] = True
        app.config['SQLALCHEMY_DATABASE_URI'] = 'postgres:///ealgis'
        app.config['BROWSERID_LOGIN_URL'] = "/api/0.1/login"
        app.config['BROWSERID_LOGOUT_URL'] = "/api/0.1/logout"
	with open('/etc/ealgis/secret_key') as secret_fd:
	    secret_key = secret_fd.read().rstrip()
        app.config['SECRET_KEY'] = secret_key
        app.config['TESTING'] = True

        login_manager = LoginManager()
        login_manager.user_loader(self.get_user_by_id)
        login_manager.init_app(app)

        browserid = BrowserID()
        browserid.user_loader(self.browserid_get_user)
        browserid.init_app(app)

        return app
示例#3
0
文件: db.py 项目: keithamoss/ealgis
    def _generate_app(self):
        app = Flask(__name__)
        app.wsgi_app = ReverseProxied(app.wsgi_app)
        app.config['PROPAGATE_EXCEPTIONS'] = True
        app.config['SQLALCHEMY_DATABASE_URI'] = self._connection_string()
        app.config['BROWSERID_LOGIN_URL'] = "/api/0.1/login"
        app.config['BROWSERID_LOGOUT_URL'] = "/api/0.1/logout"

        with open('/data/secret_key') as secret_fd:
            secret_key = secret_fd.read().rstrip()
        app.config['SECRET_KEY'] = secret_key
        # Warning: this *disables* authentication on the API
        # app.config['TESTING'] = True

        login_manager = LoginManager()
        login_manager.user_loader(self.get_user_by_id)
        login_manager.init_app(app)

        browserid = BrowserID()
        browserid.user_loader(self.browserid_get_user)
        browserid.init_app(app)

        return app
示例#4
0
def generate_app():
    app = flask.Flask(__name__)

    app.config['BROWSERID_LOGIN_URL'] = "/login"
    app.config['BROWSERID_LOGOUT_URL'] = "/logout"
    app.config['SECRET_KEY'] = "deterministic"
    app.config['TESTING'] = True

    login_manager = LoginManager()
    login_manager.user_loader(get_user_by_id)
    login_manager.init_app(app)

    browserid = BrowserID()
    browserid.user_loader(get_user)
    browserid.init_app(app)

    app.route('/')(index)

    return app
示例#5
0
    def _generate_app(self):
        app = Flask(__name__)
        app.wsgi_app = ReverseProxied(app.wsgi_app)
        app.config['PROPAGATE_EXCEPTIONS'] = True
        app.config['SQLALCHEMY_DATABASE_URI'] = self._connection_string()
        app.config['BROWSERID_LOGIN_URL'] = "/api/0.1/login"
        app.config['BROWSERID_LOGOUT_URL'] = "/api/0.1/logout"

        with open('/data/secret_key') as secret_fd:
            secret_key = secret_fd.read().rstrip()
        app.config['SECRET_KEY'] = secret_key
        # Warning: this *disables* authentication on the API
        # app.config['TESTING'] = True

        login_manager = LoginManager()
        login_manager.user_loader(self.get_user_by_id)
        login_manager.init_app(app)

        browserid = BrowserID()
        browserid.user_loader(self.browserid_get_user)
        browserid.init_app(app)

        return app
示例#6
0
import helpers
import csv_export
from datetime import date, datetime, timedelta
from filters import *
import re
from db_helpers import get_count, get_obj
from sqlalchemy import func, not_, and_, or_
import pytz

# Initialize login

login_manager = LoginManager()
login_manager.user_loader(get_user_by_id)
login_manager.init_app(app)

browser_id = BrowserID()
browser_id.user_loader(get_user)
browser_id.init_app(app)

@app.route("/login", methods = ["GET", "POST"])
def login(email=None, password=None):
	if request.method == 'POST':
		email = request.form['email']
		password = request.form['password']
		user_to_login = authenticate_login(email, password)
		if user_to_login:
			login_user(user_to_login)
			redirect_url = get_redirect_target()
			if 'temporary_login' in redirect_url: # Redirect to update password
				return render_template('update_password.html', user_id = get_user_id())
			if 'login' in redirect_url or 'logout' in redirect_url:
示例#7
0
import helpers
import csv_export
from datetime import date, datetime, timedelta
from filters import *
import re
from db_helpers import get_count, get_obj
from sqlalchemy import func, not_, and_, or_
import pytz

# Initialize login

login_manager = LoginManager()
login_manager.user_loader(get_user_by_id)
login_manager.init_app(app)

browser_id = BrowserID()
browser_id.user_loader(get_user)
browser_id.init_app(app)


@app.route("/login", methods=["GET", "POST"])
def login(email=None, password=None):
    if request.method == 'POST':
        email = request.form['email']
        password = request.form['password']
        user_to_login = authenticate_login(email, password)
        if user_to_login:
            login_user(user_to_login)
            redirect_url = get_redirect_target()
            if 'temporary_login' in redirect_url:  # Redirect to update password
                return render_template('update_password.html',