Format all source files.
This commit is contained in:
parent
f7ad8b9c5f
commit
fa89e0719f
7 changed files with 142 additions and 138 deletions
|
|
@ -15,9 +15,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/Gleipnir-Technology/arcgis-go"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/models"
|
||||
"github.com/aarondl/opt/omit"
|
||||
)
|
||||
|
||||
var CodeVerifier string = "random_secure_string_min_43_chars_long_should_be_stored_in_session"
|
||||
|
|
@ -78,7 +78,7 @@ func getArcgisUserData(access_token string, expires time.Time, refresh_token str
|
|||
slog.Info("Got portals data",
|
||||
slog.String("Username", portal.User.Username),
|
||||
slog.String("ID", portal.ID))
|
||||
*/
|
||||
*/
|
||||
search, err := client.Search("Fieldseeker")
|
||||
if err != nil {
|
||||
slog.Error("Failed to get search FieldseekerGIS data", slog.String("err", err.Error()))
|
||||
|
|
|
|||
5
auth.go
5
auth.go
|
|
@ -8,20 +8,23 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/aarondl/opt/omit"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/enums"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/sql"
|
||||
"github.com/aarondl/opt/omit"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
type NoCredentialsError struct{}
|
||||
|
||||
func (e NoCredentialsError) Error() string { return "No credentials were present in the request" }
|
||||
|
||||
type InvalidCredentials struct{}
|
||||
|
||||
func (e InvalidCredentials) Error() string { return "No username with that password exists" }
|
||||
|
||||
type InvalidUsername struct{}
|
||||
|
||||
func (e InvalidUsername) Error() string { return "That username doesn't exist" }
|
||||
|
||||
func addUserSession(r *http.Request, user *models.User) {
|
||||
|
|
|
|||
|
|
@ -198,7 +198,6 @@ func postSignin(w http.ResponseWriter, r *http.Request) {
|
|||
slog.String("username", username),
|
||||
slog.String("password", strings.Repeat("*", len(password))))
|
||||
|
||||
|
||||
_, err := signinUser(r, username, password)
|
||||
if err != nil {
|
||||
if errors.Is(err, InvalidCredentials{}) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
|
|
@ -68,6 +69,7 @@ func FileServer(r chi.Router, path string, root http.FileSystem, embeddedFS embe
|
|||
fileToServe.Close()
|
||||
})
|
||||
}
|
||||
|
||||
type embeddedFileWrapper struct {
|
||||
file fs.File
|
||||
}
|
||||
|
|
|
|||
9
html.go
9
html.go
|
|
@ -9,8 +9,8 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/riverqueue/river/rivershared/util/slogutil"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/models"
|
||||
"github.com/riverqueue/river/rivershared/util/slogutil"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -25,7 +25,7 @@ var (
|
|||
signin = newBuiltTemplate("signin", "base")
|
||||
signup = newBuiltTemplate("signup", "base")
|
||||
)
|
||||
var components = [ ... ]string{"header"}
|
||||
var components = [...]string{"header"}
|
||||
|
||||
type BuiltTemplate struct {
|
||||
files []string
|
||||
|
|
@ -51,7 +51,7 @@ type ContentPlaceholder struct {
|
|||
type ContentSignin struct {
|
||||
InvalidCredentials bool
|
||||
}
|
||||
type ContentSignup struct { }
|
||||
type ContentSignup struct{}
|
||||
type User struct {
|
||||
DisplayName string
|
||||
Initials string
|
||||
|
|
@ -164,8 +164,7 @@ func htmlSignin(w io.Writer, errorCode string) error {
|
|||
}
|
||||
|
||||
func htmlSignup(w io.Writer, path string) error {
|
||||
data := ContentSignup{
|
||||
}
|
||||
data := ContentSignup{}
|
||||
return signup.ExecuteTemplate(w, data)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue