mirror of
https://github.com/volatiletech/authboss.git
synced 2025-02-03 13:21:22 +02:00
Redundant types in composite literals
This commit is contained in:
parent
4d85b23e8a
commit
827256e4d7
@ -55,7 +55,7 @@ func TestAuthbossMiddleware(t *testing.T) {
|
||||
ab.Core.Logger = mockLogger{}
|
||||
ab.Storage.Server = &mockServerStorer{
|
||||
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.Server = &mockServerStorer{
|
||||
Users: map[string]*mockUser{
|
||||
"george-pid": &mockUser{Email: "george-pid", Password: "unreadable"},
|
||||
"george-pid": {Email: "george-pid", Password: "unreadable"},
|
||||
},
|
||||
}
|
||||
r := httptest.NewRequest("GET", "/", nil)
|
||||
|
@ -15,11 +15,11 @@ func TestValidate(t *testing.T) {
|
||||
"email": "john@john.com",
|
||||
},
|
||||
Ruleset: []Rules{
|
||||
Rules{
|
||||
{
|
||||
FieldName: "username",
|
||||
MinLength: 5,
|
||||
},
|
||||
Rules{
|
||||
{
|
||||
FieldName: "missing_field",
|
||||
Required: true,
|
||||
},
|
||||
|
@ -204,7 +204,7 @@ func NewHTTPBodyReader(readJSON, useUsernameNotEmail bool) *HTTPBodyReader {
|
||||
"recover_end": {FormValuePassword, authboss.ConfirmPrefix + FormValuePassword},
|
||||
},
|
||||
Whitelist: map[string][]string{
|
||||
"register": []string{FormValueEmail, FormValuePassword},
|
||||
"register": {FormValueEmail, FormValuePassword},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ func TestModuleLoadedMiddleware(t *testing.T) {
|
||||
"oauth2": nil,
|
||||
}
|
||||
ab.Config.Modules.OAuth2Providers = map[string]OAuth2Provider{
|
||||
"google": OAuth2Provider{},
|
||||
"google": {},
|
||||
}
|
||||
|
||||
var mods map[string]bool
|
||||
|
@ -23,7 +23,7 @@ func init() {
|
||||
}
|
||||
|
||||
var testProviders = map[string]authboss.OAuth2Provider{
|
||||
"google": authboss.OAuth2Provider{
|
||||
"google": {
|
||||
OAuth2Config: &oauth2.Config{
|
||||
ClientID: `jazz`,
|
||||
ClientSecret: `hands`,
|
||||
@ -35,7 +35,7 @@ var testProviders = map[string]authboss.OAuth2Provider{
|
||||
FindUserDetails: GoogleUserDetails,
|
||||
AdditionalParams: url.Values{"include_requested_scopes": []string{"true"}},
|
||||
},
|
||||
"facebook": authboss.OAuth2Provider{
|
||||
"facebook": {
|
||||
OAuth2Config: &oauth2.Config{
|
||||
ClientID: `jazz`,
|
||||
ClientSecret: `hands`,
|
||||
|
@ -263,7 +263,7 @@ func (s *SMS) PostSetup(w http.ResponseWriter, r *http.Request) error {
|
||||
number := smsVals.GetPhoneNumber()
|
||||
if len(number) == 0 {
|
||||
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)
|
||||
}
|
||||
@ -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())
|
||||
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)
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ func (t *TOTP) PostConfirm(w http.ResponseWriter, r *http.Request) error {
|
||||
ok = totp.Validate(inputCode, totpSecret)
|
||||
if !ok {
|
||||
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,
|
||||
}
|
||||
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
|
||||
case !ok:
|
||||
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)
|
||||
}
|
||||
@ -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())
|
||||
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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user