Compare commits
1 Commits
case-insen
...
update-git
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d314ed4a16 |
4
server/.gitignore
vendored
4
server/.gitignore
vendored
@@ -12,6 +12,10 @@
|
|||||||
*.out
|
*.out
|
||||||
*.db
|
*.db
|
||||||
|
|
||||||
|
# MS VSCode
|
||||||
|
.vscode
|
||||||
|
__debug_bin
|
||||||
|
|
||||||
# Dependency directories (remove the comment below to include it)
|
# Dependency directories (remove the comment below to include it)
|
||||||
# vendor/
|
# vendor/
|
||||||
assets/*
|
assets/*
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/common"
|
"github.com/akhilrex/hammond/common"
|
||||||
"github.com/akhilrex/hammond/db"
|
"github.com/akhilrex/hammond/db"
|
||||||
@@ -92,7 +91,7 @@ func userLogin(c *gin.Context) {
|
|||||||
c.JSON(http.StatusUnprocessableEntity, common.NewValidatorError(err))
|
c.JSON(http.StatusUnprocessableEntity, common.NewValidatorError(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
user, err := db.FindOneUser(&db.User{Email: strings.ToLower(loginRequest.Email)})
|
user, err := db.FindOneUser(&db.User{Email: loginRequest.Email})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusForbidden, common.NewError("login", errors.New("Not Registered email or invalid password")))
|
c.JSON(http.StatusForbidden, common.NewError("login", errors.New("Not Registered email or invalid password")))
|
||||||
|
|||||||
@@ -18,10 +18,6 @@ var migrations = []localMigration{
|
|||||||
Name: "2021_06_24_04_42_SetUserDisabledFalse",
|
Name: "2021_06_24_04_42_SetUserDisabledFalse",
|
||||||
Query: "update users set is_disabled=0",
|
Query: "update users set is_disabled=0",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "2021_02_07_00_09_LowerCaseEmails",
|
|
||||||
Query: "update users set email=lower(email)",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func RunMigrations() {
|
func RunMigrations() {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/akhilrex/hammond/db"
|
"github.com/akhilrex/hammond/db"
|
||||||
"github.com/akhilrex/hammond/models"
|
"github.com/akhilrex/hammond/models"
|
||||||
)
|
)
|
||||||
@@ -10,7 +8,7 @@ import (
|
|||||||
func CreateUser(userModel *models.RegisterRequest, role db.Role) error {
|
func CreateUser(userModel *models.RegisterRequest, role db.Role) error {
|
||||||
setting := db.GetOrCreateSetting()
|
setting := db.GetOrCreateSetting()
|
||||||
toCreate := db.User{
|
toCreate := db.User{
|
||||||
Email: strings.ToLower(userModel.Email),
|
Email: userModel.Email,
|
||||||
Name: userModel.Name,
|
Name: userModel.Name,
|
||||||
Role: role,
|
Role: role,
|
||||||
Currency: setting.Currency,
|
Currency: setting.Currency,
|
||||||
|
|||||||
Reference in New Issue
Block a user