mirror of
https://github.com/ordinary-dev/phoenix
synced 2024-09-20 03:40:29 +05:00
Ivan R.
2c08171c7a
I thought this was a good idea. Pros: fewer database calls. Cons: there is no way to revoke the token (except for changing the secret key). I rewrote the authorization as a middleware. Request handlers no longer need to validate the user.
18 lines
221 B
Go
18 lines
221 B
Go
package views
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
)
|
|
|
|
func ShowError(c *gin.Context, err error) {
|
|
c.HTML(
|
|
http.StatusBadRequest,
|
|
"error.html.tmpl",
|
|
gin.H{
|
|
"error": err.Error(),
|
|
},
|
|
)
|
|
c.Abort()
|
|
}
|