sample users admin

This commit is contained in:
Zeni Kim 2024-12-04 08:39:08 -05:00
parent 19c24593fe
commit 0f520e67af
9 changed files with 488 additions and 3 deletions

View file

@ -26,6 +26,7 @@ import (
func Signup(c *core.Context) *core.Response {
name := c.GetRequestParam("name")
fullname := c.GetRequestParam("fullname")
email := c.GetRequestParam("email")
password := c.GetRequestParam("password")
// check if email exists
@ -46,12 +47,14 @@ func Signup(c *core.Context) *core.Response {
// validation data
data := map[string]interface{}{
"name": name,
"fullname": fullname,
"email": email,
"password": password,
}
// validation rules
rules := map[string]interface{}{
"name": "required|alphaNumeric",
"fullname": "fullname|alphaNumeric",
"email": "required|email",
"password": "required|length:6,10",
}
@ -73,6 +76,7 @@ func Signup(c *core.Context) *core.Response {
// store the record in db
user = models.User{
Name: c.CastToString(name),
Fullname: c.CastToString(fullname),
Email: c.CastToString(email),
Password: passwordHashed,
}