Skip to content

Commit

Permalink
fix: show error msg and standard page when ega login fails
Browse files Browse the repository at this point in the history
setting a viewModel in .View("file.html", viewModel) overrides any
previous viewdata calls.
  • Loading branch information
MalinAhlberg committed Mar 5, 2025
1 parent 431d5f0 commit affddda
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 0 additions & 5 deletions sda/cmd/auth/cega.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import (
bcrypt "golang.org/x/crypto/bcrypt"
)

// EGALoginError is used to store message errors
type EGALoginError struct {
Reason string
}

// CegaUserResponse captures the response list
type CegaUserResponse struct {
PasswordHash string `json:"passwordHash"`
Expand Down
4 changes: 3 additions & 1 deletion sda/cmd/auth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func (auth AuthHandler) postEGA(ctx iris.Context) {

s3conf := getS3ConfigMap(token, auth.Config.S3Inbox, username)
s.SetFlash("ega", s3conf)

ctx.ViewData("infoUrl", auth.Config.InfoURL)
ctx.ViewData("infoText", auth.Config.InfoText)
ctx.ViewData("User", username)
Expand Down Expand Up @@ -210,7 +211,8 @@ func (auth AuthHandler) getEGALogin(ctx iris.Context) {
}
ctx.ViewData("infoUrl", auth.Config.InfoURL)
ctx.ViewData("infoText", auth.Config.InfoText)
err := ctx.View("loginform.html", EGALoginError{Reason: message})
ctx.ViewData("Reason", message)
err := ctx.View("loginform.html")
if err != nil {
log.Error("Failed to view invalid credentials form: ", err)

Expand Down

0 comments on commit affddda

Please sign in to comment.