Пример #1
0
def add_user(username=None):
    if username is None:
        username = raw_input('Username: '******'Password: '******'Success.'
    else:
        print 'Failure, try again.'
Пример #2
0
def add_user(username=None):
    if username is None:
        username = raw_input('Username: '******'Password: '******'Success.'
    else:
        print 'Failure, try again.'
Пример #3
0
def login():
    form = LoginForm()
    if form.validate_on_submit():
        username = form.username.data
        password = form.password.data
        if User.password_match(username, password):
            session['username'] = username
            session['logged_in'] = True
            return redirect(url_for('pastes.index'))
        else:
            flash('Incorrect username/password', 'error')

    return render_template('login.html', form=form)
Пример #4
0
def login():
    form = LoginForm()
    if form.validate_on_submit():
        username = form.username.data
        password = form.password.data
        if User.password_match(username, password):
            session['username'] = username
            session['logged_in'] = True
            return redirect(url_for('pastes.index'))
        else:
            flash('Incorrect username/password', 'error')

    return render_template('login.html', form=form)
Пример #5
0
 def add_account(self, name='admin', password='******'):
     User.new(name, password)
Пример #6
0
 def setUp(self):
     app.testing = True
     app.config['CSRF_ENABLED'] = False
     self.client = app.test_client()
     Paste.init_table()
     User.init_table()
Пример #7
0
 def add_account(self, name='admin', password='******'):
     User.new(name, password)
Пример #8
0
 def setUp(self):
     app.testing = True
     app.config['CSRF_ENABLED'] = False
     self.client = app.test_client()
     Paste.init_table()
     User.init_table()
Пример #9
0
        return None

app = Flask(__name__)
app.config.from_pyfile('config.py')
app.config['VERSION'] = get_version()

if app.config.get('SENTRY_DSN'):
    from raven.contrib.flask import Sentry
    sentry = Sentry(app)


from PyPaste.models.pastes import Paste
from PyPaste.models.users import User

Paste.init_table()
User.init_table()

from PyPaste.views.errors import errors
from PyPaste.views.pastes import pastes
from PyPaste.views.admin import admin
from PyPaste.views import api

app.register_blueprint(errors)
app.register_blueprint(pastes)
app.register_blueprint(admin)
app.register_blueprint(api.legacy)
app.register_blueprint(api.v1)


# This allows us to enforce the FORCE_SSL config option
# Any redirection should be done at the httpd level
Пример #10
0
        return None


app = Flask(__name__)
app.config.from_pyfile('config.py')
app.config['VERSION'] = get_version()

if app.config.get('SENTRY_DSN'):
    from raven.contrib.flask import Sentry
    sentry = Sentry(app)

from PyPaste.models.pastes import Paste
from PyPaste.models.users import User

Paste.init_table()
User.init_table()

from PyPaste.views.errors import errors
from PyPaste.views.pastes import pastes
from PyPaste.views.admin import admin
from PyPaste.views import api

app.register_blueprint(errors)
app.register_blueprint(pastes)
app.register_blueprint(admin)
app.register_blueprint(api.legacy)
app.register_blueprint(api.v1)

# This allows us to enforce the FORCE_SSL config option
# Any redirection should be done at the httpd level
from PyPaste.utils import pypaste_url_for