check user returns user type, when applicable
parent
918f05b649
commit
ede08cee1f
|
|
@ -214,19 +214,23 @@ func Checkuser(c *fiber.Ctx) error {
|
||||||
// The user is found; let's signalize this
|
// The user is found; let's signalize this
|
||||||
response.Type = "U" // At first sight it's a user
|
response.Type = "U" // At first sight it's a user
|
||||||
|
|
||||||
|
// TODO: Verify the user's type (Admin, User, Social, etc.)
|
||||||
|
|
||||||
if user.Channel == "" {
|
if user.Channel == "" {
|
||||||
// User needs to complete the registration
|
// User needs to complete the registration
|
||||||
response.Type = "RU"
|
response.Type = "RU"
|
||||||
}
|
} else {
|
||||||
|
if user.Blocked == "S" {
|
||||||
if user.Blocked == "S" {
|
// User is blocked
|
||||||
// User is blocked
|
response.Type = "UB"
|
||||||
response.Type = "UB"
|
} else {
|
||||||
}
|
if user.Cancelled == "S" {
|
||||||
|
// User is cancelled
|
||||||
if user.Cancelled == "S" {
|
response.Type = "UC"
|
||||||
// User is cancelled
|
} else {
|
||||||
response.Type = "UC"
|
response.Type = user.UserType
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ type User struct {
|
||||||
Channel string `gorm:"size:40" json:"channel"`
|
Channel string `gorm:"size:40" json:"channel"`
|
||||||
Url string `gorm:"size:40" json:"url"`
|
Url string `gorm:"size:40" json:"url"`
|
||||||
CpfCnpj string `gorm:"size:20" json:"cpfcnpj"`
|
CpfCnpj string `gorm:"size:20" json:"cpfcnpj"`
|
||||||
UserType string `gorm:"size:1;default:U" json:"usertype"`
|
UserType string `gorm:"size:1;default:U" json:"usertype"` // A - Admin, U - User, S - Social
|
||||||
Blocked string `gorm:"size:1;default:N" json:"blocked"`
|
Blocked string `gorm:"size:1;default:N" json:"blocked"`
|
||||||
Cancelled string `gorm:"size:1;default:N" json:"cancelled"`
|
Cancelled string `gorm:"size:1;default:N" json:"cancelled"`
|
||||||
ServerId uint `gorm:"not null;default:1" json:"serverid"`
|
ServerId uint `gorm:"not null;default:1" json:"serverid"`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue