Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/site/src/components/login/auth-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function UserAuthForm({
return
}
const { password, passwordConfirm } = result.output
email = result.output.email
email = result.output.email.toLowerCase()
if (isFirstRun) {
// check that passwords match
if (password !== passwordConfirm) {
Expand Down
6 changes: 4 additions & 2 deletions internal/users/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package users
import (
"log"
"net/http"
"strings"

"github.com/henrygd/beszel/internal/migrations"

Expand Down Expand Up @@ -83,7 +84,8 @@ func (um *UserManager) CreateFirstUser(e *core.RequestEvent) error {

collection, _ := um.app.FindCollectionByNameOrId("users")
user := core.NewRecord(collection)
user.SetEmail(data.Email)
email := strings.ToLower(data.Email)
user.SetEmail(email)
user.SetPassword(data.Password)
user.Set("role", "admin")
user.Set("verified", true)
Expand All @@ -93,7 +95,7 @@ func (um *UserManager) CreateFirstUser(e *core.RequestEvent) error {
// create superuser using the email of the first user
collection, _ = um.app.FindCollectionByNameOrId(core.CollectionNameSuperusers)
adminUser := core.NewRecord(collection)
adminUser.SetEmail(data.Email)
adminUser.SetEmail(email)
adminUser.SetPassword(data.Password)
if err := um.app.Save(adminUser); err != nil {
return e.JSON(http.StatusInternalServerError, map[string]string{"err": err.Error()})
Expand Down