🔊 Add logging to server.log when token generation fails

This commit is contained in:
Florian Beisel 2024-01-21 16:17:35 +01:00
parent 8563c80ffe
commit b681395287
Signed by: florian
GPG Key ID: 79ECA2E54996FF4D
1 changed files with 28 additions and 12 deletions

View File

@ -1,7 +1,22 @@
// Copyright 2024 Florian Beisel
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package auth
import (
"database/sql"
"log"
"net/http"
"git.beisel.it/florian/hostname-service/db"
@ -58,6 +73,7 @@ func LoginHandler(c *gin.Context) {
token, err := GenerateToken(storedCreds.Username)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to generate token"})
log.Printf("Error generating token %v", err)
return
}