Apply go fmt

Signed-off-by: prichier <pascoualito@gmail.com>
This commit is contained in:
Keturah Dola-Borg 2020-03-27 22:18:52 -07:00 committed by prichier
parent 630ac1f7c0
commit 7b71d455a8
4 changed files with 30 additions and 30 deletions

View File

@ -66,7 +66,7 @@ func NewUserPage(app *App, r *http.Request, u *User, title string, flashes []str
} }
func canUserInvite(cfg *config.Config, isAdmin bool) bool { func canUserInvite(cfg *config.Config, isAdmin bool) bool {
return cfg.App.UserInvites != "" && return cfg.App.UserInvites != "" &&
(isAdmin || cfg.App.UserInvites != "admin") (isAdmin || cfg.App.UserInvites != "admin")
} }
@ -306,8 +306,8 @@ func viewLogin(app *App, w http.ResponseWriter, r *http.Request) error {
OauthSlack bool OauthSlack bool
OauthWriteAs bool OauthWriteAs bool
OauthGitlab bool OauthGitlab bool
OauthGeneric bool OauthGeneric bool
OauthGenericDisplayName string OauthGenericDisplayName string
GitlabDisplayName string GitlabDisplayName string
}{ }{
pageForReq(app, r), pageForReq(app, r),
@ -318,8 +318,8 @@ func viewLogin(app *App, w http.ResponseWriter, r *http.Request) error {
app.Config().SlackOauth.ClientID != "", app.Config().SlackOauth.ClientID != "",
app.Config().WriteAsOauth.ClientID != "", app.Config().WriteAsOauth.ClientID != "",
app.Config().GitlabOauth.ClientID != "", app.Config().GitlabOauth.ClientID != "",
app.Config().GenericOauth.ClientID != "", app.Config().GenericOauth.ClientID != "",
config.OrDefaultString(app.Config().GenericOauth.DisplayName, genericOauthDisplayName), config.OrDefaultString(app.Config().GenericOauth.DisplayName, genericOauthDisplayName),
config.OrDefaultString(app.Config().GitlabOauth.DisplayName, gitlabDisplayName), config.OrDefaultString(app.Config().GitlabOauth.DisplayName, gitlabDisplayName),
} }

View File

@ -236,31 +236,31 @@ func configureGitlabOauth(parentHandler *Handler, r *mux.Router, app *App) {
} }
func configureGenericOauth(parentHandler *Handler, r *mux.Router, app *App) { func configureGenericOauth(parentHandler *Handler, r *mux.Router, app *App) {
if app.Config().GenericOauth.ClientID != "" { if app.Config().GenericOauth.ClientID != "" {
callbackLocation := app.Config().App.Host + "/oauth/callback/generic" callbackLocation := app.Config().App.Host + "/oauth/callback/generic"
var callbackProxy *callbackProxyClient = nil var callbackProxy *callbackProxyClient = nil
if app.Config().GenericOauth.CallbackProxy != "" { if app.Config().GenericOauth.CallbackProxy != "" {
callbackProxy = &callbackProxyClient { callbackProxy = &callbackProxyClient{
server: app.Config().GenericOauth.CallbackProxyAPI, server: app.Config().GenericOauth.CallbackProxyAPI,
callbackLocation: app.Config().App.Host + "/oauth/callback/generic", callbackLocation: app.Config().App.Host + "/oauth/callback/generic",
httpClient: config.DefaultHTTPClient(), httpClient: config.DefaultHTTPClient(),
} }
callbackLocation = app.Config().GenericOauth.CallbackProxy callbackLocation = app.Config().GenericOauth.CallbackProxy
} }
address := app.Config().GenericOauth.Host address := app.Config().GenericOauth.Host
oauthClient := genericOauthClient{ oauthClient := genericOauthClient{
ClientID: app.Config().GenericOauth.ClientID, ClientID: app.Config().GenericOauth.ClientID,
ClientSecret: app.Config().GenericOauth.ClientSecret, ClientSecret: app.Config().GenericOauth.ClientSecret,
ExchangeLocation: app.Config().GenericOauth.TokenEndpoint, ExchangeLocation: app.Config().GenericOauth.TokenEndpoint,
InspectLocation: app.Config().GenericOauth.InspectEndpoint, InspectLocation: app.Config().GenericOauth.InspectEndpoint,
AuthLocation: app.Config().GenericOauth.AuthEndpoint, AuthLocation: app.Config().GenericOauth.AuthEndpoint,
HttpClient: config.DefaultHTTPClient(), HttpClient: config.DefaultHTTPClient(),
CallbackLocation: callbackLocation, CallbackLocation: callbackLocation,
} }
configureOauthRoutes(parentHandler, r, app, oauthClient, callbackProxy) configureOauthRoutes(parentHandler, r, app, oauthClient, callbackProxy)
} }
} }
func configureOauthRoutes(parentHandler *Handler, r *mux.Router, app *App, oauthClient oauthClient, callbackProxy *callbackProxyClient) { func configureOauthRoutes(parentHandler *Handler, r *mux.Router, app *App, oauthClient oauthClient, callbackProxy *callbackProxyClient) {

View File

@ -21,7 +21,7 @@ type genericOauthClient struct {
var _ oauthClient = genericOauthClient{} var _ oauthClient = genericOauthClient{}
const ( const (
genericOauthDisplayName = "oAuth" genericOauthDisplayName = "oAuth"
) )
func (c genericOauthClient) GetProvider() string { func (c genericOauthClient) GetProvider() string {

View File

@ -76,7 +76,7 @@ func InitRoutes(apper Apper, r *mux.Router) *mux.Router {
configureSlackOauth(handler, write, apper.App()) configureSlackOauth(handler, write, apper.App())
configureWriteAsOauth(handler, write, apper.App()) configureWriteAsOauth(handler, write, apper.App())
configureGitlabOauth(handler, write, apper.App()) configureGitlabOauth(handler, write, apper.App())
configureGenericOauth(handler, write, apper.App()) configureGenericOauth(handler, write, apper.App())
// Set up dyamic page handlers // Set up dyamic page handlers
// Handle auth // Handle auth