✨ Password reset & user lookup API
This commit is contained in:
@ -14,6 +14,20 @@ import (
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func lookupAccount(c *fiber.Ctx) error {
|
||||
probe := c.Query("probe")
|
||||
if len(probe) == 0 {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "you must provide a probe")
|
||||
}
|
||||
|
||||
user, err := services.LookupAccount(probe)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
return c.JSON(user)
|
||||
}
|
||||
|
||||
func getUserinfo(c *fiber.Ctx) error {
|
||||
if err := exts.EnsureAuthenticated(c); err != nil {
|
||||
return err
|
||||
|
@ -19,6 +19,8 @@ func MapAPIs(app *fiber.App) {
|
||||
notify.Put("/:notificationId/read", markNotificationRead)
|
||||
}
|
||||
|
||||
api.Get("/users/lookup", lookupAccount)
|
||||
|
||||
me := api.Group("/users/me").Name("Myself Operations")
|
||||
{
|
||||
|
||||
@ -34,8 +36,8 @@ func MapAPIs(app *fiber.App) {
|
||||
me.Delete("/tickets/:ticketId", killTicket)
|
||||
|
||||
me.Post("/confirm", doRegisterConfirm)
|
||||
me.Post("/reset-password", requestResetPassword)
|
||||
me.Patch("/reset-password", confirmResetPassword)
|
||||
me.Post("/password-reset", requestResetPassword)
|
||||
me.Patch("/password-reset", confirmResetPassword)
|
||||
|
||||
me.Get("/status", getMyselfStatus)
|
||||
me.Post("/status", setStatus)
|
||||
|
Reference in New Issue
Block a user