diff --git a/README.md b/README.md index 1ca2744..ea8484e 100644 --- a/README.md +++ b/README.md @@ -138,5 +138,6 @@ Next changes sorted by priority - [ ] Refactore Unit Tests - [ ] Performance optimization - [ ] Add ability to track the visitors (Referrer, maybe also live) +- [ ] Create Makefile for building everything - [ ] Test docker-compose installation - [ ] Provide image on the docker hub \ No newline at end of file diff --git a/handlers/handlers.go b/handlers/handlers.go index 1fb2524..a84de46 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -29,7 +29,7 @@ type Handler struct { // URLUtil is used to help in- and outgoing requests for json // un- and marshalling type URLUtil struct { - URL string + URL string `binding:"required"` } type oAuthUser struct { @@ -97,7 +97,6 @@ func (h *Handler) randToken() string { } func (h *Handler) handleGoogleAuth(c *gin.Context) { - // Handle the exchange code to initiate a transport. session := sessions.Default(c) retrievedState := session.Get("state") if retrievedState != c.Query("state") { @@ -141,15 +140,13 @@ func (h *Handler) handleGoogleLogin(c *gin.Context) { c.Redirect(http.StatusTemporaryRedirect, h.oAuthConf.AuthCodeURL(state)) } -func (h *Handler) handleGoogleCallback(ctx *gin.Context) { - ctx.JSON(http.StatusOK, gin.H{"Hello": "from private", "user": ctx.MustGet("user").(oAuthUser)}) +func (h *Handler) handleGoogleCallback(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{"Hello": "from private", "user": c.MustGet("user").(oAuthUser)}) } // handleCreate handles requests to create an entry func (h *Handler) handleCreate(c *gin.Context) { - var data struct { - URL string - } + var data URLUtil err := c.ShouldBind(&data) if err != nil { c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) diff --git a/static/public/favicon.ico b/static/public/favicon.ico index a11777c..f5898e2 100644 Binary files a/static/public/favicon.ico and b/static/public/favicon.ico differ diff --git a/static/src/App/App.js b/static/src/App/App.js index 0c92973..7095343 100644 --- a/static/src/App/App.js +++ b/static/src/App/App.js @@ -22,12 +22,16 @@ class ContainerExampleContainer extends Component { } onOAuthClose = () => { - this.setState({ open: false }) + this.setState({ open: true }) } onAuthClick = () => { console.log("onAuthClick") - window.open("/api/v1/login", "", "width=600,height=400") + var wwidth = 400, + wHeight = 500; + var wLeft = (window.screen.width / 2) - (wwidth / 2); + var wTop = (window.screen.height / 2) - (wHeight / 2); + window.open("/api/v1/login", "", `width=${wwidth}, height=${wHeight}, top=${wTop}, left=${wLeft}`) } render() { @@ -49,10 +53,10 @@ class ContainerExampleContainer extends Component { return ( - OAuth2 Authentication + Authentication -

Currently you are only able to use Google as authentification service:

+

Currently you are only able to use Google as authentication service: