Compare commits

..

No commits in common. "ae0008d2ca93f64e88647a744dcad207f6fbd820" and "c3b570dd2441869ce0c1dd701223b5f45c38bab5" have entirely different histories.

5 changed files with 14 additions and 70 deletions

View File

@ -107,35 +107,6 @@ func home(w http.ResponseWriter, r *http.Request) {
}
}
func news(w http.ResponseWriter, r *http.Request) {
id := authenticatedUser(w, r)
account, _ := users.GetAccount(id)
active_subscription := subscriptions.HasActiveSubscription(id)
text, err := template.ParseFiles("ui/html/base.html", "ui/html/news.html")
if err != nil {
http.Error(w, "Internal Server Error", 500)
log.Println(err)
}
switch r.Method {
case http.MethodGet:
err := text.Execute(w, TemplateData{AuthenticatedUser: id, Account: account, ActiveSubscription: active_subscription})
if err != nil {
log.Println(err)
http.Error(w, "Internal Server Error", 500)
}
case http.MethodPost:
err := text.Execute(w, TemplateData{})
if err != nil {
log.Println(err)
http.Error(w, "Internal Server Error", 500)
}
}
}
func login(w http.ResponseWriter, r *http.Request) {
text, err := template.ParseFiles("ui/html/base.html", "ui/html/login.html")
if err != nil {

View File

@ -71,7 +71,6 @@ func main() {
mux.HandleFunc("/favicon.ico", favicon)
mux.HandleFunc("/", home)
mux.HandleFunc("/news", news)
mux.HandleFunc("/login", login)
mux.HandleFunc("/logout", logout)
mux.HandleFunc("/register", register)

View File

@ -22,18 +22,17 @@
<nav>
<a href="/"><h1 class="maintitle">Alfheim</h1></a>
<div class="navbuttons">
<a href="/news"><div class="alfheimbutton"><strong>News</strong></div></a>
{{if not .ActiveSubscription}}
<a href="/subscribe"><div class="alfheimbutton"><strong>Subscribe</strong></div></a>
{{end}}
{{if not .ActiveSubscription}}
<a href="/subscribe"><div class="loginbutton"><strong>Subscribe</strong></div></a>
{{end}}
{{if .AuthenticatedUser}}
<a href="/account"><div class="alfheimbutton"><strong>Account</strong></div></a>
<a href="/logout"><div class="alfheimbutton"><strong>Log out</strong></div></a>
{{else}}
<a href="/login"><div class="alfheimbutton"><strong>Log in</strong><img src="/static/login_24dp_FILL0_wght400_GRAD0_opsz24.svg" alt=""/></div></a>
<a href="/register"><div class="alfheimbutton"><strong>Register</strong></div></a>
{{end}}
{{if .AuthenticatedUser}}
<a href="/account"><div class="loginbutton"><strong>Account</strong></div></a>
<a href="/logout"><div class="loginbutton"><strong>Log out</strong></div></a>
{{else}}
<a href="/login"><div class="loginbutton"><strong>Log in</strong><img src="/static/login_24dp_FILL0_wght400_GRAD0_opsz24.svg" alt=""/></div></a>
<a href="/register"><div class="loginbutton"><strong>Register</strong></div></a>
{{end}}
</div>
</nav>
</header>

View File

@ -1,3 +0,0 @@
{{define "body"}}
<p>NEWS!!</p>
{{end}}

View File

@ -22,9 +22,9 @@ body {
min-height: 100%;
}
/* header {
header {
} */
}
nav {
padding-left: 8px;
@ -50,7 +50,7 @@ nav {
}
}
.alfheimbutton {
.loginbutton {
align-self: center;
display: flex;
border: 12px solid;
@ -90,10 +90,9 @@ p {
border-radius: 15px;
padding: 30px 40px;
font-size: 1.5rem;
margin: 10px;
}
/* .wrapper {
.wrapper {
display: inline-block;
background: transparent;
border: 2px solid white;
@ -103,27 +102,6 @@ p {
padding: 30px 40px;
width: 80%;
text-align: center;
margin: 10px;
} */
.wrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 20px;
background: transparent;
border: 2px solid white;
backdrop-filter: blur(20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 15px;
padding: 30px 40px;
width: 80%;
text-align: center;
margin: 10px;
}
.wrapper form {
width: 100%; /* make each form stretch full width */
}
.wrapper h1 {