mirror of
https://github.com/openziti/zrok.git
synced 2024-11-25 01:23:49 +01:00
update actions tab to include new way to surface password change
This commit is contained in:
parent
338b5a0936
commit
2daed61849
@ -52,7 +52,7 @@ func (handler *changePasswordHandler) Handle(params account.ChangePasswordParams
|
|||||||
return account.NewChangePasswordUnprocessableEntity().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
return account.NewChangePasswordUnprocessableEntity().WithPayload(rest_model_zrok.ErrorMessage(err.Error()))
|
||||||
}
|
}
|
||||||
|
|
||||||
nhpwd, err := hashPassword(params.Body.NewPassword)
|
nhpwd, err := HashPassword(params.Body.NewPassword)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("error hashing password for '%v': %v", a.Email, err)
|
logrus.Errorf("error hashing password for '%v': %v", a.Email, err)
|
||||||
return account.NewChangePasswordInternalServerError()
|
return account.NewChangePasswordInternalServerError()
|
||||||
|
@ -8,6 +8,10 @@ const ActionsTab = (props) => {
|
|||||||
const openResetTokenModal = () => setShowResetTokenModal(true);
|
const openResetTokenModal = () => setShowResetTokenModal(true);
|
||||||
const closeResetTokenModal = () => setShowResetTokenModal(false);
|
const closeResetTokenModal = () => setShowResetTokenModal(false);
|
||||||
|
|
||||||
|
const [showChangePasswordModal, setShowChangePasswordModal] = useState(false);
|
||||||
|
const openChangePasswordModal = () => setShowChangePasswordModal(true);
|
||||||
|
const closeChangePasswordModal = () => setShowChangePasswordModal(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={"actions-tab"}>
|
<div className={"actions-tab"}>
|
||||||
<div id={"token-regeneration"}>
|
<div id={"token-regeneration"}>
|
||||||
@ -30,6 +34,15 @@ const ActionsTab = (props) => {
|
|||||||
<Button variant={"danger"} onClick={openResetTokenModal}>Regenerate Account Token</Button>
|
<Button variant={"danger"} onClick={openResetTokenModal}>Regenerate Account Token</Button>
|
||||||
<ResetToken show={showResetTokenModal} onHide={closeResetTokenModal} user={props.user}/>
|
<ResetToken show={showResetTokenModal} onHide={closeResetTokenModal} user={props.user}/>
|
||||||
</div>
|
</div>
|
||||||
|
<div id={"change-password"} style={{"padding-top": "10px"}}>
|
||||||
|
<h3>Change Password</h3>
|
||||||
|
<p>
|
||||||
|
You can change your password to a new one here!
|
||||||
|
</p>
|
||||||
|
<p>Note that this will <strong>not</strong> log out of any already logged in sessions.</p>
|
||||||
|
<Button onClick={openChangePasswordModal}>Change Password</Button>
|
||||||
|
<ChangePassword show={showChangePasswordModal} onHide={closeChangePasswordModal} user={props.user}/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import * as account from "../../../../api/account";
|
|||||||
import * as metadata from "../../../../api/metadata";
|
import * as metadata from "../../../../api/metadata";
|
||||||
import { Button, Container, Form, Row } from "react-bootstrap";
|
import { Button, Container, Form, Row } from "react-bootstrap";
|
||||||
import PasswordForm from "../../../../components/password";
|
import PasswordForm from "../../../../components/password";
|
||||||
|
import Modal from "react-bootstrap/Modal";
|
||||||
|
|
||||||
const ChangePassword = (props) => {
|
const ChangePassword = (props) => {
|
||||||
const [oldPassword, setOldPassword] = useState('');
|
const [oldPassword, setOldPassword] = useState('');
|
||||||
@ -50,49 +51,52 @@ const ChangePassword = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let hide = () => {
|
||||||
|
props.onHide();
|
||||||
|
setMessage();
|
||||||
|
setComplete(false);
|
||||||
|
setOldPassword("");
|
||||||
|
setNewPassword("");
|
||||||
|
}
|
||||||
|
|
||||||
if (!complete) {
|
if (!complete) {
|
||||||
return (
|
return (
|
||||||
<Container fluid>
|
<Modal show={props.show} onHide={hide} centered>
|
||||||
<Row style={{ marginBottom: "1em" }}>
|
<Modal.Header closeButton>Change Password</Modal.Header>
|
||||||
<h1>Change Password</h1>
|
<Modal.Body>
|
||||||
</Row>
|
<Form onSubmit={handleSubmit}>
|
||||||
<Row>
|
<div className="container" style={{ marginBottom: "1em" }}>
|
||||||
<Container>
|
<Form.Group controlId={"oldPassword"}>
|
||||||
<Row>
|
<Form.Control
|
||||||
<Form onSubmit={handleSubmit}>
|
type={"password"}
|
||||||
<div className="container" style={{ marginBottom: "1em" }}>
|
placeholder={"Old Password"}
|
||||||
<Form.Group controlId={"oldPassword"}>
|
onChange={t => { setOldPassword(t.target.value); }}
|
||||||
<Form.Control
|
value={oldPassword}
|
||||||
type={"password"}
|
/>
|
||||||
placeholder={"Old Password"}
|
</Form.Group>
|
||||||
onChange={t => { setOldPassword(t.target.value); }}
|
</div>
|
||||||
value={oldPassword}
|
<PasswordForm
|
||||||
/>
|
setMessage={setMessage}
|
||||||
</Form.Group>
|
passwordLength={passwordLength}
|
||||||
</div>
|
passwordRequireCapital={passwordRequireCapital}
|
||||||
<PasswordForm
|
passwordRequireNumeric={passwordRequireNumeric}
|
||||||
setMessage={setMessage}
|
passwordRequireSpecial={passwordRequireSpecial}
|
||||||
passwordLength={passwordLength}
|
passwordValidSpecialCharacters={passwordValidSpecialCharacters}
|
||||||
passwordRequireCapital={passwordRequireCapital}
|
setParentPassword={setNewPassword} />
|
||||||
passwordRequireNumeric={passwordRequireNumeric}
|
<Row style={{ justifyContent: "center", marginTop: "1em" }}>
|
||||||
passwordRequireSpecial={passwordRequireSpecial}
|
<Button variant={"light"} type={"submit"}>Reset Password</Button>
|
||||||
passwordValidSpecialCharacters={passwordValidSpecialCharacters}
|
|
||||||
setParentPassword={setNewPassword} />
|
|
||||||
<Row style={{ justifyContent: "center", marginTop: "1em" }}>
|
|
||||||
<Button variant={"light"} type={"submit"}>Reset Password</Button>
|
|
||||||
</Row>
|
|
||||||
</Form>
|
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
</Form>
|
||||||
{message}
|
{message}
|
||||||
</Row>
|
</Modal.Body>
|
||||||
</Container>
|
</Modal>
|
||||||
</Row>
|
|
||||||
</Container>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (
|
return (
|
||||||
|
<Modal show={props.show} onHide={hide} centered>
|
||||||
|
<Modal.Header closeButton>Change Password</Modal.Header>
|
||||||
|
<Modal.Body>
|
||||||
<Container fluid>
|
<Container fluid>
|
||||||
<Row>
|
<Row>
|
||||||
<h1>Change Password</h1>
|
<h1>Change Password</h1>
|
||||||
@ -101,9 +105,11 @@ const ChangePassword = (props) => {
|
|||||||
Password reset successful! You can now return to the actions page.
|
Password reset successful! You can now return to the actions page.
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Button variant={"light"} onClick={() => props.returnToActions()}>Back</Button>
|
<Button variant={"light"} onClick={hide}>Back</Button>
|
||||||
</Row>
|
</Row>
|
||||||
</Container>
|
</Container>
|
||||||
|
</Modal.Body>
|
||||||
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user