mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
outsourcing of login attemt variables
This commit is contained in:
@@ -8,6 +8,7 @@ import GeneralSettings from "./GeneralSettings";
|
||||
import BaseUrlSettings from "./BaseUrlSettings";
|
||||
import AdminSettings from "./AdminSettings";
|
||||
import Notification from "../../../components/Notification";
|
||||
import LoginAttempt from "./LoginAttempt";
|
||||
|
||||
type Props = {
|
||||
submitForm: Config => void,
|
||||
@@ -19,7 +20,8 @@ type Props = {
|
||||
|
||||
type State = {
|
||||
config: Config,
|
||||
showNotification: boolean
|
||||
showNotification: boolean,
|
||||
loginAttemptError: boolean
|
||||
};
|
||||
|
||||
class ConfigForm extends React.Component<Props, State> {
|
||||
@@ -51,7 +53,8 @@ class ConfigForm extends React.Component<Props, State> {
|
||||
defaultNamespaceStrategy: "",
|
||||
_links: {}
|
||||
},
|
||||
showNotification: false
|
||||
showNotification: false,
|
||||
loginAttemptError: true
|
||||
};
|
||||
}
|
||||
|
||||
@@ -95,10 +98,8 @@ class ConfigForm extends React.Component<Props, State> {
|
||||
disableGroupingGrid={config.disableGroupingGrid}
|
||||
dateFormat={config.dateFormat}
|
||||
anonymousAccessEnabled={config.anonymousAccessEnabled}
|
||||
loginAttemptLimit={config.loginAttemptLimit}
|
||||
skipFailedAuthenticators={config.skipFailedAuthenticators}
|
||||
pluginUrl={config.pluginUrl}
|
||||
loginAttemptLimitTimeout={config.loginAttemptLimitTimeout}
|
||||
enabledXsrfProtection={config.enabledXsrfProtection}
|
||||
defaultNamespaceStrategy={config.defaultNamespaceStrategy}
|
||||
onChange={(isValid, changedValue, name) =>
|
||||
@@ -107,6 +108,15 @@ class ConfigForm extends React.Component<Props, State> {
|
||||
hasUpdatePermission={configUpdatePermission}
|
||||
/>
|
||||
<hr />
|
||||
<LoginAttempt
|
||||
loginAttemptLimit={config.loginAttemptLimit}
|
||||
loginAttemptLimitTimeout={config.loginAttemptLimitTimeout}
|
||||
onChange={(isValid, changedValue, name) =>
|
||||
this.onChange(isValid, changedValue, name)
|
||||
}
|
||||
hasUpdatePermission={configUpdatePermission}
|
||||
/>
|
||||
<hr />
|
||||
<BaseUrlSettings
|
||||
baseUrl={config.baseUrl}
|
||||
forceBaseUrl={config.forceBaseUrl}
|
||||
@@ -139,25 +149,27 @@ class ConfigForm extends React.Component<Props, State> {
|
||||
/>
|
||||
<hr />
|
||||
<SubmitButton
|
||||
// disabled={!this.isValid()}
|
||||
loading={loading}
|
||||
label={t("config-form.submit")}
|
||||
disabled={!configUpdatePermission}
|
||||
disabled={!configUpdatePermission || !this.isValid()}
|
||||
/>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
onChange = (isValid: boolean, changedValue: any, name: string) => {
|
||||
if (isValid) {
|
||||
this.setState({
|
||||
...this.state,
|
||||
config: {
|
||||
...this.state.config,
|
||||
[name]: changedValue
|
||||
}
|
||||
});
|
||||
}
|
||||
this.setState({
|
||||
...this.state,
|
||||
config: {
|
||||
...this.state.config,
|
||||
[name]: changedValue
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
isValid = () => {
|
||||
return this.state.loginAttemptError;
|
||||
};
|
||||
|
||||
onClose = () => {
|
||||
|
||||
Reference in New Issue
Block a user