Exemple #1
0
def apikey_list(user):
    form = new_apikey_form(request.form)
    if request.method == "POST" and form.validate():
        apikey = ApiKey(application=form.application.data, description=form.description.data, user=current_user)
        apikey.gen_key()
        rfk.database.session.add(apikey)
        rfk.database.session.commit()
        form.application.data = ""
        form.description.data = ""
        flash(gettext("Successfully added new apikey"), "success")
    apikeys = ApiKey.query.filter(ApiKey.user == current_user).all()
    return render_template("user/apikeys.html", apikeys=apikeys, form=form)
Exemple #2
0
def apikey_list(user):
    form = new_apikey_form(request.form)
    if request.method == 'POST' and form.validate():
        apikey = ApiKey(application=form.application.data,
                        description=form.description.data,
                        user=current_user)
        apikey.gen_key()
        rfk.database.session.add(apikey)
        rfk.database.session.commit()
        form.application.data = ''
        form.description.data = ''
        flash(lazy_gettext('Added Apikey'))
    apikeys = ApiKey.query.filter(ApiKey.user == current_user).all()
    return render_template('user/apikeys.html', apikeys=apikeys, form=form)
Exemple #3
0
    def setUp(self):
        rfk.init()
        rfk.database.init_db("sqlite://")

        app.template_folder = '../templates/'
        app.static_folder = '../static/'
        app.static_url_path = '/static'
        self.app = app.test_client()

        user_1 = User.add_user('teddydestodes', 'roflmaoblubb')
        user_2 = User.add_user('loom', 'bestes')

        key_1 = ApiKey(application='app_1', description='key_1', user=user_1)
        key_1.gen_key()
        self.key_1 = key_1.key
        key_2 = ApiKey(application='app_2', description='key_2', user=user_2, flag=ApiKey.FLAGS.DISABLED)
        key_2.gen_key()
        self.key_2 = key_2.key
        rfk.database.session.add(key_1, key_2)

        rfk.database.session.commit()
Exemple #4
0
    def setUp(self):
        rfk.init()
        rfk.database.init_db("sqlite://")

        app.template_folder = '../templates/'
        app.static_folder = '../static/'
        app.static_url_path = '/static'
        self.app = app.test_client()

        user_1 = User.add_user('teddydestodes', 'roflmaoblubb')
        user_2 = User.add_user('loom', 'bestes')

        key_1 = ApiKey(application='app_1', description='key_1', user=user_1)
        key_1.gen_key()
        self.key_1 = key_1.key
        key_2 = ApiKey(application='app_2', description='key_2', user=user_2, flag=ApiKey.FLAGS.DISABLED)
        key_2.gen_key()
        self.key_2 = key_2.key
        rfk.database.session.add(key_1, key_2)

        rfk.database.session.commit()