refactor validation and add admin system
This commit is contained in:
20
handler/utilities/utilities.go
Normal file
20
handler/utilities/utilities.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package utilities
|
||||
|
||||
import "fmt"
|
||||
|
||||
func ValidateUsername(username string) error {
|
||||
if username == "" {
|
||||
return fmt.Errorf("please enter the username")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidatePasswords(pOne, pTwo string) error {
|
||||
if pOne == "" || pTwo == "" {
|
||||
return fmt.Errorf("please enter the password twice")
|
||||
}
|
||||
if !(pOne == pTwo) {
|
||||
return fmt.Errorf("the two passwords entered were not the same")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user