Skip to content

Commit

Permalink
js linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Serp1co committed Dec 6, 2024
1 parent 6d1d323 commit db5c80b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import SpaRenderer from "core/spa/spa-renderer";
import PasswordPolicy from "./password-policy";
import { PasswordPolicyData } from "./password_policy_type";
import SpaRenderer from "core/spa/spa-renderer";

export const renderer = (
id: string, policy: PasswordPolicyData, defaults: PasswordPolicyData
) => {
export const renderer = (id: string, policy: PasswordPolicyData, defaults: PasswordPolicyData) => {
SpaRenderer.renderNavigationReact(
<PasswordPolicy
policy={policy}
defaults={defaults}
/>,
document.getElementById(id)
<PasswordPolicy policy={policy} defaults={defaults} />, document.getElementById(id)
);
};
75 changes: 17 additions & 58 deletions web/html/src/manager/admin/password-policy/password-policy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { MessagesContainer, showErrorToastr, showSuccessToastr } from "component
import { PasswordPolicyProps } from "./password_policy_type";

const updatePolicy = (policyData) => {
return fetch('/rhn/manager/api/admin/config/password-policy', {
method: 'POST',
return fetch("/rhn/manager/api/admin/config/password-policy", {
method: "POST",
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
},
body: JSON.stringify(policyData),
}).then((response) => {
Expand All @@ -26,10 +26,10 @@ const updatePolicy = (policyData) => {
};

const defaultPolicy = () => {
return fetch('/rhn/manager/api/admin/config/password-policy/default', {
method: 'GET',
return fetch("/rhn/manager/api/admin/config/password-policy/default", {
method: "GET",
headers: {
'Content-Type': 'application/json',
"Content-Type": "application/json",
},
}).then((response) => {
if (!response.ok) {
Expand All @@ -41,108 +41,71 @@ const defaultPolicy = () => {
});
};


const PasswordPolicy = (prop: PasswordPolicyProps) => {
return (
<TopPanel
title={t("Server Configuration - Password Policy")}
icon="fa-info-circle"
>
<TopPanel title={t("Server Configuration - Password Policy")} icon="fa-info-circle">
<div className="page-summary">
<MessagesContainer />
<p>{t("Set up your server local users password policy.")}</p>
</div>
<Form
model={prop.policy}
>
<Form model={prop.policy} >
<Panel headingLevel="h2" title={t("Password Policy Settings")}>
<div className="col-md-8">
{/* Minimum Length */}
<div className="row">
<div className="col-md-4 text-left">
<label htmlFor="minLength">{t("Min Password Length")}</label>
</div>
<Text
required
name="minLength"
divClass="col-md-2"
type="number"
/>
<Text required name="minLength" divClass="col-md-2" type="number" />
</div>
{/* Maximum Length */}
<div className="row">
<div className="col-md-4 text-left">
<label htmlFor="maxLength">{t("Max Password Length")}</label>
</div>
<Text
required
name="maxLength"
divClass="col-md-2"
type="number"
/>
<Text required name="maxLength" divClass="col-md-2" type="number" />
</div>
{/* Require Digits */}
<div className="row">
<div className="col-md-4 text-left">
<label htmlFor="digitFlag">{t("Require Digits")}</label>
</div>
<Check
name="digitFlag"
key="digitFlag"
divClass="col-md-2"
/>
<Check name="digitFlag" key="digitFlag" divClass="col-md-2" />
</div>
{/* Require Lowercase Characters */}
<div className="row">
<div className="col-md-4 text-left">
<label htmlFor="lowerCharFlag">{t("Require Lowercase Characters")}</label>
</div>
<Check
name="lowerCharFlag"
key="lowerCharFlag"
divClass="col-md-2"
/>
<Check name="lowerCharFlag" key="lowerCharFlag" divClass="col-md-2" />
</div>
{/* Require Uppercase Characters */}
<div className="row">
<div className="col-md-4 text-left">
<label htmlFor="upperCharFlag">{t("Require Uppercase Characters")}</label>
</div>
<Check
name="upperCharFlag"
key="upperCharFlag"
divClass="col-md-2"
/>
<Check name="upperCharFlag" key="upperCharFlag" divClass="col-md-2" />
</div>
{/* Restrict Consecutive Characters */}
<div className="row">
<div className="col-md-4 text-left">
<label htmlFor="consecutiveCharsFlag">{t("Restrict Consecutive Characters")}</label>
</div>
<Check
name="consecutiveCharsFlag"
key="consecutiveCharsFlag"
divClass="col-md-2"
/>
<Check name="consecutiveCharsFlag" key="consecutiveCharsFlag" divClass="col-md-2" />
</div>
{/* Require Special Characters */}
<div className="row">
<div className="col-md-4 text-left">
<label htmlFor="specialCharFlag">{t("Require Special Characters")}</label>
</div>
<Check
name="specialCharFlag"
key="specialCharFlag"
divClass="col-md-2"
/>
<Check name="specialCharFlag" key="specialCharFlag" divClass="col-md-2" />
</div>
{/* Allowed Special Characters */}
<div className="row form-group">
<div className="col-md-4 text-left">
<label htmlFor="specialChars">{t("Allowed Special Characters")}</label>
</div>
<Text
disabled={!prop.policy.specialCharFlag}
<Text disabled={!prop.policy.specialCharFlag}
name="specialChars"
divClass="col-md-4"
defaultValue={prop.defaults.specialChars?.toLocaleString()}
Expand All @@ -153,11 +116,7 @@ const PasswordPolicy = (prop: PasswordPolicyProps) => {
<div className="col-md-4 text-left">
<label htmlFor="restrictedOccurrenceFlag">{t("Restrict Characters Occurrences")}</label>
</div>
<Check
key="restrictedOccurrenceFlag"
name="restrictedOccurrenceFlag"
divClass="col-md-2"
/>
<Check key="restrictedOccurrenceFlag" name="restrictedOccurrenceFlag" divClass="col-md-2" />
</div>
{/* Maximum Character Occurrence */}
<div className="row form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export type PasswordPolicyData = {

export type PasswordPolicyProps = {
policy: PasswordPolicyData;
defaults: PasswordPolicyData
}
defaults: PasswordPolicyData;
};

0 comments on commit db5c80b

Please sign in to comment.