Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting for invalid login text #170

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/scenarioserver/scenarioserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type PreparedScenario struct {
VirtualMachines []map[string]string `json:"virtualmachines"`
Pauseable bool `json:"pauseable"`
Printable bool `json:"printable"`
ManagedBy string `json:"managedby"`
}

type AdminPreparedScenario struct {
Expand Down Expand Up @@ -111,7 +112,10 @@ func (s ScenarioServer) prepareScenario(scenario hfv1.Scenario, printable bool)
ps.Pauseable = scenario.Spec.Pauseable
ps.Printable = printable
ps.StepCount = len(scenario.Spec.Steps)

ps.ManagedBy = "hobbyfarm"
if scenario.Labels["managed-by"] != "" {
ps.ManagedBy = scenario.Labels["managed-by"]
}
return ps, nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/setting/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const (
ImprintLink SettingName = "imprint-link"
ImprintLinkName SettingName = "imprint-linkname"
AboutModalButtons SettingName = "aboutmodal-buttons"
LoginSettingErrorMessage SettingName = "login-error-message"
)

var DataTypeMappingToProto = map[property.DataType]settingProto.DataType{
Expand Down
4 changes: 3 additions & 1 deletion services/authnsvc/internal/authnservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,11 @@ func (a AuthServer) AddAccessCodeFunc(w http.ResponseWriter, r *http.Request) {
util.ReturnHTTPMessage(w, r, 400, "badrequest", "AccessCode does not meet criteria.")
return
}

managedby := r.PostFormValue("managedby")

set, err := a.settingClient.GetSettingValue(r.Context(), &settingProto.Id{Name: string(settingUtil.StrictAccessCodeValidation)})
if err != nil {
glog.Errorf("incorrect accesscode setting value %s: %v", managedby, err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do not understand this log nor the managedby label at this place. what is it for?

util.ReturnHTTPMessage(w, r, 500, "internalerror", "error adding accesscode")
return
}
Expand Down
13 changes: 13 additions & 0 deletions services/settingsvc/internal/preinstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,5 +241,18 @@ func predefinedSettings() []*settingProto.CreateSettingRequest {
DisplayName: "Strict AccessCode Validation",
},
},
{
Name: string(settingUtil.LoginSettingErrorMessage),
Namespace: util.GetReleaseNamespace(),
Labels: map[string]string{
labels.SettingScope: "public",
},
Value: "",
Property: &settingProto.Property{
DataType: settingProto.DataType_DATA_TYPE_STRING,
ValueType: settingProto.ValueType_VALUE_TYPE_SCALAR,
DisplayName: "Login Error Message",
},
},
}
}