You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
summary: `Enable two factor authentication for an existing ${name}.`
935
936
}
936
937
})
938
+
.authorize(({ user })=>user&&!user.public)
937
939
.handle(async(request,response)=>
938
940
response.formatter.ok(
939
941
awaitthis.enableTwoFactorAuth(requestasany)
@@ -949,6 +951,7 @@ class Auth {
949
951
description: `This endpoint confirms enabling 2fa for an account. A previous call to /${this.config.apiPath}/two-factor/enable is required to generate a 2fa secret for the ${name}'s account.`
950
952
}
951
953
})
954
+
.authorize(({ user })=>user&&!user.public)
952
955
.handle(async(request,response)=>
953
956
response.formatter.ok(
954
957
awaitthis.enableTwoFactorAuth(requestasany)
@@ -957,12 +960,14 @@ class Auth {
957
960
route(`Disable Two Factor Auth`)
958
961
.path(this.getApiPath('two-factor/disable'))
959
962
.post()
963
+
.authorize(({ user })=>user&&!user.public)
960
964
.extend({
961
965
docs: {
962
966
...extend,
963
967
summary: `Disable two factor authentication for an existing ${name}.`
964
968
}
965
969
})
970
+
.authorize(({ user })=>!!user)
966
971
.handle(async(request,response)=>
967
972
response.formatter.ok(
968
973
awaitthis.disableTwoFactorAuth(requestasany)
@@ -971,22 +976,26 @@ class Auth {
971
976
route(`Get authenticated ${name}`)
972
977
.path(this.getApiPath('me'))
973
978
.get()
979
+
.authorize(({ user })=>user&&!user.public)
974
980
.extend({
975
981
docs: {
976
982
...extend,
977
-
summary: `Get the authenticated ${name} from a valid JWT.`
983
+
summary: `Get the authenticated ${name} from a valid JWT.`,
984
+
security: [
985
+
{
986
+
Bearer: []
987
+
}
988
+
]
978
989
}
979
990
})
980
-
.handle(async({ user },{formatter: { ok, unauthorized }})=>
981
-
user&&!user.public
982
-
? ok(user)
983
-
: unauthorized({
984
-
message: 'Unauthorized.'
985
-
})
991
+
.handle(
992
+
async({ user },{formatter: { ok, unauthorized }})=>
0 commit comments