File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,17 @@ func Events(ctx *context.Context) {
30
30
ctx .Resp .Header ().Set ("X-Accel-Buffering" , "no" )
31
31
ctx .Resp .WriteHeader (http .StatusOK )
32
32
33
+ if ! ctx .IsSigned {
34
+ // Return unauthorized status event
35
+ event := (& eventsource.Event {
36
+ Name : "unauthorized" ,
37
+ Data : "sorry" ,
38
+ })
39
+ _ , _ = event .WriteTo (ctx )
40
+ ctx .Resp .Flush ()
41
+ return
42
+ }
43
+
33
44
// Listen to connection close and un-register messageChan
34
45
notify := ctx .Req .Context ().Done ()
35
46
ctx .Resp .Flush ()
Original file line number Diff line number Diff line change @@ -400,7 +400,7 @@ func RegisterRoutes(m *web.Route) {
400
400
})
401
401
}, reqSignOut )
402
402
403
- m .Any ("/user/events" , reqSignIn , events .Events )
403
+ m .Any ("/user/events" , events .Events )
404
404
405
405
m .Group ("/login/oauth" , func () {
406
406
m .Get ("/authorize" , bindIgnErr (auth.AuthorizationForm {}), user .AuthorizeOAuth )
You can’t perform that action at this time.
0 commit comments