mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-24 08:20:31 +08:00
Merge pull request #57 from Kininaru/master
fix: remove all dom APIs from the project
This commit is contained in:
commit
08779b607d
@ -27,6 +27,7 @@ export const CropperDiv = (props) => {
|
|||||||
const {title} = props;
|
const {title} = props;
|
||||||
const {targetFunction} = props;
|
const {targetFunction} = props;
|
||||||
const {buttonText} = props;
|
const {buttonText} = props;
|
||||||
|
let uploadButton;
|
||||||
|
|
||||||
const onChange = (e) => {
|
const onChange = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -74,7 +75,7 @@ export const CropperDiv = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const selectFile = () => {
|
const selectFile = () => {
|
||||||
document.getElementsByName('fileupload').item(0).click()
|
uploadButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -95,7 +96,7 @@ export const CropperDiv = (props) => {
|
|||||||
>
|
>
|
||||||
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
|
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
|
||||||
<Row style={{width: "100%", marginBottom: "20px"}}>
|
<Row style={{width: "100%", marginBottom: "20px"}}>
|
||||||
<input style={{display: "none"}} name="fileupload" type="file" onChange={onChange}/>
|
<input style={{display: "none"}} ref={input => uploadButton = input} type="file" onChange={onChange}/>
|
||||||
<Button block onClick={selectFile}>{i18next.t("user:Select a photo...")}</Button>
|
<Button block onClick={selectFile}>{i18next.t("user:Select a photo...")}</Button>
|
||||||
</Row>
|
</Row>
|
||||||
<Cropper
|
<Cropper
|
||||||
|
@ -21,6 +21,9 @@ import * as Setting from "./Setting";
|
|||||||
export const PasswordModal = (props) => {
|
export const PasswordModal = (props) => {
|
||||||
const [visible, setVisible] = React.useState(false);
|
const [visible, setVisible] = React.useState(false);
|
||||||
const [confirmLoading, setConfirmLoading] = React.useState(false);
|
const [confirmLoading, setConfirmLoading] = React.useState(false);
|
||||||
|
const [oldPassword, setOldPassword] = React.useState("");
|
||||||
|
const [newPassword, setNewPassword] = React.useState("");
|
||||||
|
const [rePassword, setRePassword] = React.useState("");
|
||||||
const {user} = props;
|
const {user} = props;
|
||||||
|
|
||||||
const showModal = () => {
|
const showModal = () => {
|
||||||
@ -32,10 +35,6 @@ export const PasswordModal = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleOk = () => {
|
const handleOk = () => {
|
||||||
let oldPassword = document.getElementById("old-password")?.value;
|
|
||||||
let newPassword = document.getElementById("new-password").value;
|
|
||||||
let rePassword = document.getElementById("re-new-password").value;
|
|
||||||
if (oldPassword === null || oldPassword === undefined) oldPassword = "";
|
|
||||||
if (newPassword === "" || rePassword === "") {
|
if (newPassword === "" || rePassword === "") {
|
||||||
Setting.showMessage("error", i18next.t("user:Empty input!"));
|
Setting.showMessage("error", i18next.t("user:Empty input!"));
|
||||||
return;
|
return;
|
||||||
@ -75,14 +74,14 @@ export const PasswordModal = (props) => {
|
|||||||
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
|
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
|
||||||
{ hasOldPassword ? (
|
{ hasOldPassword ? (
|
||||||
<Row style={{width: "100%", marginBottom: "20px"}}>
|
<Row style={{width: "100%", marginBottom: "20px"}}>
|
||||||
<Input.Password addonBefore={i18next.t("user:Old Password")} placeholder={i18next.t("user:input password")} id="old-password"/>
|
<Input.Password addonBefore={i18next.t("user:Old Password")} placeholder={i18next.t("user:input password")} onChange={(e) => setOldPassword(e.target.value)}/>
|
||||||
</Row>
|
</Row>
|
||||||
) : null}
|
) : null}
|
||||||
<Row style={{width: "100%", marginBottom: "20px"}}>
|
<Row style={{width: "100%", marginBottom: "20px"}}>
|
||||||
<Input.Password addonBefore={i18next.t("user:New Password")} placeholder={i18next.t("user:input password")} id="new-password"/>
|
<Input.Password addonBefore={i18next.t("user:New Password")} placeholder={i18next.t("user:input password")} onChange={(e) => setNewPassword(e.target.value)}/>
|
||||||
</Row>
|
</Row>
|
||||||
<Row style={{width: "100%", marginBottom: "20px"}}>
|
<Row style={{width: "100%", marginBottom: "20px"}}>
|
||||||
<Input.Password addonBefore={i18next.t("user:Re-enter New")} placeholder={i18next.t("user:input password")} id="re-new-password"/>
|
<Input.Password addonBefore={i18next.t("user:Re-enter New")} placeholder={i18next.t("user:input password")} onChange={(e) => setRePassword(e.target.value)}/>
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user