mirror of
https://github.com/volatiletech/authboss.git
synced 2025-07-17 01:32:24 +02:00
Redundant types in composite literals
This commit is contained in:
@ -55,7 +55,7 @@ func TestAuthbossMiddleware(t *testing.T) {
|
|||||||
ab.Core.Logger = mockLogger{}
|
ab.Core.Logger = mockLogger{}
|
||||||
ab.Storage.Server = &mockServerStorer{
|
ab.Storage.Server = &mockServerStorer{
|
||||||
Users: map[string]*mockUser{
|
Users: map[string]*mockUser{
|
||||||
"test@test.com": &mockUser{},
|
"test@test.com": {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ func testSetupContext() (*Authboss, *http.Request) {
|
|||||||
ab.Storage.SessionState = newMockClientStateRW(SessionKey, "george-pid")
|
ab.Storage.SessionState = newMockClientStateRW(SessionKey, "george-pid")
|
||||||
ab.Storage.Server = &mockServerStorer{
|
ab.Storage.Server = &mockServerStorer{
|
||||||
Users: map[string]*mockUser{
|
Users: map[string]*mockUser{
|
||||||
"george-pid": &mockUser{Email: "george-pid", Password: "unreadable"},
|
"george-pid": {Email: "george-pid", Password: "unreadable"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
r := httptest.NewRequest("GET", "/", nil)
|
r := httptest.NewRequest("GET", "/", nil)
|
||||||
|
@ -15,11 +15,11 @@ func TestValidate(t *testing.T) {
|
|||||||
"email": "john@john.com",
|
"email": "john@john.com",
|
||||||
},
|
},
|
||||||
Ruleset: []Rules{
|
Ruleset: []Rules{
|
||||||
Rules{
|
{
|
||||||
FieldName: "username",
|
FieldName: "username",
|
||||||
MinLength: 5,
|
MinLength: 5,
|
||||||
},
|
},
|
||||||
Rules{
|
{
|
||||||
FieldName: "missing_field",
|
FieldName: "missing_field",
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
|
@ -204,7 +204,7 @@ func NewHTTPBodyReader(readJSON, useUsernameNotEmail bool) *HTTPBodyReader {
|
|||||||
"recover_end": {FormValuePassword, authboss.ConfirmPrefix + FormValuePassword},
|
"recover_end": {FormValuePassword, authboss.ConfirmPrefix + FormValuePassword},
|
||||||
},
|
},
|
||||||
Whitelist: map[string][]string{
|
Whitelist: map[string][]string{
|
||||||
"register": []string{FormValueEmail, FormValuePassword},
|
"register": {FormValueEmail, FormValuePassword},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ func TestModuleLoadedMiddleware(t *testing.T) {
|
|||||||
"oauth2": nil,
|
"oauth2": nil,
|
||||||
}
|
}
|
||||||
ab.Config.Modules.OAuth2Providers = map[string]OAuth2Provider{
|
ab.Config.Modules.OAuth2Providers = map[string]OAuth2Provider{
|
||||||
"google": OAuth2Provider{},
|
"google": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
var mods map[string]bool
|
var mods map[string]bool
|
||||||
|
@ -23,7 +23,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var testProviders = map[string]authboss.OAuth2Provider{
|
var testProviders = map[string]authboss.OAuth2Provider{
|
||||||
"google": authboss.OAuth2Provider{
|
"google": {
|
||||||
OAuth2Config: &oauth2.Config{
|
OAuth2Config: &oauth2.Config{
|
||||||
ClientID: `jazz`,
|
ClientID: `jazz`,
|
||||||
ClientSecret: `hands`,
|
ClientSecret: `hands`,
|
||||||
@ -35,7 +35,7 @@ var testProviders = map[string]authboss.OAuth2Provider{
|
|||||||
FindUserDetails: GoogleUserDetails,
|
FindUserDetails: GoogleUserDetails,
|
||||||
AdditionalParams: url.Values{"include_requested_scopes": []string{"true"}},
|
AdditionalParams: url.Values{"include_requested_scopes": []string{"true"}},
|
||||||
},
|
},
|
||||||
"facebook": authboss.OAuth2Provider{
|
"facebook": {
|
||||||
OAuth2Config: &oauth2.Config{
|
OAuth2Config: &oauth2.Config{
|
||||||
ClientID: `jazz`,
|
ClientID: `jazz`,
|
||||||
ClientSecret: `hands`,
|
ClientSecret: `hands`,
|
||||||
|
@ -263,7 +263,7 @@ func (s *SMS) PostSetup(w http.ResponseWriter, r *http.Request) error {
|
|||||||
number := smsVals.GetPhoneNumber()
|
number := smsVals.GetPhoneNumber()
|
||||||
if len(number) == 0 {
|
if len(number) == 0 {
|
||||||
data := authboss.HTMLData{
|
data := authboss.HTMLData{
|
||||||
authboss.DataValidation: map[string][]string{FormValuePhoneNumber: []string{"must provide a phone number"}},
|
authboss.DataValidation: map[string][]string{FormValuePhoneNumber: {"must provide a phone number"}},
|
||||||
}
|
}
|
||||||
return s.Core.Responder.Respond(w, r, http.StatusOK, PageSMSSetup, data)
|
return s.Core.Responder.Respond(w, r, http.StatusOK, PageSMSSetup, data)
|
||||||
}
|
}
|
||||||
@ -401,7 +401,7 @@ func (s *SMSValidator) validateCode(w http.ResponseWriter, r *http.Request, user
|
|||||||
|
|
||||||
logger.Infof("user %s sms 2fa failure (wrong code)", user.GetPID())
|
logger.Infof("user %s sms 2fa failure (wrong code)", user.GetPID())
|
||||||
data := authboss.HTMLData{
|
data := authboss.HTMLData{
|
||||||
authboss.DataValidation: map[string][]string{FormValueCode: []string{"2fa code was invalid"}},
|
authboss.DataValidation: map[string][]string{FormValueCode: {"2fa code was invalid"}},
|
||||||
}
|
}
|
||||||
return s.Authboss.Core.Responder.Respond(w, r, http.StatusOK, s.Page, data)
|
return s.Authboss.Core.Responder.Respond(w, r, http.StatusOK, s.Page, data)
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ func (t *TOTP) PostConfirm(w http.ResponseWriter, r *http.Request) error {
|
|||||||
ok = totp.Validate(inputCode, totpSecret)
|
ok = totp.Validate(inputCode, totpSecret)
|
||||||
if !ok {
|
if !ok {
|
||||||
data := authboss.HTMLData{
|
data := authboss.HTMLData{
|
||||||
authboss.DataValidation: map[string][]string{FormValueCode: []string{"2fa code was invalid"}},
|
authboss.DataValidation: map[string][]string{FormValueCode: {"2fa code was invalid"}},
|
||||||
DataTOTPSecret: totpSecret,
|
DataTOTPSecret: totpSecret,
|
||||||
}
|
}
|
||||||
return t.Authboss.Core.Responder.Respond(w, r, http.StatusOK, PageTOTPConfirm, data)
|
return t.Authboss.Core.Responder.Respond(w, r, http.StatusOK, PageTOTPConfirm, data)
|
||||||
@ -310,7 +310,7 @@ func (t *TOTP) PostRemove(w http.ResponseWriter, r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
case !ok:
|
case !ok:
|
||||||
data := authboss.HTMLData{
|
data := authboss.HTMLData{
|
||||||
authboss.DataValidation: map[string][]string{FormValueCode: []string{"2fa code was invalid"}},
|
authboss.DataValidation: map[string][]string{FormValueCode: {"2fa code was invalid"}},
|
||||||
}
|
}
|
||||||
return t.Authboss.Core.Responder.Respond(w, r, http.StatusOK, PageTOTPRemove, data)
|
return t.Authboss.Core.Responder.Respond(w, r, http.StatusOK, PageTOTPRemove, data)
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ func (t *TOTP) PostValidate(w http.ResponseWriter, r *http.Request) error {
|
|||||||
|
|
||||||
logger.Infof("user %s totp 2fa failure (wrong code)", user.GetPID())
|
logger.Infof("user %s totp 2fa failure (wrong code)", user.GetPID())
|
||||||
data := authboss.HTMLData{
|
data := authboss.HTMLData{
|
||||||
authboss.DataValidation: map[string][]string{FormValueCode: []string{"2fa code was invalid"}},
|
authboss.DataValidation: map[string][]string{FormValueCode: {"2fa code was invalid"}},
|
||||||
}
|
}
|
||||||
return t.Authboss.Core.Responder.Respond(w, r, http.StatusOK, PageTOTPValidate, data)
|
return t.Authboss.Core.Responder.Respond(w, r, http.StatusOK, PageTOTPValidate, data)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user