This commit is contained in:
Aritra Banik 2024-03-13 02:06:50 +05:30
parent 5a1ec3c3ee
commit 3a62312a15
4 changed files with 9 additions and 3 deletions

BIN
src/a3

Binary file not shown.

View File

@ -34,7 +34,9 @@
<span class="icon icon-person"></span>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{% if user.accessLevel >= 2 %}
<a class="dropdown-item" href="/admin/dashboard">Dashboard</a>
{% endif %}
<a class="dropdown-item" href="/logout">Logout</a>
</div>
</li>

View File

@ -3,12 +3,15 @@ import
segfaults,
os,
nimja/parser,
./a3pkg/[models, mics]
./a3pkg/[models, mics],
./a3c/users
proc index*(ctx: Context): string =
var
products: seq[Products]
cookies = ctx.cookies
user: User
db = newDatabase()
email = cookies.getOrDefault("email", "")
password = cookies.getOrDefault("password", "")
@ -17,5 +20,6 @@ proc index*(ctx: Context): string =
echo "No cookie found."
else:
products = micsGetProducts(email, password)
user = db.getUser(email, password)
compileTemplateFile(getScriptDir() / "a3a" / "index.nimja")