This website works better with JavaScript.
Home
Issues
Pull Requests
Milestones
Repositories
Datasets
Forum
实训
竞赛
大数据
应用
Register
Sign In
OpenI
/
aiforge
Not watched
Unwatch
Watch all
Watch but not notify
1
Star
0
Fork
0
Code
Releases
128
Wiki
Activity
Issues
0
Pull Requests
0
Datasets
Model
Cloudbrain
Browse Source
#1127
: hide user e-mail when API caller isn't signed in
tags/v1.2.0-rc1
Unknwon
10 years ago
parent
3e3489be25
commit
41eec2f7d1
2 changed files
with
6 additions
and
0 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+1
-0
modules/middleware/auth.go
+5
-0
routers/api/v1/user.go
+ 1
- 0
modules/middleware/auth.go
View File
@@ -69,6 +69,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
}
}
// Contexter middleware already checks token for user sign in process.
func ApiReqToken() macaron.Handler {
return func(ctx *Context) {
if !ctx.IsSigned {
+ 5
- 0
routers/api/v1/user.go
View File
@@ -68,5 +68,10 @@ func GetUserInfo(ctx *middleware.Context) {
}
return
}
// Hide user e-mail when API caller isn't signed in.
if !ctx.IsSigned {
u.Email = ""
}
ctx.JSON(200, &api.User{u.Id, u.Name, u.FullName, u.Email, u.AvatarLink()})
}
Write
Preview
Loading…
Cancel
Save