Skip to content

Commit

Permalink
Merge pull request #14 from jrione/development
Browse files Browse the repository at this point in the history
v0.0.2
  • Loading branch information
jrione authored Mar 14, 2024
2 parents 9163afe + d382e2f commit 4062633
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/go-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ jobs:
--arg port "${{ secrets.PORT }}" \
--arg name "${{ secrets.NAME }}" \
'(. | .server.listen = $serverListen | .database.username = $username | .database.password = $password | .database.hostname = $hostname | .database.port = $port | .database.name = $name )' | tee config.json
- name: Save Artifact
uses: actions/upload-artifact@v4
with:
name: env_artifact
path: ./config.json
retention-days: 1
- name: Test
run: |
./gin-crud &
Expand Down
3 changes: 2 additions & 1 deletion controller/login_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ func (l LoginController) Login(gctx *gin.Context) {
})
return
}
if req.Username != data.Username && !checkHashPass(data.Password, req.Password) {

if req.Username != data.Username || !checkHashPass(data.Password, req.Password) {
gctx.JSON(http.StatusUnauthorized, gin.H{
"code": http.StatusUnauthorized,
"err": "Incorrect Username Or Password",
Expand Down
2 changes: 0 additions & 2 deletions middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package auth

import (
"fmt"
"log"
"net/http"
"strings"

Expand Down Expand Up @@ -32,7 +31,6 @@ func CORSMiddleware() gin.HandlerFunc {
gctx.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")

if gctx.Request.Method == "OPTIONS" {
log.Print("Handling Options")
gctx.AbortWithStatus(204)
return
}
Expand Down
2 changes: 1 addition & 1 deletion migrations/user.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS "User" (
username CHAR(20) NOT NULL PRIMARY KEY,
full_name VARCHAR(50) NOT NULL,
email VARCHAR(50) NOT NULL,
password VARCHAR(16) NOT NULL,
password VARCHAR(60) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
);
Expand Down

0 comments on commit 4062633

Please sign in to comment.