admin: Fix nil dereference when asking password

This commit is contained in:
nemunaire 2022-05-31 14:53:26 +02:00
parent ad41513654
commit 8fd2a70894

View File

@ -73,7 +73,11 @@ func declareTeamsPasswordRoutes(router *gin.RouterGroup) {
router.GET("/password", func(c *gin.Context) {
team := c.MustGet("team").(*fic.Team)
c.String(http.StatusOK, *team.Password)
if team.Password != nil {
c.String(http.StatusOK, *team.Password)
} else {
c.AbortWithStatusJSON(http.StatusNotFound, nil)
}
})
router.POST("/password", func(c *gin.Context) {
team := c.MustGet("team").(*fic.Team)