Commit c89216a4 authored by Lukas Böhm's avatar Lukas Böhm 🎱
Browse files

typos

parent 6a9de978
......@@ -80,10 +80,10 @@ func GetShare(w http.ResponseWriter, r *http.Request) *HTTPError {
if share.Password != "" {
sid, pass, _ := r.BasicAuth()
if sid != share.ID.String() {
return &HTTPError{errors.New("Unauthorized"), "wrong username", 401}
return &HTTPError{errors.New("unauthorized"), "wrong username", 401}
}
if pass != share.Password {
return &HTTPError{errors.New("Unauthorized"), "wrong password", 401}
return &HTTPError{errors.New("unauthorized"), "wrong password", 401}
}
}
......@@ -130,10 +130,10 @@ func DownloadFile(w http.ResponseWriter, r *http.Request) *HTTPError {
if share.Password != "" {
sid, pass, _ := r.BasicAuth()
if sid != share.ID.String() {
return &HTTPError{errors.New("Unauthorized"), "wrong username", 401}
return &HTTPError{errors.New("unauthorized"), "wrong username", 401}
}
if pass != share.Password {
return &HTTPError{errors.New("Unauthorized"), "wrong password", 401}
return &HTTPError{errors.New("unauthorized"), "wrong password", 401}
}
}
......@@ -211,8 +211,9 @@ func CloseShare(w http.ResponseWriter, r *http.Request) *HTTPError {
return &HTTPError{err, "Can't edit data", 500}
}
// TODO background job
// TODO send mail
// TODO background job
//{
// job, err := enqueuer.Enqueue("DeleteShare", nil)
// ////deleteIn := time.Now().Sub(*share.Expires)
......@@ -355,7 +356,7 @@ func DownloadZip(w http.ResponseWriter, r *http.Request) *HTTPError {
/////////////////////////////////
////////// functions ////////////
/////////////////////////////////
func RetrieveShare(shareID uuid.UUID, withAtt bool) (*Share, *HTTPError) {
func RetrieveShare(shareID uuid.UUID, withAtt bool) (*Share, *HTTPError) { // TODO move somewhere else
db, err := GetDatabase()
if err != nil {
return nil, &HTTPError{err, "Can't get database", 500}
......
......@@ -3,14 +3,13 @@
package main
import (
"fmt"
"os"
"github.com/sendgrid/sendgrid-go"
"github.com/sendgrid/sendgrid-go/helpers/mail"
)
func SendMail(sh Share) {
func SendMail(sh Share) error {
m := mail.NewV3Mail()
m.SetFrom(mail.NewEmail(os.Getenv("SENDGRID_SENDER_NAME"), os.Getenv("SENDGRID_SENDER_MAIL")))
m.SetTemplateID(os.Getenv("SENDGRID_SHARE_TEMPLATE"))
......@@ -28,7 +27,5 @@ func SendMail(sh Share) {
request.Method = "POST"
request.Body = mail.GetRequestBody(m)
_, err := sendgrid.API(request)
if err != nil {
fmt.Println(err)
}
return err
}
......@@ -29,7 +29,7 @@ func main() {
// start
fmt.Println("Let's go!!!")
ConfigureRoutes()
ConfigurePool()
//ConfigurePool()
}
func PrettyPrint(i interface{}) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment