Skip to content

Commit

Permalink
Correctly show validation error when verifying login to VCSA on OVA UI (
Browse files Browse the repository at this point in the history
  • Loading branch information
AngieCris authored and andrewtchin committed Dec 9, 2017
1 parent b77cf22 commit 236fe98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions installer/fileserver/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ <h3 class="modal-title">Complete VIC appliance installation</h3>
<div class="modal-body">
<form id="login-form" method="post" class="pt-0">
<div id="login-body">
{{if .InvalidLogin}}
{{if .ValidationError }}
<div class="alert alert-danger mt-0 mb-2">
<div class="alert-item">
<span class="alert-text">
Username or password are incorrect. Please enter them again.
Validation failed: {{ .ValidationError }}
</span>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions installer/fileserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ type config struct {

// IndexHTMLOptions contains fields for html templating in index.html
type IndexHTMLOptions struct {
InvalidLogin bool
InitErrorFeedback string
InitSuccessFeedback string
NeedLogin bool
AdmiralAddr string
DemoVCHAddr string
FileserverAddr string
ValidationError string
}

var (
Expand Down Expand Up @@ -200,6 +200,7 @@ func indexHandler(resp http.ResponseWriter, req *http.Request) {
NeedLogin: needInitializationServices(req),
InitErrorFeedback: "",
InitSuccessFeedback: "",
ValidationError: "",
}

if req.Method == http.MethodPost {
Expand All @@ -213,8 +214,7 @@ func indexHandler(resp http.ResponseWriter, req *http.Request) {
defer cancel()
if err != nil {
log.Infof("Validation failed: %s", err.Error())
html.InvalidLogin = true

html.ValidationError = err.Error()
} else {
log.Infof("Validation succeeded")
html.InitErrorFeedback = startInitializationServices()
Expand Down

0 comments on commit 236fe98

Please sign in to comment.