-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add logic to create repo hash (#85)
- Loading branch information
Showing
3 changed files
with
71 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) 2020 Target Brands, Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by the LICENSE file in this repository. | ||
|
||
package api | ||
|
||
import ( | ||
"net/http" | ||
"strings" | ||
|
||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
// Login represents the API handler to | ||
// process a user logging in to Vela. | ||
func Login(c *gin.Context) { | ||
// check if request was a POST | ||
if strings.EqualFold(c.Request.Method, "POST") { | ||
// assume all POST requests are coming from the CLI | ||
AuthenticateCLI(c) | ||
|
||
return | ||
} | ||
|
||
// capture an error if present | ||
err := c.Request.FormValue("error") | ||
if len(err) > 0 { | ||
// redirect to initial login screen with error code | ||
c.Redirect(http.StatusTemporaryRedirect, "/login/error?code="+err) | ||
} | ||
|
||
// redirect to our authentication handler | ||
c.Redirect(http.StatusTemporaryRedirect, "/authenticate") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters