// GET /deleteme?token=jwt - delete all user comments by user's request. Gets info about deleted used from provided token
// request made GET to allow direct click from the email sent by user
GET /deleteme?token=jwt - delete all user comments by user's request. Gets info about deleted used from provided token
request made GET to allow direct click from the email sent by user
// GET / deleteme?token = jwt - delete all user comments by user ' s request . Gets info about deleted used from provided token // request made GET to allow direct click from the email sent by user
func (a *admin) deleteMeRequestCtrl(w http.ResponseWriter, r *http.Request) {
	token := r.URL.Query().Get("token")
	claims, err := a.authenticator.JWTService.Parse(token)
	if err != nil {
		rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "can't process token")
		return
	}
	log.Printf("[INFO] delete all user comments by request for %s, site %s", claims.User.ID, claims.SiteID)
	if err := a.dataService.DeleteUser(claims.SiteID, claims.User.ID); err != nil {
		rest.SendErrorJSON(w, r, http.StatusBadRequest, err, "can't delete user")
		return
	}
	a.cache.Flush(claims.SiteID, claims.User.ID)
	render.Status(r, http.StatusOK)
	render.JSON(w, r, JSON{"user_id": claims.User.ID, "site_id": claims.SiteID})
}
func ( a * admin ) deleteMeRequestCtrl ( w http . ResponseWriter , r * http . Request ) { token := r . URL . Query ( ) . Get ( " " ) claims , err := a . authenticator . JWTService . Parse ( token ) if err != nil { rest . SendErrorJSON ( w , r , http . StatusBadRequest , err , " " ) return } log . Printf ( " " , claims . User . ID , claims . SiteID ) if err := a . dataService . DeleteUser ( claims . SiteID , claims . User . ID ) ; err != nil { rest . SendErrorJSON ( w , r , http . StatusBadRequest , err , " " ) return } a . cache . Flush ( claims . SiteID , claims . User . ID ) render . Status ( r , http . StatusOK ) render . JSON ( w , r , JSON { " " : claims . User . ID , " " : claims . SiteID } ) }
GET /deleteme?token=jwt - delete all user comments by user's request.
GET / deleteme?token = jwt - delete all user comments by user ' s request .