update/better-logic
This commit is contained in:
1 parent
592cedc276
commit
325c842230
4 files changed
+59
-26
No files matched your search
@@ -16,6 +16,7 @@ type Admin struct {
|
||||
FirstName string `json:"firstname" validate:"required"`
|
||||
LastName string `json:"lastname" validate:"required"`
|
||||
Email string `json:"email" validate:"required"`
|
||||
SchoolEmail string `json:"schoolemail"`
|
||||
Password string `json:"-" validate:"min=10,max=32"`
|
||||
TempPassword bool `json:"temppassword"`
|
||||
AID string `json:"aid"`
|
||||
@@ -23,6 +24,12 @@ type Admin struct {
|
||||
Updated_at time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
func (a *Admin) GenerateSchoolEmail() string {
|
||||
var email string = strings.ToLower(a.LastName) + "_" + strings.ToLower(string(a.FirstName[0])) + "@surreyschools.ca"
|
||||
// Add check to see if email already exists
|
||||
return email
|
||||
}
|
||||
|
||||
func (s *Admin) HashPassword(password string) string {
|
||||
hash, _ := bcrypt.GenerateFromPassword([]byte(password), 14)
|
||||
return string(hash)
|
||||
|
||||
Reference in new issue
Block a user