save oauth user_id and link users and accounts

This commit is contained in:
2025-12-30 02:06:14 -07:00
parent bc592718bf
commit 8090a6f25e
21 changed files with 468 additions and 198 deletions
@@ -1,3 +1,5 @@
{{/* "dot" . */}}
<nav>
<ul>
<li>
@@ -6,15 +8,23 @@
</a>
</li>
{{- if .dot.UserID }}
<li>
<a href="/sign-up">
Sign Up
<a href="/accounts/{{.dot.Account.ID}}">
Account
</a>
</li>
<li>
<a href="/login">
Log In
<a href="/accounts/{{.dot.Account.ID}}/reports">
Reports
</a>
</li>
<li>
<a href="/accounts/{{.dot.Account.ID}}/inventory">
Inventory
</a>
</li>
@@ -23,6 +33,16 @@
Log Out
</a>
</li>
{{- else }}
<li>
<a href="/login">
Log In / Sign Up
</a>
</li>
{{- end }}
</ul>
</nav>
+3 -1
View File
@@ -1,7 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>WIP</title>
<title>
{{ block "title" . }} Inventory++ {{ end }}
</title>
<link rel="stylesheet" href="/styles/index.css">
@@ -0,0 +1,16 @@
{{- define "title" }} Inventory++ Create an Account {{ end }}
{{- componentBody "nav_bar" "dot" . }}
{{/* TODO: will need to verify the email address */}}
<section style="margin-top: 2em;">
<form method="post" action="/accounts">
<label>
Email:
<input type="email" required name="email" />
</label>
<input type="submit" value="Create Account" />
</form>
</section>
@@ -1,19 +1,19 @@
{{ componentBody "nav_bar" }}
{{- define "title" }} Inventory++ Account {{ end }}
{{- componentBody "nav_bar" "dot" . }}
{{- $acctID := parseInt64 .PathParams.acctID }}
{{- $acct := (.Accounts.GetAccount $acctID) }}
<h1>Account: {{ .Account.Email }}</h1>
<h1>Account: {{ $acct.Email }} (id: {{ $acctID }})</h1>
{{- $etsyUser := .Etsy.GetUserPointerByAccountID $acctID }}
{{- $etsyUser := .Etsy.GetUserPointerByAccountID .Account.ID }}
{{- if $etsyUser }}
<h3>Etsy User: {{ $etsyUser.UserID }}; Shop ID: {{ $etsyUser.ShopID }}</h3>
{{- else }}
<h3>
<a href="{{ .Etsy.GenerateConnectionURLForNewAccount $acctID }}">
{{/* TODO: create this link dynamically, not EVERYTIME THE PAGE IS LOADED */}}
<a href="{{ .Etsy.GenerateConnectionURLForNewAccount .Account.ID }}">
Link Your Etsy Store!
</a>
</h3>
{{- end }}
<h2><a href="{{$acctID}}/reports">View Reports</a></h2>
<h2><a href="/accounts/{{.Account.ID}}/reports">View Reports</a></h2>
@@ -0,0 +1,6 @@
{{- define "title" }} Inventory++ {{ end }}
{{ componentBody "nav_bar" "dot" . }}
<h1>Inventory management page: WIP</h1>
@@ -1,4 +1,6 @@
{{ componentBody "nav_bar" }}
{{- define "title" }} Inventory++ Reports {{ end }}
{{ componentBody "nav_bar" "dot" . }}
{{ $storeID := .Request.URL.Query.Get "store-id" }}
@@ -1,7 +1,10 @@
{{ componentBody "nav_bar" }}
{{ componentBody "nav_bar" "dot" . }}
<h1>Home</h1>
<h2><a href="/sign-up">Sign Up!</a></h2>
{{- if and .UserID (not .Account.ID) }}
<h2><a href="/account-creation">New Account</a></h2>
{{- end }}
<h2><a href="/test-auth">Test Auth</a></h2>
<a href="/test-auth">Test Auth</a>
@@ -1,4 +1,6 @@
{{ componentBody "nav_bar" }}
{{/* TODO: delete this page, when certain it's not wanted anymore */}}
{{ componentBody "nav_bar" "dot" . }}
<h1>Log In</h1>
@@ -1,4 +1,6 @@
{{ componentBody "nav_bar" }}
{{/* TODO: not used - read for deletion */}}
{{ componentBody "nav_bar" "dot" . }}
<h1>Sign Up</h1>