Skip to content

Commit a2c80dd

Browse files
authored
Merge pull request #10 from myrunes/dev
release v1.5.0
2 parents 874a6cd + 32f5fbf commit a2c80dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3173
-810
lines changed

.github/workflows/main.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**.md'
7+
8+
jobs:
9+
10+
build_backend:
11+
name: Build Back End
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: Set up Go 1.13
16+
uses: actions/setup-go@v1
17+
with:
18+
go-version: 1.13
19+
id: go
20+
21+
- name: Check out code
22+
uses: actions/checkout@v1
23+
24+
- name: Get dependencies
25+
run: |
26+
go get -v -t -d ./...
27+
28+
- name: Build Backend
29+
run: |
30+
go build -v ./cmd/server/*.go
31+
32+
build_frontend:
33+
name: Build Front End
34+
runs-on: ubuntu-latest
35+
steps:
36+
37+
- name: Use Node.js 13.x
38+
uses: actions/setup-node@v1
39+
with:
40+
node-version: 13.x
41+
42+
- name: Check out code
43+
uses: actions/checkout@v1
44+
45+
- name: Get dependencies
46+
working-directory: ./web
47+
run: |
48+
npm ci
49+
50+
- name: Build Front End Files
51+
working-directory: ./web
52+
run: |
53+
npm run build

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ RUN cd ./web &&\
2323

2424

2525
FROM debian:stretch-slim AS final
26+
RUN apt-get update &&\
27+
apt-get install -y ca-certificates &&\
28+
update-ca-certificates
2629
WORKDIR /app
2730
COPY --from=build /app .
2831

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
<strong>Save your League of Legends rune pages without wasting money.</strong><br><br>
55
<img src="https://forthebadge.com/images/badges/made-with-go.svg" height="30" />&nbsp;
66
<img src="https://forthebadge.com/images/badges/made-with-vue.svg" height="30" />&nbsp;
7-
<img src="https://forthebadge.com/images/badges/fuck-it-ship-it.svg" height="30" />&nbsp;
7+
<a href="https://stackshare.io/myrunes/myrunes"><img src="https://img.shields.io/badge/tech-stack-blue?style=for-the-badge" height="30"/></a>&nbsp;
88
<a href="https://zekro.de/discord"><img src="https://img.shields.io/discord/307084334198816769.svg?logo=discord&style=for-the-badge" height="30"></a>
99
<br/><br/>
10-
<a href="https://hub.docker.com/r/zekro/myrunes"><img alt="Docker Cloud Automated build" src="https://img.shields.io/docker/cloud/automated/zekro/myrunes.svg?color=cyan&logo=docker&logoColor=cyan&style=for-the-badge"></a>&nbsp;
11-
<a href="https://travis-ci.org/myrunes/myrunes"><img alt="Travis (.org)" src="https://img.shields.io/travis/myrunes/myrunes.svg?logo=travis&style=for-the-badge"></a>&nbsp;
12-
<a href="https://stackshare.io/myrunes/myrunes"><img src="https://img.shields.io/badge/tech-stack-blue?style=for-the-badge" height="30"/></a>
10+
<a href="https://hub.docker.com/r/zekro/myrunes"><img src="https://img.shields.io/docker/cloud/automated/zekro/myrunes.svg?color=cyan&logo=docker&logoColor=cyan&style=for-the-badge" height="30"></a>&nbsp;
11+
<a href="https://travis-ci.org/myrunes/myrunes"><img src="https://img.shields.io/travis/myrunes/myrunes.svg?logo=travis&style=for-the-badge" height="30"></a>&nbsp;
12+
<a href="https://github.com/myrunes/myrunes/actions"><img src="https://img.shields.io/github/workflow/status/myrunes/myrunes/CI?label=Actions&logo=github&style=for-the-badge" height="30"/></a>&nbsp;
1313
</div>
1414

1515
---

cmd/server/main.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/myrunes/myrunes/internal/config"
1212
"github.com/myrunes/myrunes/internal/database"
1313
"github.com/myrunes/myrunes/internal/logger"
14+
"github.com/myrunes/myrunes/internal/mailserver"
1415
"github.com/myrunes/myrunes/internal/webserver"
1516
"github.com/myrunes/myrunes/pkg/lifecycletimer"
1617
)
@@ -73,8 +74,15 @@ func main() {
7374
db.Close()
7475
}()
7576

77+
logger.Info("MAILSERVER :: initialization")
78+
ms, err := mailserver.NewMailServer(cfg.MailServer, "[email protected]", "myrunes")
79+
if err != nil {
80+
logger.Fatal("MAILSERVER :: failed connecting to mail account: %s", err.Error())
81+
}
82+
logger.Info("MAILSERVER :: started")
83+
7684
logger.Info("WEBSERVER :: initialization")
77-
ws := webserver.NewWebServer(db, cfg.WebServer, *flagAssets)
85+
ws := webserver.NewWebServer(db, ms, cfg.WebServer, *flagAssets)
7886
go func() {
7987
if err := ws.ListenAndServeBlocking(); err != nil {
8088
logger.Fatal("WEBSERVER :: failed starting web server: %s", err.Error())

cmd/testing/main.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/myrunes/myrunes/pkg/comparison"
7+
)
8+
9+
func main() {
10+
fmt.Println(comparison.Alphabetically("ac", "ab"))
11+
}

go.mod

+8
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ go 1.13
55
require (
66
github.com/bwmarrin/snowflake v0.3.0
77
github.com/ghodss/yaml v1.0.0
8+
github.com/go-ozzo/ozzo-routing v2.1.4+incompatible // indirect
89
github.com/go-stack/stack v1.8.0 // indirect
10+
github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2 // indirect
911
github.com/golang/snappy v0.0.1 // indirect
12+
github.com/google/go-cmp v0.3.1 // indirect
1013
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
1114
github.com/qiangxue/fasthttp-routing v0.0.0-20160225050629-6ccdc2a18d87
15+
github.com/stretchr/testify v1.4.0 // indirect
16+
github.com/tidwall/pretty v1.0.0 // indirect
1217
github.com/valyala/fasthttp v1.6.0
1318
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect
1419
github.com/xdg/stringprep v1.0.0 // indirect
@@ -17,5 +22,8 @@ require (
1722
go.mongodb.org/mongo-driver v1.1.3
1823
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba
1924
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
25+
golang.org/x/tools v0.0.0-20191213221258-04c2e8eff935 // indirect
26+
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
27+
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
2028
gopkg.in/yaml.v2 v2.2.7 // indirect
2129
)

go.sum

+28
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
11
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
22
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
3+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
4+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
35
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
46
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
7+
github.com/go-ozzo/ozzo-routing v2.1.4+incompatible h1:gQmNyAwMnBHr53Nma2gPTfVVc6i2BuAwCWPam2hIvKI=
8+
github.com/go-ozzo/ozzo-routing v2.1.4+incompatible/go.mod h1:hvoxy5M9SJaY0viZvcCsODidtUm5CzRbYKEWuQpr+2A=
59
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
610
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
11+
github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2 h1:xisWqjiKEff2B0KfFYGpCqc3M3zdTz+OHQHRc09FeYk=
12+
github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2/go.mod h1:xEhNfoBDX1hzLm2Nf80qUvZ2sVwoMZ8d6IE2SrsQfh4=
713
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
814
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
15+
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
16+
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
917
github.com/klauspost/compress v1.8.2 h1:Bx0qjetmNjdFXASH02NSAREKpiaDwkO1DRZ3dV2KCcs=
1018
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
1119
github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w=
1220
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
1321
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88=
1422
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
23+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
24+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1525
github.com/qiangxue/fasthttp-routing v0.0.0-20160225050629-6ccdc2a18d87 h1:u7uCM+HS2caoEKSPtSFQvvUDXQtqZdu3MYtF+QEw7vA=
1626
github.com/qiangxue/fasthttp-routing v0.0.0-20160225050629-6ccdc2a18d87/go.mod h1:zwr0xP4ZJxwCS/g2d+AUOUwfq/j2NC7a1rK3F0ZbVYM=
27+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
28+
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
29+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
30+
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
31+
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
1732
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
1833
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
1934
github.com/valyala/fasthttp v1.6.0 h1:uWF8lgKmeaIewWVPwi4GRq2P6+R46IgYZdxWtM+GtEY=
@@ -30,16 +45,29 @@ github.com/zekroTJA/timedmap v0.0.0-20191029102728-85f9d45635d7/go.mod h1:ktlw5a
3045
go.mongodb.org/mongo-driver v1.1.3 h1:++7u8r9adKhGR+I79NfEtYrk2ktjenErXM99PSufIoI=
3146
go.mongodb.org/mongo-driver v1.1.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=
3247
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
48+
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
3349
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba h1:9bFeDpN3gTqNanMVqNcoR/pJQuP5uroC3t1D7eXozTE=
3450
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
51+
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
3552
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
53+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
3654
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
55+
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3756
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
3857
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3958
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
4059
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
4160
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
4261
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
62+
golang.org/x/tools v0.0.0-20191213221258-04c2e8eff935 h1:kJQZhwFzSwJS2BxboKjdZzWczQOZx8VuH7Y8hhuGUtM=
63+
golang.org/x/tools v0.0.0-20191213221258-04c2e8eff935/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
64+
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
65+
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk=
66+
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
67+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
4368
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
69+
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
70+
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
71+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
4472
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
4573
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

internal/config/config.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import (
88

99
"github.com/ghodss/yaml"
1010
"github.com/myrunes/myrunes/internal/database"
11+
"github.com/myrunes/myrunes/internal/mailserver"
1112
"github.com/myrunes/myrunes/internal/webserver"
1213
)
1314

1415
type Main struct {
15-
MongoDB *database.MongoConfig `json:"mongodb"`
16-
WebServer *webserver.Config `json:"webserver"`
16+
MongoDB *database.MongoConfig `json:"mongodb"`
17+
WebServer *webserver.Config `json:"webserver"`
18+
MailServer *mailserver.Config `json:"mailserver"`
1719
}
1820

1921
func Open(loc string) (*Main, error) {
@@ -41,11 +43,15 @@ func cretaeDefault(loc string) error {
4143
DataDB: "lol-runes",
4244
},
4345
WebServer: &webserver.Config{
44-
Addr: ":443",
46+
Addr: ":443",
47+
PublicAddr: "https://myrunes.com",
4548
TLS: &webserver.TLSConfig{
4649
Enabled: true,
4750
},
4851
},
52+
MailServer: &mailserver.Config{
53+
Port: 465,
54+
},
4955
}
5056

5157
data, err := yaml.Marshal(def)

internal/database/mongodb.go

+9
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func (m *MongoDB) GetUser(uid snowflake.ID, username string) (*objects.User, err
8888

8989
ok, err := m.get(m.collections.users, bson.M{"$or": bson.A{
9090
bson.M{"username": username},
91+
bson.M{"mailaddress": username},
9192
bson.M{"uid": uid},
9293
}}, user)
9394

@@ -139,6 +140,14 @@ func (m *MongoDB) EditUser(user *objects.User, login bool) (bool, error) {
139140
oldUser.PageOrder = user.PageOrder
140141
}
141142

143+
if user.MailAddress != "" {
144+
if user.MailAddress == "__RESET__" {
145+
oldUser.MailAddress = ""
146+
} else {
147+
oldUser.MailAddress = user.MailAddress
148+
}
149+
}
150+
142151
return true, m.insertOrUpdate(m.collections.users,
143152
bson.M{"uid": oldUser.UID}, oldUser)
144153
}

internal/mailserver/mailserver.go

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package mailserver
2+
3+
import (
4+
"gopkg.in/gomail.v2"
5+
)
6+
7+
type Config struct {
8+
Host string `json:"host"`
9+
Port int `json:"port"`
10+
Username string `json:"username"`
11+
Password string `json:"password"`
12+
}
13+
14+
type MailServer struct {
15+
dialer *gomail.Dialer
16+
17+
defFrom string
18+
defFromName string
19+
}
20+
21+
func NewMailServer(config *Config, defFrom, defFromName string) (*MailServer, error) {
22+
ms := new(MailServer)
23+
ms.dialer = gomail.NewPlainDialer(config.Host, config.Port, config.Username, config.Password)
24+
25+
closer, err := ms.dialer.Dial()
26+
if err != nil {
27+
return nil, err
28+
}
29+
30+
defer closer.Close()
31+
32+
ms.defFrom = defFrom
33+
ms.defFromName = defFromName
34+
35+
return ms, nil
36+
}
37+
38+
func (ms *MailServer) SendMailRaw(msg *gomail.Message) error {
39+
return ms.dialer.DialAndSend(msg)
40+
}
41+
42+
func (ms *MailServer) SendMail(from, fromName, to, subject, body, bodyType string) error {
43+
if from == "" {
44+
from = ms.defFrom
45+
}
46+
47+
if fromName == "" {
48+
fromName = ms.defFromName
49+
}
50+
51+
msg := gomail.NewMessage()
52+
msg.SetAddressHeader("From", from, fromName)
53+
msg.SetAddressHeader("To", to, "")
54+
msg.SetHeader("Subject", subject)
55+
msg.SetBody(bodyType, body)
56+
return ms.SendMailRaw(msg)
57+
}
58+
59+
func (ms *MailServer) SendMailFromDef(to, subject, body, bodyType string) error {
60+
return ms.SendMail("", "", to, subject, body, bodyType)
61+
}

internal/objects/share.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func NewSharePage(ownerID, pageID snowflake.ID, maxAccesses int, expires time.Ti
4848
AccessIPs: make([]string, 0),
4949
}
5050

51-
share.Ident, err = random.GetRandBase64Str(5)
51+
share.Ident, err = random.Base64(5)
5252

5353
return share, err
5454
}

internal/objects/user.go

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var (
2323
type User struct {
2424
UID snowflake.ID `json:"uid"`
2525
Username string `json:"username"`
26+
MailAddress string `json:"mailaddress"`
2627
DisplayName string `json:"displayname"`
2728
PassHash []byte `json:"passhash,omitempty"`
2829
LastLogin time.Time `json:"lastlogin"`

internal/webserver/auth.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"github.com/bwmarrin/snowflake"
1010
"github.com/valyala/fasthttp"
1111

12-
routing "github.com/qiangxue/fasthttp-routing"
1312
"github.com/myrunes/myrunes/internal/database"
1413
"github.com/myrunes/myrunes/internal/objects"
1514
"github.com/myrunes/myrunes/pkg/random"
15+
routing "github.com/qiangxue/fasthttp-routing"
1616
"golang.org/x/crypto/bcrypt"
1717
)
1818

@@ -62,7 +62,7 @@ func (auth *Authorization) CheckHash(hash, pass []byte) bool {
6262
}
6363

6464
func (auth *Authorization) CreateSessionKey() (string, error) {
65-
return random.GetRandBase64Str(sessionKeyLength)
65+
return random.Base64(sessionKeyLength)
6666
}
6767

6868
func (auth *Authorization) Login(ctx *routing.Context) bool {

0 commit comments

Comments
 (0)