Add password protected links
This commit is contained in:
parent
2baa74d520
commit
a01f540a29
6 changed files with 67 additions and 28 deletions
|
|
@ -11,13 +11,14 @@ import (
|
|||
|
||||
func redirectHandler(ctx echo.Context, serv Service) error {
|
||||
linkId := ctx.Param("id")
|
||||
linkPassword := ctx.QueryParam("password")
|
||||
|
||||
link, err := serv.GetById(linkId)
|
||||
redirectUrl, err := serv.AccessLink(linkId, linkPassword)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return ctx.Redirect(http.StatusSeeOther, link.RedirectURL.String())
|
||||
return ctx.Redirect(http.StatusSeeOther, redirectUrl.String())
|
||||
}
|
||||
|
||||
func creationHandler(ctx echo.Context, serv Service) error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue