This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
uwu-me/views.py

32 lines
1.1 KiB
Python

try:
from .lib.helpers import get_static_paths, get_content_text
except:
from lib.helpers import get_static_paths, get_content_text
from . import app
from flask import Flask, render_template, redirect, url_for, request
@app.route('/home', methods=['GET'])
def home():
return render_template('home/index.html', user='admin', static_paths=get_static_paths(), content_text=get_content_text())
@app.route('/login', methods=['GET', 'POST'])
def login():
if(request.method == 'POST'):
if request.form['username'] != 'admin' or request.form['password'] != 'admin':
error = 'Invalid Credentials. Please try again.'
else:
return redirect(url_for('home'))
elif(request.method == 'GET'):
return render_template('login/index.html', static_paths=get_static_paths(), content_text=get_content_text())
return 'ERROR: Invalid method.'
@app.route("/", methods=['GET'])
def hello():
return render_template('homepage.html', static_paths=get_static_paths(), content_text=get_content_text())
def main():
app.run(host='0.0.0.0', debug=True)