diff options
Diffstat (limited to 'app/templates')
-rw-r--r-- | app/templates/base.html | 11 | ||||
-rw-r--r-- | app/templates/index.html | 8 | ||||
-rw-r--r-- | app/templates/network_list.html | 42 | ||||
-rw-r--r-- | app/templates/profile.html | 46 | ||||
-rw-r--r-- | app/templates/register.html | 17 |
5 files changed, 124 insertions, 0 deletions
diff --git a/app/templates/base.html b/app/templates/base.html index d905156..735d430 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -14,6 +14,17 @@ <div class="navbar"> <ul> <li class="navbar-item"><a href="/">Home</a></li> + {% if not current_user.is_authenticated %} + <li class="navbar-item"><a + href="{{url_for('auth.login')}}">Login</a></li> + <li class="navbar-item"><a + href="{{url_for('auth.register')}}">Register</a></li> + {% else %} + <li class="navbar-item"><a + href="{{url_for('auth.profile')}}">Profile</a></li> + <li class="navbar-item"><a + href="{{url_for('auth.logout')}}">Logout</a></li> + {% endif %} </ul> </div> {% with messages = get_flashed_messages() %} diff --git a/app/templates/index.html b/app/templates/index.html index 3c69e80..efaf29e 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,5 +1,13 @@ {% extends "base.html" %} {% block content %} +{% if current_user.is_authenticated %} +<h1>Hi, {{current_user.pref_name}}!</h1> +{% else %} +<h1>Hello!</h1> +<p>Much of this tool requires authentication. Head on over <a + href="{{url_for('auth.login')}}">here</a> +to login, or <a href="{{url_for('auth.register')}}">here</a> to register. +{% endif %} {% endblock %} diff --git a/app/templates/network_list.html b/app/templates/network_list.html new file mode 100644 index 0000000..f56c6dc --- /dev/null +++ b/app/templates/network_list.html @@ -0,0 +1,42 @@ +{% extends 'base.html' %} + +{% block content %} +<h1>Managed Network Subnets</h1> + +<table> + <thead> + <tr> + <th scope="col">ID</th> + <th scope="col">Subnet</th> + <th scope="col">Description</th> + <th scope="col">Manager</th> + <th scope="col">Delete</th> + </tr> + </thead> + <tbody> + {% for n in nets %} + <tr> + <td>{{n.id}}</td> + <td>{{n.subnet}}</td> + <td>{{n.description}}</td> + <td>{{n.manager_id}}</td> + <td><a href="{{url_for('manage.del_net', id=n.id)}}">Delete</a></td> + </tr> + {% endfor %} + </tbody> +</table> + +<p>Want to add another one?</p> +<form method="POST"> + {{form.csrf_token}} + <div> + {{form.description.label}} {{form.description}} + </div> + <div> + {{form.subnet.label}} {{form.subnet}} + </div> + <div> + {{form.submit}} + </div> + </form> +{% endblock %} diff --git a/app/templates/profile.html b/app/templates/profile.html new file mode 100644 index 0000000..6d4d60a --- /dev/null +++ b/app/templates/profile.html @@ -0,0 +1,46 @@ +{% extends 'base.html' %} + +{% block content %} +<h1>{{current_user.pref_name}} - {{current_user.email}} ({{current_user.id}})</h1> + +{% if debug %} +<table> + <thead> + <tr> + <th scope="col">Key</th> + <th scope="col">Value</th> + </tr> + </thead> + <tbody> + {% for attr, value in current_user.__dict__.items() %} + <tr> + <td>{{attr}}</td> + <td>{{value}}</td> + </tr> + {% endfor %} + </tbody> +</table> +{% endif %} + +<h3>Owned Peers</h3> +<table> + <thead> + <tr> + <th scope="col">ID</th> + <th scope="col">Description</th> + <th scope="col">Address</th> + <th scope="col">Public Key</th> + </tr> + </thead> + <tbody> + {% for p in peers %} + <tr> + <td>{{p.id}}</td> + <td>{{p.description}}</td> + <td>{{p.addr}}</td> + <td>{{p.public_key}}</td> + </tr> + {% endfor %} + </tbody> +</table> +{% endblock %} diff --git a/app/templates/register.html b/app/templates/register.html index 56d9855..6e19559 100644 --- a/app/templates/register.html +++ b/app/templates/register.html @@ -1,5 +1,22 @@ {% extends 'base.html' %} {% block content %} +<form method="POST"> + {{ form.csrf_token }} + <div> + {{form.username.label}} {{form.username}} + </div> + <div> + {{form.pref_name.label}} {{form.pref_name}} + </div> + <div> + <span> + {{form.password.label}} {{form.password}} + {{form.password_confirm.label}} {{form.password_confirm}} + </span> + </div> + + {{form.submit}} +</form> {% endblock %} |