Skip to content

Commit

Permalink
登录和注册界面编写,简单框架搭建
Browse files Browse the repository at this point in the history
  • Loading branch information
Cl0udG0d committed Mar 30, 2020
1 parent a5103ab commit c120708
Show file tree
Hide file tree
Showing 1,264 changed files with 177,752 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .idea/WebScan.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 78 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added __pycache__/config.cpython-37.pyc
Binary file not shown.
20 changes: 20 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os

'''
配置文件:
debug=true
secret_key,session中的24位随机盐值
MySQL数据库配置
数据库名为scan_test_demo
python3:https://blog.csdn.net/qq562029186/article/details/81325074
'''
DEBUG=True
SECRET_KEY=os.urandom(24)

HOSTNAME='127.0.0.1'
PORT='3306'
DATABASE='scan_test_demo'
USERNAME='root'
PASSWORD='root'
#SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:[email protected]/tushare?charset=utf8'
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8'.format(USERNAME,PASSWORD,HOSTNAME,PORT,DATABASE)
5 changes: 5 additions & 0 deletions exts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from flask_sqlalchemy import SQLAlchemy

#专门存放db,防止循环引用问题的出现

db=SQLAlchemy()
25 changes: 25 additions & 0 deletions index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from flask import Flask,render_template,request
import config

app=Flask(__name__)
app.config.from_object(config)

@app.route('/')
def index():
return render_template('index.html')

@app.route('/login/', methods=['GET', 'POST'])
def login():
if request.method == 'GET':
return render_template('login.html')
else:
return "登录界面"

@app.route('/regist/',methods=['GET','POST'])
def regist():
if request.method=='GET':
return render_template('regist.html')
else:
return "注册界面"
if __name__=='__main__':
app.run()
18 changes: 18 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from flask_script import Manager
from flask_migrate import MigrateCommand,Migrate
from index import app
from exts import db


# 存放命令脚本

manager=Manager(app)

#使用Migrate绑定app和db
migrate=Migrate(app,db)

#添加迁移脚本的命令到manager中
manager.add_command('db',MigrateCommand)

if __name__=='__main__':
manager.run()
7 changes: 7 additions & 0 deletions models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from exts import db

'''
存放所有的模型
1,admin登录用户模型
2,bug漏洞模型
'''
23 changes: 23 additions & 0 deletions static/css/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
*{
margin:0;
padding:0;
}
.container-fluid{
position:relative
}
.logo{
z-index:1;
position:absolute;
margin-top:10;
width: 50px;
}
body{
background: #f3f3f3;
}
.main{
background:#fff;
width:730px;
margin: 0 auto;
overflow: hidden;
padding: 10px;
}
13 changes: 13 additions & 0 deletions static/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*{
margin:0;
padding:0;
}
.container-fluid{
position:relative
}
.logo{
z-index:1;
position:absolute;
margin-top:10;
width: 50px;
}
7 changes: 7 additions & 0 deletions static/css/login_regist.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.form-container{
width: 300px;
margin: 0 auto;
}
.page-tiitle{
text-align:center;
}
Binary file added static/images/base.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/base2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added static/js/login.js
Empty file.
54 changes: 54 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{%block title%}{% endblock %}-WebScan漏洞扫描器</title>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="{{url_for('static',filename='css/base.css')}}">
{% block head %}{% endblock %}
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
<img class="logo" src="{{url_for('static',filename='images/logo.png')}}" style="width:50px;height:50px;top:-2px">
</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active" style="margin-left:50px;"><a href="#">漏洞列表 <span class="sr-only">(current)</span></a></li>
<li><a href="#">控制台</a></li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="请输入关键字">
</div>
<button type="submit" class="btn btn-default">搜索</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="{{url_for('login')}}">登录</a></li>
<li><a href="{{url_for('regist')}}">注册</a></li>

</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div class="main">
{%block main%}{% endblock %}
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends 'base.html' %}

{%block title%}首页{% endblock %}

{%block main%}
<h1>这是首页</h1>
{% endblock %}
29 changes: 29 additions & 0 deletions templates/login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% extends 'base.html' %}

{%block title%}登录{% endblock %}
{% block head %}
<link rel="stylesheet" href="{{url_for('static',filename='css/login_regist.css')}}">
{% endblock %}
{%block main%}
<h3 class="page-tiitle">登录</h3>
<div class="form-container">
<form action="" method="POST">
<div class="form-container">
<div class="form-group">
<input type="text" class="form-control" placeholder="用户名">
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="密码">
</div>
<div class="checkbox">
<label>
<input type="checkbox"> 记住我
</label>
</div>
<div class="form-group">
<button class="btn btn-primary btn-block">登录</button>
</div>
</div>
</form>
</div>
{% endblock %}
30 changes: 30 additions & 0 deletions templates/regist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% extends 'base.html' %}

{%block title%}注册{% endblock %}
{% block head %}
<link rel="stylesheet" href="{{url_for('static',filename='css/login_regist.css')}}">
{% endblock %}
{%block main%}
<h3 class="page-tiitle">注册</h3>
<div class="form-container">
<form action="" method="POST">
<div class="form-container">
<div class="form-group">
<input type="text" class="form-control" placeholder="邮箱" name="email">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="用户名" name="username">
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="密码" name="password1">
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="确认密码" name="password2">
</div>
<div class="form-group">
<button class="btn btn-primary btn-block">注册</button>
</div>
</div>
</form>
</div>
{% endblock %}
Loading

0 comments on commit c120708

Please sign in to comment.