diff --git a/README.md b/README.md index 82eee6e..8a714a3 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ [![Node](https://img.shields.io/badge/node-6.x-green.svg?style=plastic)](https://nodejs.org/) [![Element](https://img.shields.io/badge/Element-2.x-green.svg?style=plastic)](http://element-cn.eleme.io/#/zh-CN/) -Spug is an open source O & M management system developed with Python + Flask + Element. The system is separated from the front and the back of the system to help small and medium-sized enterprises manage the hosts, tasks, deployment, configuration files, monitoring and alarming +Spug is an open source O & M management system developed with Python + Flask + Vue + Element. The system is separated from the front and the back of the system to help small and medium-sized enterprises manage the hosts, tasks, deployment, configuration files, monitoring and alarming -Spug是一款使用Python+Flask+Element组件开发的开源运维管理系统,系统前后端分离,帮助中小型企业完成主机、任务、发布部署、配置文件、监控、报警等管理。 +Spug是一款使用Python+Flask+Vue+Element组件开发的开源运维管理系统,系统前后端分离,帮助中小型企业完成主机、任务、发布部署、配置文件、监控、报警等管理。 #### Demo演示地址: @@ -50,7 +50,7 @@ $ -e MYSQL_DATABASE="spug" //指定数据库名称 -e REGISTRY_PASSWORD="hubpwd" //指定私有镜像仓库密码 ``` -更多Dockerfile [Dockerfile](https://github.com/openspug/spug/docs/Dockerfile) +更多Dockerfile [Dockerfile](https://github.com/openspug/spug/tree/master/docs/Dockerfile) ### 详细安装步骤 @@ -68,6 +68,7 @@ $ -e MYSQL_DATABASE="spug" //指定数据库名称   2. Start server 启动服务端: $ cd spug/spug_api $ pip install -r requirements.txt //安装依赖包 + $ mv config.py.example config.py //编辑配置文件 $ python manage.py init_db //初始化数据库 $ python manage.py create_admin //创建管理员   $ python main.py //启动服务 @@ -91,6 +92,9 @@ $ -e MYSQL_DATABASE="spug" //指定数据库名称 ---------------------------- * [Project structure 项目结构](https://github.com/openspug/spug/blob/master/docs/project_structure.md) + * [前端UI组件](http://element-cn.eleme.io/2.1/#/zh-CN/component/installation) + * [后端Flask文档](http://flask.pocoo.org/) + ### Contributor 贡献者 ---------------------------- diff --git a/docs/project_structure.md b/docs/project_structure.md index 436f3da..aa540be 100644 --- a/docs/project_structure.md +++ b/docs/project_structure.md @@ -75,10 +75,6 @@ │ │ ├── model.py // 系统公用类 │ │ ├── tool.py // 系统公用工具文件 │ │ ├── utils.py // -│ └── storage // 系统公用目录 -│ │ ├── exec_tmp // 执行目录 -│ │ ├── images // 镜像目录 -│ │ ├── publish_tmp // 发布目录 │ └── config.py.example // 后端配置文件模板 │ └── main.py // 后端入口文件,加载所有模块 │ └── manage.py // 系统管理文件 diff --git a/spug_api/apps/account/user.py b/spug_api/apps/account/user.py index 817ec27..5241c5c 100644 --- a/spug_api/apps/account/user.py +++ b/spug_api/apps/account/user.py @@ -64,7 +64,7 @@ def delete(u_id): @require_permission('account_user_edit | account_user_disable') def put(u_id): form, error = JsonParser('nickname', 'is_active', - Argument('role_id', type=int, help='请选择角色'), + Argument('role_id', type=int, required=False, help='请选择角色'), Argument('email', nullable=True), Argument('password', nullable=False, required=False), Argument('mobile', nullable=True)).parse() @@ -79,6 +79,27 @@ def put(u_id): return json_response(message=error) +@blueprint.route('/modifypwd', methods=['POST']) +def modify_pwd(): + form, error = JsonParser('password', 'newpassword').parse() + if error is None: + if g.user.verify_password(form.password): + g.user.password = form.newpassword + g.user.save() + return json_response() + else: + return json_response(message='原密码错误') + return json_response(message=error) + + +@blueprint.route('/', methods=['GET']) +def get_person(u_id): + if u_id: + u_info = User.query.get_or_404(u_id) + return json_response(u_info) + return json_response(message='user_id不能为空') + + @blueprint.route('/login/', methods=['POST']) def login(): form, error = JsonParser('username', 'password').parse() @@ -91,7 +112,9 @@ def login(): user.access_token = token user.token_expired = time.time() + 8 * 60 * 60 user.save() - return json_response({'token': token, 'is_supper': user.is_supper, 'permissions': list(user.permissions)}) + user_data = user.to_json() + user_data.update({'token': token, 'permissions': list(user.permissions)}) + return json_response(user_data) else: login_limit[form.username] += 1 if login_limit[form.username] >= 3: diff --git a/spug_api/storage/exec_tmp/.gitignore b/spug_api/storage/exec_tmp/.gitignore deleted file mode 100644 index 600a000..0000000 --- a/spug_api/storage/exec_tmp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Ignore everything in this directory -* -!.gitignore \ No newline at end of file diff --git a/spug_api/storage/images/.gitignore b/spug_api/storage/images/.gitignore deleted file mode 100644 index 600a000..0000000 --- a/spug_api/storage/images/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Ignore everything in this directory -* -!.gitignore \ No newline at end of file diff --git a/spug_api/storage/publish_tmp/.gitignore b/spug_api/storage/publish_tmp/.gitignore deleted file mode 100644 index 600a000..0000000 --- a/spug_api/storage/publish_tmp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Ignore everything in this directory -* -!.gitignore \ No newline at end of file diff --git a/spug_web/src/components/Layout.vue b/spug_web/src/components/Layout.vue index 1b2fac7..0fc3fbd 100644 --- a/spug_web/src/components/Layout.vue +++ b/spug_web/src/components/Layout.vue @@ -7,7 +7,7 @@ -