git-svn-id: svn://losandesgames.com/alfheim-website@37 15359d88-9307-4e75-a9c1-e5686e5897df
This commit is contained in:
parent
07cdba73e5
commit
c911550021
24
handlers.go
24
handlers.go
@ -23,7 +23,7 @@ import "github.com/stripe/stripe-go/v78/webhook"
|
|||||||
import "github.com/stripe/stripe-go/v78/customer"
|
import "github.com/stripe/stripe-go/v78/customer"
|
||||||
import "github.com/stripe/stripe-go/v78/subscription"
|
import "github.com/stripe/stripe-go/v78/subscription"
|
||||||
|
|
||||||
type templatedata struct {
|
type TemplateData struct {
|
||||||
AuthenticatedUser int32
|
AuthenticatedUser int32
|
||||||
FormErrors map[string]string
|
FormErrors map[string]string
|
||||||
Account Account
|
Account Account
|
||||||
@ -86,14 +86,14 @@ func home(w http.ResponseWriter, r *http.Request) {
|
|||||||
switch r.Method {
|
switch r.Method {
|
||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
|
|
||||||
err := text.Execute(w, templatedata{AuthenticatedUser: id, Account: account, ActiveSubscription: activesubscription})
|
err := text.Execute(w, TemplateData{AuthenticatedUser: id, Account: account, ActiveSubscription: activesubscription})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
case http.MethodPost:
|
case http.MethodPost:
|
||||||
err := text.Execute(w, templatedata{})
|
err := text.Execute(w, TemplateData{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
@ -111,7 +111,7 @@ func login(w http.ResponseWriter, r *http.Request) {
|
|||||||
switch r.Method {
|
switch r.Method {
|
||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
|
|
||||||
err := text.Execute(w, templatedata{})
|
err := text.Execute(w, TemplateData{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
@ -137,7 +137,7 @@ func login(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if len(errors) > 0 {
|
if len(errors) > 0 {
|
||||||
|
|
||||||
err := text.Execute(w, templatedata{AuthenticatedUser: authenticated_user(w, r), FormErrors: errors})
|
err := text.Execute(w, TemplateData{AuthenticatedUser: authenticated_user(w, r), FormErrors: errors})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
@ -149,7 +149,7 @@ func login(w http.ResponseWriter, r *http.Request) {
|
|||||||
id, err := users.Authenticate(username, password)
|
id, err := users.Authenticate(username, password)
|
||||||
if err == ErrInvalidCredentials {
|
if err == ErrInvalidCredentials {
|
||||||
errors["generic"] = "Email or Password is incorrect"
|
errors["generic"] = "Email or Password is incorrect"
|
||||||
err := text.Execute(w, templatedata{AuthenticatedUser: authenticated_user(w, r), FormErrors: errors})
|
err := text.Execute(w, TemplateData{AuthenticatedUser: authenticated_user(w, r), FormErrors: errors})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
@ -181,7 +181,7 @@ func logout(w http.ResponseWriter, r *http.Request) {
|
|||||||
switch r.Method {
|
switch r.Method {
|
||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
|
|
||||||
err := text.Execute(w, templatedata{AuthenticatedUser: id, Account: account, ActiveSubscription: activesubscription})
|
err := text.Execute(w, TemplateData{AuthenticatedUser: id, Account: account, ActiveSubscription: activesubscription})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
@ -209,7 +209,7 @@ func register(w http.ResponseWriter, r *http.Request) {
|
|||||||
switch r.Method {
|
switch r.Method {
|
||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
|
|
||||||
err := text.Execute(w, templatedata{AuthenticatedUser: id, Account: account})
|
err := text.Execute(w, TemplateData{AuthenticatedUser: id, Account: account})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
@ -234,7 +234,7 @@ func register(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if len(errors) > 0 {
|
if len(errors) > 0 {
|
||||||
|
|
||||||
err := text.Execute(w, templatedata{AuthenticatedUser: authenticated_user(w, r), FormErrors: errors})
|
err := text.Execute(w, TemplateData{AuthenticatedUser: authenticated_user(w, r), FormErrors: errors})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
@ -277,7 +277,7 @@ func account(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
err := text.Execute(w, templatedata{AuthenticatedUser: id, Account: account})
|
err := text.Execute(w, TemplateData{AuthenticatedUser: id, Account: account})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
@ -339,7 +339,7 @@ func subscribe(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = text.Execute(w, templatedata{AuthenticatedUser: id, Account: account, Prices: prices})
|
err = text.Execute(w, TemplateData{AuthenticatedUser: id, Account: account, Prices: prices})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
@ -369,7 +369,7 @@ func subscribe_stripe(w http.ResponseWriter, r *http.Request) {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = text.Execute(w, templatedata{AuthenticatedUser: id, Account: account, ClientSecret: result.ClientSecret})
|
err = text.Execute(w, TemplateData{AuthenticatedUser: id, Account: account, ClientSecret: result.ClientSecret})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
http.Error(w, "Internal Server Error", 500)
|
http.Error(w, "Internal Server Error", 500)
|
||||||
|
|||||||
@ -16,6 +16,8 @@ body {
|
|||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
min-height: 100%;
|
min-height: 100%;
|
||||||
max-width: 900px;
|
max-width: 900px;
|
||||||
}
|
}
|
||||||
@ -170,9 +172,7 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
position: relative;
|
margin-top: auto;
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #132123;
|
background-color: #132123;
|
||||||
color: white;
|
color: white;
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<!--
|
|
||||||
/\ | |--- | | |--- || |\ /|
|
|
||||||
/__\ | |-- |---| |-- || | \ / |
|
|
||||||
/ \ |___ | | | |___ || | \/ |
|
|
||||||
-->
|
|
||||||
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Alfheim</title>
|
<title>Alfheim</title>
|
||||||
@ -48,7 +42,7 @@
|
|||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Alfheim © 2024, Vicente Ferrari Smith, Los Andes Games, Vienna, Austria. All rights reserved.
|
Alfheim © 2025, Vicente Ferrari Smith, Los Andes Games, Vienna, Austria. All rights reserved.
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user