Сравнить коммиты

..

4 Коммитов

Автор SHA1 Сообщение Дата
vilmibm
3d877ea184 switch to crypto/rand 2023-03-10 03:21:26 +00:00
vilmibm
9353e3f414 fix email 2023-03-10 03:21:12 +00:00
vilmibm
9b1143e18d fix issue where msgScroll did not scroll 2023-03-10 03:21:01 +00:00
vilmibm
96d487ede2 wording 2023-03-10 03:20:50 +00:00
4 изменённых файлов: 12 добавлений и 9 удалений

Просмотреть файл

@ -21,12 +21,8 @@ ssh welcome@tilde.town
You'll fill in details like your desired username and SSH public key. You'll fill in details like your desired username and SSH public key.
If you're brand new to SSH or have never heard of it that is okay!
This page has information on what SSH is and how to use it, including how to create an ssh key pair which you'll need to access your town account: https://tilde.town/wiki/getting-started/ssh.html This page has information on what SSH is and how to use it, including how to create an ssh key pair which you'll need to access your town account: https://tilde.town/wiki/getting-started/ssh.html
If you run into confusion or problems creating a key pair on your computer, this page can generate one for you: https://tilde.town/keymachine . However you'll still need to save the generated key files to your computer in order to use them.
If you end up stuck, e-mail root@tilde.town with any questions. If you end up stuck, e-mail root@tilde.town with any questions.
See you on the server, See you on the server,

Просмотреть файл

@ -321,6 +321,7 @@ func _main(l *log.Logger, db *sql.DB) error {
} }
fmt.Fprintln(msgScroll, player.Say(msg)) fmt.Fprintln(msgScroll, player.Say(msg))
fmt.Fprintln(sm.Current.Input, msg) fmt.Fprintln(sm.Current.Input, msg)
msgScroll.ScrollToEnd()
} }
defer func() { defer func() {

Просмотреть файл

@ -74,7 +74,7 @@ func (m *ExternalMailer) Send(address, subject, body string) error {
return fmt.Errorf("auth failed for smtp: %w", err) return fmt.Errorf("auth failed for smtp: %w", err)
} }
if err = c.Mail("root@tilde.town"); err != nil { if err = c.Mail(from); err != nil {
return err return err
} }
@ -87,7 +87,7 @@ func (m *ExternalMailer) Send(address, subject, body string) error {
return err return err
} }
_, err = w.Write([]byte(body)) _, err = w.Write([]byte(message))
if err != nil { if err != nil {
return err return err
} }

Просмотреть файл

@ -1,10 +1,11 @@
package invites package invites
import ( import (
"crypto/rand"
"database/sql" "database/sql"
"encoding/base64" "encoding/base64"
"errors" "errors"
"math/rand" "math/big"
"strings" "strings"
"time" "time"
@ -53,7 +54,6 @@ func ConnectDB() (*sql.DB, error) {
} }
func generateCode(email string) string { func generateCode(email string) string {
rand.Seed(time.Now().Unix())
charset := "abcdefghijklmnopqrztuvwxyz" charset := "abcdefghijklmnopqrztuvwxyz"
charset += strings.ToUpper(charset) charset += strings.ToUpper(charset)
@ -62,8 +62,14 @@ func generateCode(email string) string {
code := []byte{} code := []byte{}
max := big.NewInt(int64(len(charset)))
for len(code) < codeLen { for len(code) < codeLen {
code = append(code, charset[rand.Intn(len(charset))]) ix, err := rand.Int(rand.Reader, max)
if err != nil {
// TODO this is bad but I'm just kind of hoping it doesn't happen...often
panic(err)
}
code = append(code, charset[ix.Int64()])
} }
code = append(code, ' ') code = append(code, ' ')