@@ -37,8 +37,6 @@ var ssoMethods []SingleSignOn = []SingleSignOn{
37
37
// The purpose of the following three function variables is to let the linter know that
38
38
// those functions are not dead code and are actually being used
39
39
var (
40
- _ = isPublicResource
41
- _ = isPublicPage
42
40
_ = handleSignIn
43
41
)
44
42
@@ -107,44 +105,6 @@ func isAttachmentDownload(ctx *macaron.Context) bool {
107
105
return strings .HasPrefix (ctx .Req .URL .Path , "/attachments/" ) && ctx .Req .Method == "GET"
108
106
}
109
107
110
- // isPublicResource checks if the url is of a public resource file that should be served
111
- // without authentication (eg. the Web App Manifest, the Service Worker script or the favicon)
112
- func isPublicResource (ctx * macaron.Context ) bool {
113
- path := strings .TrimSuffix (ctx .Req .URL .Path , "/" )
114
- return path == "/robots.txt" ||
115
- path == "/favicon.ico" ||
116
- path == "/favicon.png" ||
117
- path == "/manifest.json" ||
118
- path == "/serviceworker.js"
119
- }
120
-
121
- // isPublicPage checks if the url is of a public page that should not require authentication
122
- func isPublicPage (ctx * macaron.Context ) bool {
123
- path := strings .TrimSuffix (ctx .Req .URL .Path , "/" )
124
- homePage := strings .TrimSuffix (setting .AppSubURL , "/" )
125
- currentURL := homePage + path
126
- return currentURL == homePage ||
127
- path == "/user/login" ||
128
- path == "/user/login/openid" ||
129
- path == "/user/sign_up" ||
130
- path == "/user/forgot_password" ||
131
- path == "/user/openid/connect" ||
132
- path == "/user/openid/register" ||
133
- strings .HasPrefix (path , "/user/oauth2" ) ||
134
- path == "/user/link_account" ||
135
- path == "/user/link_account_signin" ||
136
- path == "/user/link_account_signup" ||
137
- path == "/user/two_factor" ||
138
- path == "/user/two_factor/scratch" ||
139
- path == "/user/u2f" ||
140
- path == "/user/u2f/challenge" ||
141
- path == "/user/u2f/sign" ||
142
- (! setting .Service .RequireSignInView && (path == "/explore/repos" ||
143
- path == "/explore/users" ||
144
- path == "/explore/organizations" ||
145
- path == "/explore/code" ))
146
- }
147
-
148
108
// handleSignIn clears existing session variables and stores new ones for the specified user object
149
109
func handleSignIn (ctx * macaron.Context , sess session.Store , user * models.User ) {
150
110
_ = sess .Delete ("openid_verified_uri" )
0 commit comments