forked from goffee/cup
sample users admin
This commit is contained in:
parent
19c24593fe
commit
0f520e67af
9 changed files with 488 additions and 3 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue