Skip to content

Commit d522b4e

Browse files
committed
email support
1 parent b0a4342 commit d522b4e

File tree

37 files changed

+2500
-66
lines changed

37 files changed

+2500
-66
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ Project is created with:
4545
Just use the new [gonew](https://go.dev/blog/gonew)
4646

4747
```
48-
$ go install golang.org/x/tools/cmd/gonew@latest
49-
$ gonew github.com/golangast/goservershell example.com/myserver
48+
go install golang.org/x/tools/cmd/gonew@latest
49+
gonew github.com/golangast/goservershell example.com/myserver
5050
```
5151

5252
## Repository overview

assets/templates/contact/contact.html

+50
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,56 @@
11
{{define "contact"}}
22
<div class="tab-pane fade " id="contact" role="tabpanel" aria-labelledby="contact-tab">
33
This is how you contact me.
4+
5+
6+
7+
<nav>
8+
<div class="nav nav-tabs" id="nav-tab" role="tablist">
9+
<button class="nav-link active" id="nav-home-tab" data-bs-toggle="tab" data-bs-target="#nav-home" type="button"
10+
role="tab" aria-controls="nav-home" aria-selected="true">Sign up</button>
11+
<button class="nav-link" id="nav-profile-tab" data-bs-toggle="tab" data-bs-target="#nav-profile" type="button"
12+
role="tab" aria-controls="nav-profile" aria-selected="false">Sign-in</button>
13+
<button class="nav-link" id="nav-contact-tab" data-bs-toggle="tab" data-bs-target="#nav-contact" type="button"
14+
role="tab" aria-controls="nav-contact" aria-selected="false">Contact</button>
15+
</div>
16+
</nav>
17+
18+
<div class="tab-content" id="nav-tabContent">
19+
<div class="tab-pane fade " id="nav-profile" role="tabpanel" aria-labelledby="nav-home-tab">
20+
<p style="padding:2%;margin:2%;">
21+
Please Login.
22+
</p>
23+
<form style="padding:2%;margin:2%;" action="/userlogin" method="POST">
24+
<label for="email">email</label>
25+
<input type="text" id="email" name="email" value="[email protected]"><br>
26+
<label for="passwordraw">Password</label>
27+
<input type="text" id="passwordraw" name="passwordraw" value="aa">
28+
<input style="visibility:hidden;" type="text" id="sitetoken" name="sitetoken" value={{.t}}>
29+
<input type="submit" value="Submit">
30+
</form>
31+
32+
</div>
33+
<div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-profile-tab">
34+
<p style="padding:2%;margin:2%;">
35+
Please create a user
36+
</p>
37+
<form style="padding:2%;margin:2%;" action="/usercreate" method="POST">
38+
<label for="email">Email</label>
39+
<input type="text" id="email" name="email" value="some@gasd">
40+
41+
<label for="passwordraw">Password</label>
42+
<input type="text" id="passwordraw" name="passwordraw" value="aa">
43+
44+
<input style="visibility:hidden;" type="text" id="sitetoken" name="sitetoken" value={{.t}}>
45+
<input type="submit" value="Submit">
46+
</form>
47+
{{ if .exists}}<h2 style="color:tomato;">Input was not correct.</h2>{{else}} {{end}}
48+
{{ if .Ex}}<h2 style="color:tomato;">Input was not correct.</h2>{{else}} {{end}}
49+
50+
51+
</div>
52+
<div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab">...</div>
53+
</div>
454

555
</div>
656
{{end}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{{ template "header" . }}
2+
3+
you have made it
4+
5+
<p>here is some data from the database</p>
6+
{{if .users}}
7+
8+
{{index .users.Email}}
9+
10+
{{end}}
11+
12+
13+
<ul class="nav nav-tabs" id="toptab" role="tablist">
14+
<li class="nav-item" role="presentation">
15+
<button class="nav-link " id="contact-tab" data-bs-toggle="tab" data-bs-target="#contact" type="button" role="tab"
16+
aria-controls="contact" aria-selected="true">Contact Me</button>
17+
</li>
18+
<li class="nav-item" role="presentation">
19+
<button class="nav-link" id="about-tab" data-bs-toggle="tab" data-bs-target="#about" type="button" role="tab"
20+
aria-controls="about" aria-selected="true">About</button>
21+
</li>
22+
23+
</ul>
24+
<div class="tab-content" id="myTabContent">
25+
26+
{{ template "contact" . }}
27+
{{ template "about" . }}
28+
29+
</div>
30+
31+
<style>
32+
h6 {
33+
text-align: center;
34+
text-decoration: underline;
35+
padding-top: 2%;
36+
}
37+
38+
form {
39+
padding: 2%;
40+
margin: 2%;
41+
}
42+
43+
44+
45+
.btn-flat {
46+
text-decoration: none;
47+
}
48+
49+
.box {
50+
display: flex;
51+
align-items: center;
52+
justify-content: center;
53+
margin-bottom: 2em;
54+
}
55+
56+
.box img {
57+
width: 100px;
58+
height: 114px;
59+
-webkit-box-shadow: 1px 3px 15px -3px #000000;
60+
box-shadow: 1px 3px 15px -3px #000000;
61+
}
62+
63+
.flex-container {
64+
display: flex;
65+
flex-flow: row wrap;
66+
justify-content: space-around;
67+
padding: 0;
68+
margin: 0;
69+
list-style: none;
70+
}
71+
72+
.flex-item {
73+
padding: 5px;
74+
width: 100px;
75+
height: 100px;
76+
margin-top: 10px;
77+
line-height: 150px;
78+
font-weight: bold;
79+
font-size: 3em;
80+
text-align: center;
81+
}
82+
</style>
83+
84+
{{ template "footer" . }}

cmd/email.go

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright © 2023 NAME HERE <EMAIL ADDRESS>
3+
*/
4+
package cmd
5+
6+
import (
7+
"fmt"
8+
9+
"github.com/spf13/cobra"
10+
)
11+
12+
// emailCmd represents the email command
13+
var emailCmd = &cobra.Command{
14+
Use: "email",
15+
Short: "Used to test email",
16+
Long: ``,
17+
Run: func(cmd *cobra.Command, args []string) {
18+
fmt.Println("email called")
19+
//email.EmailVerify()
20+
},
21+
}
22+
23+
func init() {
24+
rootCmd.AddCommand(emailCmd)
25+
26+
// Here you will define your flags and configuration settings.
27+
28+
// Cobra supports Persistent Flags which will work for this command
29+
// and all subcommands, e.g.:
30+
// emailCmd.PersistentFlags().String("foo", "", "A help for foo")
31+
32+
// Cobra supports local flags which will only run when this command
33+
// is called directly, e.g.:
34+
// emailCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
35+
}

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/labstack/gommon v0.4.0
1111
github.com/spf13/cobra v1.7.0
1212
golang.org/x/crypto v0.11.0
13+
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
1314
modernc.org/sqlite v1.25.0
1415
)
1516

@@ -41,6 +42,7 @@ require (
4142
golang.org/x/text v0.11.0 // indirect
4243
golang.org/x/time v0.3.0 // indirect
4344
golang.org/x/tools v0.6.0 // indirect
45+
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
4446
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
4547
lukechampine.com/uint128 v1.2.0 // indirect
4648
modernc.org/cc/v3 v3.40.0 // indirect

go.sum

+4
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,13 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
130130
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
131131
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
132132
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
133+
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
134+
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
133135
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
134136
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
135137
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
138+
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
139+
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
136140
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
137141
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
138142
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

goservershell

591 KB
Binary file not shown.

internal/dbsql/dbconn/database.db

0 Bytes
Binary file not shown.

internal/dbsql/gettable/gettable.go

-43
This file was deleted.

0 commit comments

Comments
 (0)