Пример #1
0
    def redirect_to_signup(token=None):
        # If this is an ajax request, redirect doesn't help so just return a 401 with a json packet
        if request and request.is_xhr:
            data = {'status': -1, 'msg': 'Login required for Ajax call'}
            return jsonify(data), 401

        # MD Jul-2015 OL-1356 On the first time the mobile app starts up, send them to the mobile create_account page
        # so they can signup for OhmConnect. After that, send to the normal login page.
        if checkMobile(request) == 'mobile/' and not request.cookies.get(
                'ohm_track_key'):
            return redirect_with_args('signup')
        else:
            page = 'login' if token else 'signup'  # if they look like they had a token send them to login
            if config().oem_equals('scp'):
                return redirect_with_args('login')
            elif 'shop' in request.path or 'store' in request.path:
                return redirect_with_args(page, store=True)
            else:
                return redirect_with_args(page)
Пример #2
0
def set(env):
    global environment
    environment = env

    from ohm_lib.config import config
    config(reset=True)
Пример #3
0
def getConnection(db):
    dbkey = db + '-db'
    if not dbkey in config():
        raise DatabaseNotFoundError(
            "Can't find database config for instance %s" % (db))
    return config()[dbkey]
Пример #4
0
def jinja_functions():

    return dict(config=config(), environment=environment, oem='ohm')