Skip to content

Commit

Permalink
Test password decrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
Nograx committed Mar 22, 2024
1 parent ff7d03a commit 07537e5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 61 deletions.
70 changes: 35 additions & 35 deletions admin/build/index.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions admin/build/index.js.map

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions admin/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class App extends GenericApp {
constructor(props: GenericAppProps) {
const extendedProps: GenericAppSettings = {
...props,
encryptedFields: [],
encryptedFields: ["password"],
translations: {
de: de,
en: en,
Expand Down Expand Up @@ -57,12 +57,8 @@ class App extends GenericApp {
return (
<div className="App">
<Settings
decryptedPassword={this.decrypt(this.state.native["password"])}
native={this.state.native}
onChange={(attr, value) => this.updateNativeValue(attr, value)}
onChangePassword={(password: string) => {
this.updateNativeValue("password", this.encrypt(password))
}}
/>
{this.renderError()}
{this.renderToast()}
Expand Down
20 changes: 2 additions & 18 deletions admin/src/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ const styles = (): Record<string, CreateCSSProperties> => ({
interface SettingsProps {
classes: Record<string, string>;
native: Record<string, any>;
decryptedPassword: string;
onChange: (attr: string, value: any) => void;
onChangePassword: (password: string) => void;
}

interface SettingsState {
Expand All @@ -63,21 +61,7 @@ class Settings extends React.Component<SettingsProps, SettingsState> {
super(props);
this.state = {};

//this.props.onChange("password", "");
}

renderPassword(title: AdminWord, attr: string, type: string) {
return (
<TextField
autoComplete="off"
label={I18n.t(title)}
className={`${this.props.classes.input} ${this.props.classes.controlElement}`}
value={this.props.decryptedPassword}
type={type || "text"}
onChange={(e) => this.props.onChange(attr, e.target.value)}
margin="normal"
/>
);
this.props.onChange("password", "");
}

renderInput(title: AdminWord, attr: string, type: string) {
Expand Down Expand Up @@ -165,7 +149,7 @@ class Settings extends React.Component<SettingsProps, SettingsState> {
])}
</div>
<div>{this.renderInput("userName", "userName", "text")}</div>
<div>{this.renderPassword("password", "password", "text")}</div>
<div>{this.renderInput("password", "password", "text")}</div>
{this.props.native["password"] == undefined ||
(this.props.native["password"] == "" && (
<div style={{ color: "red" }}>{I18n.t("enterPassword")}</div>
Expand Down

0 comments on commit 07537e5

Please sign in to comment.