Exemple #1
0
 def register(self, data):
     if data['project_code'] == PROJECT_CODE:
         msg = UserModelDao.add_user(data['user_name'], data['user_pwd'])
     else:
         msg = 'project_code is wrong'
     print(msg)
     ServerDao.publish_register_msg(self.client, data['user_name'], msg)
Exemple #2
0
def register():
    """
    用户注册功能
    :return:
    """
    global register_email_code
    data = request.json  # 获取表单数据
    name = data["user_name"]
    pwd = data["password"]
    # check_pwd = data["check_password"]
    email = data["email"]
    user_email_code = data["email_code"]

    if name and pwd and email and user_email_code:  # and check_pwd:
        if not re.search(u'^[_a-zA-Z0-9\u4e00-\u9fa5]+$', name):
            # 用户名格式出错
            response_data = response[20302]
        elif UserModelDao.query_user(1, user_name=name):
            # 用户名已存在
            response_data = response[20301]
        elif len(pwd) < 6:
            # 密码长度太短
            response_data = response[20303]
        # elif check_pwd != pwd:
        # 两次密码输入不一致
        # response_data = response[20304]
        elif user_email_code != register_email_code:
            # 邮箱验证码错误
            response_data = response[20305]
        else:
            # 插入新用户
            UserModelDao.add_user(name, pwd, email)
            response_data = response[200]
    else:
        # 缺少参数
        response_data = response[20101]

    return json.dumps(response_data, ensure_ascii=False)
Exemple #3
0
import os
import csv
import pathlib
import time
import requests
from lxml import etree

create_all_table()

# 用户
GroupModelDao.add_group('普通用户')
GroupModelDao.add_group('管理员')
GroupModelDao.add_group('超级管理员')

# 添加一个超级用户
UserModelDao.add_user('SuperVisitor', 'veg_root#2019', '*****@*****.**')
UserModelDao.set_group_id('SuperVisitor', 3)

# 模型信息
PredictModelModelDao.add_model('bp', 'bp神经网络')
PredictModelModelDao.add_model('lstm', 'lstm神经网络')
PredictModelModelDao.add_model('arima', 'arima时间序列')

# 用户权限表
GroupPowerModelDao.add_one_power(1, '/user/register')
GroupPowerModelDao.add_one_power(1, '/user/login')
GroupPowerModelDao.add_one_power(1, '/user/alter_pwd')
GroupPowerModelDao.add_one_power(1, '/user/register/send_email')
GroupPowerModelDao.add_one_power(1, '/user/vegetable/k_line')
GroupPowerModelDao.add_one_power(1, '/user/alter_pwd/send_email')
GroupPowerModelDao.add_one_power(1, '/user/vegetable/information')