Esempio n. 1
0
def reg():
    if request.method == "POST":
        data = {k: v[0] for k, v in dict(request.form).items()}
        field = ['username', 'password', 'role']
        reg_user = utils.user_name(table, field, data['username'])
        if reg_user:
            msg = {'code': 1, 'errmsg': 'user is already'}
            return render_template('reg.html', msg=msg)
        else:
            utils.insert(table, field, data)
            return redirect('/login/')
    msg = {}
    return render_template('reg.html', msg=msg)
Esempio n. 2
0
def login():
    if request.method == "POST":
        data = {k: v[0] for k, v in dict(request.form).items()}
        print data
        login_user = utils.user_name(table, field, data['username'])
        if data['username'] == login_user[1] and data['passwd'] == login_user[
                2]:
            res = dict(zip(field, login_user))
            userlist = utils.user_list(table, field)
            msg = {'code': 0, 'sucmsg': 'login success'}
            return render_template('info.html',
                                   msg=msg,
                                   user=res,
                                   userlist=userlist)
        else:
            msg = {'code': 1, 'errmsg': 'user or passwd is wrong'}
            return render_template('login.html', msg=msg)
    msg = {}
    return render_template('login.html', msg=msg)
Esempio n. 3
0
import time
import tempfile
from tqdm import tqdm
import shutil
import sys

sys.path.append(str(pathlib.Path(__file__).resolve().parents[2] / 'lib'))
from cluster import apply_config_changes, apply_genesis_changes
from utils import user_name

try:
    image_name = sys.argv[1]
except:
    branch = run(
        'git rev-parse --symbolic-full-name --abbrev-ref HEAD').stdout.strip()
    username = user_name()
    image_name = f'near-{branch}-{datetime.datetime.strftime(datetime.datetime.now(),"%Y%m%d")}-{username}'

try:
    machine_name_prefix = sys.argv[2]
except:
    machine_name_prefix = f'pytest-node-{username}-'

genesis_time = (datetime.datetime.utcnow() -
                datetime.timedelta(hours=2)).isoformat() + 'Z'

# binary search this to observe if network forks, default is 1
block_production_time = 1

client_config_changes = {
    "consensus": {
Esempio n. 4
0
def callback_chai(call):
    action_log(user_name(call.message.chat) + " called: " + call.data)
    current_controller.set_school_callback(call)