diff --git a/otoroshi/app/next/plugins/auth.scala b/otoroshi/app/next/plugins/auth.scala
index 4c84809ec..d42e76161 100644
--- a/otoroshi/app/next/plugins/auth.scala
+++ b/otoroshi/app/next/plugins/auth.scala
@@ -675,7 +675,10 @@ object SimpleBasicAuthConfig {
),
"users" -> Json.obj(
"type" -> "object",
- "label" -> "Users"
+ "label" -> "Users",
+ "props" -> Json.obj(
+ "bcryptable" -> true
+ )
)
))
}
diff --git a/otoroshi/javascript/src/components/inputs/ObjectInput.js b/otoroshi/javascript/src/components/inputs/ObjectInput.js
index 9064a4b3d..87b5a45af 100644
--- a/otoroshi/javascript/src/components/inputs/ObjectInput.js
+++ b/otoroshi/javascript/src/components/inputs/ObjectInput.js
@@ -1,5 +1,6 @@
import React from 'react';
import { Help } from './Help';
+import bcrypt from 'bcryptjs';
export class ObjectInput extends React.Component {
state = {
@@ -103,6 +104,10 @@ export class ObjectInput extends React.Component {
}
};
+ disableBcrypt = (value) => {
+ return value.startsWith("$2a$") || value.startsWith("$2$") || value.startsWith("$2b$") || value.startsWith("$2x$") || value.startsWith("$2y$")
+ }
+
render() {
const { data } = this.state;
const props = this.props;
@@ -160,15 +165,20 @@ export class ObjectInput extends React.Component {
{props.valueRenderer &&
props.valueRenderer(key, value, idx, (e) => this.changeValue(idx, key, e))}
{!props.valueRenderer && (
- this.changeValue(idx, key, e)}
- />
- )}
+ <>
+ this.changeValue(idx, key, e)}
+ />
+ {props.bcryptable ? : null}
+ >
+ )}
>
)}
diff --git a/otoroshi/javascript/src/components/inputs/TextInput.js b/otoroshi/javascript/src/components/inputs/TextInput.js
index 6b046d7b6..3dd4335cc 100644
--- a/otoroshi/javascript/src/components/inputs/TextInput.js
+++ b/otoroshi/javascript/src/components/inputs/TextInput.js
@@ -333,15 +333,15 @@ export class VerticalTextInput extends Component {
onDrop={this.props.onDrop || this.onDrop}
onDragOver={(e) => e.preventDefault()}
/>
- {this.props.prefix && (
+ {this.props.suffix && (
this.props.suffixCb(this.props.value) : undefined
}
- style={this.props.prefixStyle || {}}
+ style={this.props.suffixStyle || {}}
>
- {this.props.prefix}
+ {this.props.suffix}
)}
diff --git a/otoroshi/javascript/src/components/nginputs/inputs.js b/otoroshi/javascript/src/components/nginputs/inputs.js
index 1f50ff958..9cffd65f9 100644
--- a/otoroshi/javascript/src/components/nginputs/inputs.js
+++ b/otoroshi/javascript/src/components/nginputs/inputs.js
@@ -868,6 +868,7 @@ export class NgObjectRenderer extends Component {
ngOptions={{
spread: true,
}}
+ bcryptable={props.bcryptable}
label={null}
placeholderKey={props.placeholderKey}
placeholderValue={props.placeholderValue}