diff --git a/auth/middleware.go b/auth/middleware.go index 4f1de80b46c95e43984c631c2a38d6dab89da36a..fb4b235df5afe74ea504c557b66594945a0ac950 100644 --- a/auth/middleware.go +++ b/auth/middleware.go @@ -38,14 +38,10 @@ oauth2BearerRegex = regexp.MustCompile(`^[0-9a-zA-Z_+/]{33,}$`) ) const ( - USER_UNCONFIRMED = "UNCONFIRMED" - USER_ACTIVE_NON_PAYING = "ACTIVE_NON_PAYING" - USER_ACTIVE_FREE = "ACTIVE_FREE" - USER_ACTIVE_PAYING = "ACTIVE_PAYING" - USER_ACTIVE_DELINQUENT = "ACTIVE_DELINQUENT" - USER_ADMIN = "ADMIN" - USER_UNKNOWN = "UNKNOWN" - USER_SUSPENDED = "SUSPENDED" + USER_TYPE_PENDING = "UNCONFIRMED" + USER_TYPE_USER = "ACTIVE_NON_PAYING" + USER_TYPE_ADMIN = "ADMIN" + USER_TYPE_SUSPENDED = "SUSPENDED" ) const ( @@ -132,7 +128,7 @@ if err := LookupUser(ctx, username, &auth); err != nil { return nil, err } - if auth.UserType == USER_SUSPENDED { + if auth.UserType == USER_TYPE_SUSPENDED { return nil, fmt.Errorf( "Account suspended with the following notice: %s\nContact support", *auth.SuspensionNotice) @@ -193,7 +189,7 @@ }); err != nil { return nil, err } - if auth.UserType == USER_SUSPENDED { + if auth.UserType == USER_TYPE_SUSPENDED { return nil, fmt.Errorf( "Account suspended with the following notice: %s\nContact support", *auth.SuspensionNotice) @@ -555,7 +551,7 @@ } return } - if auth.UserType == USER_SUSPENDED { + if auth.UserType == USER_TYPE_SUSPENDED { authError(w, fmt.Sprintf( "Account suspended with the following notice: %s\nContact support", *auth.SuspensionNotice), http.StatusForbidden) @@ -644,7 +640,7 @@ authError(w, "Invalid or expired OAuth token", http.StatusForbidden) return } - if auth.UserType == USER_SUSPENDED { + if auth.UserType == USER_TYPE_SUSPENDED { authError(w, fmt.Sprintf( "Account suspended with the following notice: %s\nContact support", *auth.SuspensionNotice), http.StatusForbidden)