This commit is contained in:
Deluan
2016-02-25 18:52:07 -05:00
parent a1829d432a
commit e760952263
17 changed files with 40 additions and 59 deletions
+4 -4
View File
@@ -19,9 +19,9 @@ func Validate(controller ControllerInterface) {
}
func checkParameters(c ControllerInterface) {
requiredParameters := []string {"u", "p", "v", "c",}
requiredParameters := []string{"u", "p", "v", "c"}
for _,p := range requiredParameters {
for _, p := range requiredParameters {
if c.GetString(p) == "" {
cancel(c, responses.ERROR_MISSING_PARAMETER)
}
@@ -31,11 +31,11 @@ func checkParameters(c ControllerInterface) {
func authenticate(c ControllerInterface) {
user := c.GetString("u")
pass := c.GetString("p") // TODO Handle hex-encoded password
if (user != beego.AppConfig.String("user") || pass != beego.AppConfig.String("password")) {
if user != beego.AppConfig.String("user") || pass != beego.AppConfig.String("password") {
cancel(c, responses.ERROR_AUTHENTICATION_FAIL)
}
}
func cancel(c ControllerInterface, code int) {
c.CustomAbort(200, string(responses.NewError(code)))
}
}