refactor: put some account endpoints under account instead of auth
This commit is contained in:
parent
4391e9fc31
commit
fddc64799e
|
@ -387,17 +387,18 @@ func (a *AccountAPI) Routes() (*httprouter.Router, error) {
|
||||||
})
|
})
|
||||||
|
|
||||||
routes := map[string]jape.Handler{
|
routes := map[string]jape.Handler{
|
||||||
"POST /api/auth/ping": middleware.ApplyMiddlewares(a.ping, corsMw.Handler, pingAuthMw, middleware.ProxyMiddleware),
|
"POST /api/auth/ping": middleware.ApplyMiddlewares(a.ping, corsMw.Handler, pingAuthMw, middleware.ProxyMiddleware),
|
||||||
"POST /api/auth/login": middleware.ApplyMiddlewares(a.login, corsMw.Handler, loginAuthMw2fa, middleware.ProxyMiddleware),
|
"POST /api/auth/login": middleware.ApplyMiddlewares(a.login, corsMw.Handler, loginAuthMw2fa, middleware.ProxyMiddleware),
|
||||||
"POST /api/auth/register": middleware.ApplyMiddlewares(a.register, corsMw.Handler, middleware.ProxyMiddleware),
|
"POST /api/auth/register": middleware.ApplyMiddlewares(a.register, corsMw.Handler, middleware.ProxyMiddleware),
|
||||||
"POST /api/auth/verify-email": middleware.ApplyMiddlewares(a.verifyEmail, corsMw.Handler, middleware.ProxyMiddleware),
|
"POST /api/auth/otp/validate": middleware.ApplyMiddlewares(a.otpValidate, corsMw.Handler, authMw, middleware.ProxyMiddleware),
|
||||||
"POST /api/auth/otp/verify": middleware.ApplyMiddlewares(a.otpVerify, corsMw.Handler, authMw, middleware.ProxyMiddleware),
|
"POST /api/auth/logout": middleware.ApplyMiddlewares(a.logout, corsMw.Handler, authMw, middleware.ProxyMiddleware),
|
||||||
"POST /api/auth/otp/validate": middleware.ApplyMiddlewares(a.otpValidate, corsMw.Handler, authMw, middleware.ProxyMiddleware),
|
|
||||||
"POST /api/auth/otp/disable": middleware.ApplyMiddlewares(a.otpDisable, corsMw.Handler, authMw, middleware.ProxyMiddleware),
|
"POST /api/account/verify-email": middleware.ApplyMiddlewares(a.verifyEmail, corsMw.Handler, middleware.ProxyMiddleware),
|
||||||
"POST /api/auth/password-reset/request": middleware.ApplyMiddlewares(a.passwordResetRequest, corsMw.Handler, middleware.ProxyMiddleware),
|
"POST /api/account/otp/verify": middleware.ApplyMiddlewares(a.otpVerify, corsMw.Handler, authMw, middleware.ProxyMiddleware),
|
||||||
"POST /api/auth/password-reset/confirm": middleware.ApplyMiddlewares(a.passwordResetConfirm, corsMw.Handler, middleware.ProxyMiddleware),
|
"POST /api/account/otp/disable": middleware.ApplyMiddlewares(a.otpDisable, corsMw.Handler, authMw, middleware.ProxyMiddleware),
|
||||||
"POST /api/auth/logout": middleware.ApplyMiddlewares(a.logout, corsMw.Handler, authMw, middleware.ProxyMiddleware),
|
"POST /api/account/password-reset/request": middleware.ApplyMiddlewares(a.passwordResetRequest, corsMw.Handler, middleware.ProxyMiddleware),
|
||||||
"GET /*path": middleware.ApplyMiddlewares(getHandler, corsMw.Handler),
|
"POST /api/account/password-reset/confirm": middleware.ApplyMiddlewares(a.passwordResetConfirm, corsMw.Handler, middleware.ProxyMiddleware),
|
||||||
|
"GET /*path": middleware.ApplyMiddlewares(getHandler, corsMw.Handler),
|
||||||
}
|
}
|
||||||
|
|
||||||
return jape.Mux(routes), nil
|
return jape.Mux(routes), nil
|
||||||
|
|
|
@ -42,7 +42,7 @@ paths:
|
||||||
description: Successfully registered
|
description: Successfully registered
|
||||||
'400':
|
'400':
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
/api/auth/verify-email:
|
/api/account/verify-email:
|
||||||
post:
|
post:
|
||||||
summary: Verify email address
|
summary: Verify email address
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -64,7 +64,7 @@ paths:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/components/schemas/OTPGenerateResponse'
|
$ref: '#/components/schemas/OTPGenerateResponse'
|
||||||
/api/auth/otp/verify:
|
/api/account/otp/verify:
|
||||||
post:
|
post:
|
||||||
summary: Verify OTP for enabling two-factor authentication
|
summary: Verify OTP for enabling two-factor authentication
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -76,7 +76,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OTP verified successfully
|
description: OTP verified successfully
|
||||||
/api/auth/otp/validate:
|
/api/account/otp/validate:
|
||||||
post:
|
post:
|
||||||
summary: Validate OTP for two-factor authentication login
|
summary: Validate OTP for two-factor authentication login
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -100,7 +100,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OTP disabled successfully
|
description: OTP disabled successfully
|
||||||
/api/auth/password-reset/request:
|
/api/password-rese/password-reset/request:
|
||||||
post:
|
post:
|
||||||
summary: Request a password reset
|
summary: Request a password reset
|
||||||
requestBody:
|
requestBody:
|
||||||
|
@ -112,7 +112,7 @@ paths:
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: Password reset requested successfully
|
description: Password reset requested successfully
|
||||||
/api/auth/password-reset/confirm:
|
/api/password-rese/password-reset/confirm:
|
||||||
post:
|
post:
|
||||||
summary: Confirm a password reset
|
summary: Confirm a password reset
|
||||||
requestBody:
|
requestBody:
|
||||||
|
|
Loading…
Reference in New Issue