Prototype user profile pages.
This commit is contained in:
parent
2e41f7da53
commit
abe474487a
8 changed files with 42 additions and 8 deletions
0
uwume/assets/user/content.txt
Normal file
0
uwume/assets/user/content.txt
Normal file
|
@ -1,6 +1,7 @@
|
|||
from flask import request
|
||||
from os import getcwd
|
||||
from os.path import exists
|
||||
from re import search
|
||||
|
||||
|
||||
def is_docker():
|
||||
|
@ -32,4 +33,9 @@ def get_static_paths():
|
|||
if(str(request.url_rule) == '/'):
|
||||
return (f'static/css/index.css', f'static/js/index.js')
|
||||
else:
|
||||
if('<' in str(request.url_rule)):
|
||||
delete = search('<.*>', str(request.url_rule))
|
||||
delete = '/' + delete.group(0)
|
||||
new_path = str(request.url_rule).replace(delete, '')
|
||||
return (f'static/css{new_path}/index.css', f'static/js{new_path}/index.js')
|
||||
return (f'static/css{request.url_rule}/index.css', f'static/js{request.url_rule}/index.js')
|
||||
|
|
0
uwume/static/css/user/index.css
Normal file
0
uwume/static/css/user/index.css
Normal file
0
uwume/static/js/user/index.js
Normal file
0
uwume/static/js/user/index.js
Normal file
|
@ -2,11 +2,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/png" href="static/assets/favicon.png" />
|
||||
<link rel="stylesheet" href="static/materialize/css/materialize.min.css" />
|
||||
<script src="static/materialize/js/materialize.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{{ static_paths[0] }}" />
|
||||
<script type="text/javascript" src="{{ static_paths[1] }}"></script>
|
||||
<link rel="icon" type="image/png" href="/static/assets/favicon.png" />
|
||||
<link rel="stylesheet" href="/static/materialize/css/materialize.min.css" />
|
||||
<script src="/static/materialize/js/materialize.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/{{ static_paths[0] }}" />
|
||||
<script type="text/javascript" src="/{{ static_paths[1] }}"></script>
|
||||
</head>
|
||||
<body class="grey darken-4">
|
||||
<title>UwU Me!{{ optional_title_status }}</title>
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
<h5 class="grey-text text-lighten-1 center">
|
||||
Sign Up Page
|
||||
</h5>
|
||||
{% endblock %} {% block content %}
|
||||
{% for message in get_flashed_messages() %}
|
||||
{% endblock %} {% block content %} {% for message in get_flashed_messages() %}
|
||||
<div class="card-panel red accent-1">
|
||||
<p>
|
||||
{{ message }}
|
||||
|
|
21
uwume/templates/user/index.html
Normal file
21
uwume/templates/user/index.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{% extends 'index.html' %} {% block header %}
|
||||
<h1 class="blue-grey-text text-lighten-5 center">
|
||||
UwU {{ this_user }}!
|
||||
</h1>
|
||||
<h5 class="grey-text text-lighten-1 center">
|
||||
Say UwU to them!
|
||||
</h5>
|
||||
{% endblock %} {% block content %}
|
||||
<div class="card-panel grey darken-3">
|
||||
<div class="center">
|
||||
<button class="waves-effect waves-light btn blue darken-2" href="/">
|
||||
UwU
|
||||
</button>
|
||||
</div>
|
||||
{% for item in content_text %}
|
||||
<p class="blue-grey-text text-lighten-5">
|
||||
{{ item }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -37,6 +37,14 @@ def load_user(request):
|
|||
return User(request, User.user_database[request][1])
|
||||
|
||||
|
||||
@app.route('/user/<username>', methods=['GET'])
|
||||
def user_page(username):
|
||||
error = ''
|
||||
if(request.method == 'GET'):
|
||||
return render_template('user/index.html', this_user=username, static_paths=get_static_paths(), content_text=get_content_text())
|
||||
return f'ERROR: {error}'
|
||||
|
||||
|
||||
@app.route('/home', methods=['GET'])
|
||||
@login_required
|
||||
def home():
|
||||
|
@ -67,7 +75,7 @@ def login():
|
|||
if(request.method == 'POST'):
|
||||
username = request.form['username']
|
||||
password = request.form['password']
|
||||
if(username in User.user_database.keys()):
|
||||
if(username in User.user_database.keys() and password == User.user_database.get(username)[1]):
|
||||
userClass = User(username, password)
|
||||
login_user(userClass)
|
||||
return redirect('home')
|
||||
|
|
Reference in a new issue