initial commit
This commit is contained in:
64
templates/admin.html
Normal file
64
templates/admin.html
Normal file
@@ -0,0 +1,64 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block page_title %}Admin Dashboard{% endblock %}
|
||||
{% block body %}
|
||||
{{ super() }}
|
||||
|
||||
{% if id_is_duplicated %}
|
||||
<div class="text-danger">
|
||||
<strong>Warning!</strong> The account name already exists.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class = "container">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-6">
|
||||
<h3>Add Account</h3>
|
||||
|
||||
<form class="form-inline" action="/add_user" method='post'>
|
||||
<div class="form-group">
|
||||
<label for="id">ID</label>
|
||||
<input type="text" class="form-control" name="id">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pw">Password</label>
|
||||
<input type="password" class="form-control" name="pw">
|
||||
</div>
|
||||
<br><br>
|
||||
<button type="submit" class="btn">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<h3>Manage Existing Accounts</h3>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>ID</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for number, id, act in users %}
|
||||
<tr>
|
||||
<th> {{ number }} </th>
|
||||
<td> {{ id }} </td>
|
||||
<td><a href={{act}}>Delete</a></td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
8
templates/index.html
Normal file
8
templates/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block page_title %}Welcome to Flask Example{% endblock %}
|
||||
{% block body %}
|
||||
{{ super() }}
|
||||
|
||||
<p>In this example, we cover concepts including: </p>
|
||||
<p>template (inheritance), URL building, redirecting, error handeling, session management (authentication), etc.</p>
|
||||
{% endblock %}
|
||||
63
templates/layout.html
Normal file
63
templates/layout.html
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
<html>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
|
||||
<title>Flask Example</title>
|
||||
<nav class="navbar navbar-inverse">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="/">Flask Example</a>
|
||||
</div>
|
||||
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/public/">Public</a></li>
|
||||
<li><a href="/private/">Private</a></li>
|
||||
<li><a href="/admin">Admin Dashboard</a></li>
|
||||
</ul>
|
||||
|
||||
{% if session.get("current_user", None) == None %}
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<form action="/login" method="post" class="navbar-form navbar-right">
|
||||
<div class="form-group">
|
||||
<input type="text" name="id" placeholder="User Name" class="form-control">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" name="pw" placeholder="Password" class="form-control">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success">Log In</button>
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="/logout" class="navbar-form navbar-right"> Logout </a>
|
||||
<a class="navbar-form navbar-right">{{ session.get("current_user") }}</a>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
<h1>{% block page_title %}{% endblock %}</h1>
|
||||
|
||||
<p>{% block body %}{% endblock %}</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class='container'>
|
||||
<hr>
|
||||
<a href="http://flask.pocoo.org/"><img
|
||||
src="{{ url_for('static', filename='img/flask-powered.png') }}"
|
||||
border="0"
|
||||
alt="Flask powered"
|
||||
title="Flask powered"></a>
|
||||
|
||||
Developed by <a href='https://github.com/XD-DENG'>XD-DENG</a>
|
||||
</div>
|
||||
|
||||
|
||||
</html>
|
||||
6
templates/page_401.html
Normal file
6
templates/page_401.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block page_title %}Unauthorized(401){% endblock %}
|
||||
{% block body %}
|
||||
{{ super() }}
|
||||
You're not allowed to access.
|
||||
{% endblock %}
|
||||
6
templates/page_404.html
Normal file
6
templates/page_404.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block page_title %}Not Found (404){% endblock %}
|
||||
{% block body %}
|
||||
{{ super() }}
|
||||
The resource can not be found.
|
||||
{% endblock %}
|
||||
6
templates/page_405.html
Normal file
6
templates/page_405.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block page_title %}Method not allowd (405){% endblock %}
|
||||
{% block body %}
|
||||
{{ super() }}
|
||||
The method of your request is not allowed.
|
||||
{% endblock %}
|
||||
6
templates/private_page.html
Normal file
6
templates/private_page.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block page_title %}Private Page{% endblock %}
|
||||
{% block body %}
|
||||
{{ super() }}
|
||||
Only logged-in users, like you, can access this page.
|
||||
{% endblock %}
|
||||
6
templates/public_page.html
Normal file
6
templates/public_page.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block page_title %}Public Page{% endblock %}
|
||||
{% block body %}
|
||||
{{ super() }}
|
||||
You can access this no matter whether you have logged in.
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user