|
|
|
@ -54,6 +54,10 @@ func getToken(w http.ResponseWriter, r *http.Request) error {
|
|
|
|
log.Println("getToken got name:", userInput.Name, "pass:", userInput.Pass)
|
|
|
|
log.Println("getToken got name:", userInput.Name, "pass:", userInput.Pass)
|
|
|
|
|
|
|
|
|
|
|
|
db.First(&userRecord)
|
|
|
|
db.First(&userRecord)
|
|
|
|
|
|
|
|
if db.Error != nil {
|
|
|
|
|
|
|
|
log.Println("db finding user had error",err)
|
|
|
|
|
|
|
|
return ehttp.NewErrorf(http.StatusInternalServerError, "database lookup error")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if userRecord.Name == userInput.Name && userRecord.Pass == userInput.Pass {
|
|
|
|
if userRecord.Name == userInput.Name && userRecord.Pass == userInput.Pass {
|
|
|
|
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
|
|
|
|
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
|
|
|
|
|