mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-26 06:11:15 +00:00
Make working password inputs
This commit is contained in:
parent
497fb7014f
commit
e60af0fbf8
6 changed files with 254 additions and 240 deletions
161
src/shared/components/common/password-input.tsx
Normal file
161
src/shared/components/common/password-input.tsx
Normal file
|
@ -0,0 +1,161 @@
|
||||||
|
import { Options, passwordStrength } from "check-password-strength";
|
||||||
|
import classNames from "classnames";
|
||||||
|
import { NoOptionI18nKeys } from "i18next";
|
||||||
|
import { Component, FormEventHandler, linkEvent } from "inferno";
|
||||||
|
import { NavLink } from "inferno-router";
|
||||||
|
import { I18NextService } from "../../services";
|
||||||
|
|
||||||
|
interface PasswordInputProps {
|
||||||
|
id: string;
|
||||||
|
value?: string;
|
||||||
|
onInput: FormEventHandler<HTMLInputElement>;
|
||||||
|
className?: string;
|
||||||
|
showStrength?: boolean;
|
||||||
|
cols?: number | null;
|
||||||
|
label?: string;
|
||||||
|
showForgotLink?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PasswordInputState {
|
||||||
|
show: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const passwordStrengthOptions: Options<string> = [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
value: "very_weak",
|
||||||
|
minDiversity: 0,
|
||||||
|
minLength: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
value: "weak",
|
||||||
|
minDiversity: 2,
|
||||||
|
minLength: 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
value: "medium",
|
||||||
|
minDiversity: 3,
|
||||||
|
minLength: 12,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 3,
|
||||||
|
value: "strong",
|
||||||
|
minDiversity: 4,
|
||||||
|
minLength: 14,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
function handleToggleShow(i: PasswordInput) {
|
||||||
|
i.setState(prev => ({
|
||||||
|
...prev,
|
||||||
|
show: !prev.show,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
class PasswordInput extends Component<PasswordInputProps, PasswordInputState> {
|
||||||
|
state: PasswordInputState = {
|
||||||
|
show: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor(props: PasswordInputProps, context: any) {
|
||||||
|
super(props, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {
|
||||||
|
props: {
|
||||||
|
id,
|
||||||
|
value,
|
||||||
|
onInput,
|
||||||
|
className,
|
||||||
|
showStrength,
|
||||||
|
cols = 10,
|
||||||
|
label,
|
||||||
|
showForgotLink,
|
||||||
|
},
|
||||||
|
state: { show },
|
||||||
|
} = this;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
className={classNames(className, {
|
||||||
|
row: !!cols,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{label && (
|
||||||
|
<label
|
||||||
|
className={`col-sm-${12 - (cols ?? 0)} col-form-label`}
|
||||||
|
htmlFor={id}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</label>
|
||||||
|
)}
|
||||||
|
<div
|
||||||
|
className={classNames({
|
||||||
|
[`col-sm-${cols}`]: !!cols,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<div className="input-group">
|
||||||
|
<input
|
||||||
|
type={show ? "text" : "password"}
|
||||||
|
className="form-control"
|
||||||
|
aria-describedby={id}
|
||||||
|
autoComplete="on"
|
||||||
|
onInput={onInput}
|
||||||
|
value={value}
|
||||||
|
required
|
||||||
|
maxLength={60}
|
||||||
|
minLength={showStrength ? 10 : 0}
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
className="btn btn-outline-dark"
|
||||||
|
type="button"
|
||||||
|
id={id}
|
||||||
|
onClick={linkEvent(this, handleToggleShow)}
|
||||||
|
>
|
||||||
|
Button
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{showForgotLink && (
|
||||||
|
<NavLink
|
||||||
|
className="btn p-0 btn-link d-inline-block float-right text-muted small font-weight-bold pointer-events not-allowed"
|
||||||
|
to="/login_reset"
|
||||||
|
>
|
||||||
|
{I18NextService.i18n.t("forgot_password")}
|
||||||
|
</NavLink>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{showStrength && value && (
|
||||||
|
<div className={this.passwordColorClass}>
|
||||||
|
{I18NextService.i18n.t(this.passwordStrength as NoOptionI18nKeys)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
get passwordStrength(): string | undefined {
|
||||||
|
const password = this.props.value;
|
||||||
|
return password
|
||||||
|
? passwordStrength(password, passwordStrengthOptions).value
|
||||||
|
: undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
get passwordColorClass(): string {
|
||||||
|
const strength = this.passwordStrength;
|
||||||
|
|
||||||
|
if (strength && ["weak", "medium"].includes(strength)) {
|
||||||
|
return "text-warning";
|
||||||
|
} else if (strength == "strong") {
|
||||||
|
return "text-success";
|
||||||
|
} else {
|
||||||
|
return "text-danger";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PasswordInput;
|
|
@ -1,13 +1,13 @@
|
||||||
import { myAuth, setIsoData } from "@utils/app";
|
import { myAuth, setIsoData } from "@utils/app";
|
||||||
import { isBrowser } from "@utils/browser";
|
import { isBrowser } from "@utils/browser";
|
||||||
import { Component, linkEvent } from "inferno";
|
import { Component, linkEvent } from "inferno";
|
||||||
import { NavLink } from "inferno-router";
|
|
||||||
import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
|
import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
|
||||||
import { I18NextService, UserService } from "../../services";
|
import { I18NextService, UserService } from "../../services";
|
||||||
import { HttpService, RequestState } from "../../services/HttpService";
|
import { HttpService, RequestState } from "../../services/HttpService";
|
||||||
import { toast } from "../../toast";
|
import { toast } from "../../toast";
|
||||||
import { HtmlTags } from "../common/html-tags";
|
import { HtmlTags } from "../common/html-tags";
|
||||||
import { Spinner } from "../common/icon";
|
import { Spinner } from "../common/icon";
|
||||||
|
import PasswordInput from "../common/password-input";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
loginRes: RequestState<LoginResponse>;
|
loginRes: RequestState<LoginResponse>;
|
||||||
|
@ -90,28 +90,14 @@ export class Login extends Component<any, State> {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label className="col-sm-2 col-form-label" htmlFor="login-password">
|
<PasswordInput
|
||||||
{I18NextService.i18n.t("password")}
|
id="login-password"
|
||||||
</label>
|
value={this.state.form.password}
|
||||||
<div className="col-sm-10">
|
onInput={linkEvent(this, this.handleLoginPasswordChange)}
|
||||||
<input
|
label={I18NextService.i18n.t("password") ?? undefined}
|
||||||
type="password"
|
showForgotLink
|
||||||
id="login-password"
|
/>
|
||||||
value={this.state.form.password}
|
|
||||||
onInput={linkEvent(this, this.handleLoginPasswordChange)}
|
|
||||||
className="form-control"
|
|
||||||
autoComplete="current-password"
|
|
||||||
required
|
|
||||||
maxLength={60}
|
|
||||||
/>
|
|
||||||
<NavLink
|
|
||||||
className="btn p-0 btn-link d-inline-block float-right text-muted small font-weight-bold pointer-events not-allowed"
|
|
||||||
to="/login_reset"
|
|
||||||
>
|
|
||||||
{I18NextService.i18n.t("forgot_password")}
|
|
||||||
</NavLink>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{this.state.showTotp && (
|
{this.state.showTotp && (
|
||||||
<div className="mb-3 row">
|
<div className="mb-3 row">
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
import { I18NextService, UserService } from "../../services";
|
import { I18NextService, UserService } from "../../services";
|
||||||
import { HttpService, RequestState } from "../../services/HttpService";
|
import { HttpService, RequestState } from "../../services/HttpService";
|
||||||
import { Spinner } from "../common/icon";
|
import { Spinner } from "../common/icon";
|
||||||
|
import PasswordInput from "../common/password-input";
|
||||||
import { SiteForm } from "./site-form";
|
import { SiteForm } from "./site-form";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
|
@ -121,41 +122,21 @@ export class Setup extends Component<any, State> {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label className="col-sm-2 col-form-label" htmlFor="password">
|
<PasswordInput
|
||||||
{I18NextService.i18n.t("password")}
|
id="password"
|
||||||
</label>
|
value={this.state.form.password}
|
||||||
<div className="col-sm-10">
|
onInput={linkEvent(this, this.handleRegisterPasswordChange)}
|
||||||
<input
|
label={I18NextService.i18n.t("password") ?? undefined}
|
||||||
type="password"
|
/>
|
||||||
id="password"
|
|
||||||
value={this.state.form.password}
|
|
||||||
onInput={linkEvent(this, this.handleRegisterPasswordChange)}
|
|
||||||
className="form-control"
|
|
||||||
required
|
|
||||||
autoComplete="new-password"
|
|
||||||
minLength={10}
|
|
||||||
maxLength={60}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label className="col-sm-2 col-form-label" htmlFor="verify-password">
|
<PasswordInput
|
||||||
{I18NextService.i18n.t("verify_password")}
|
id="verify-password"
|
||||||
</label>
|
value={this.state.form.password_verify}
|
||||||
<div className="col-sm-10">
|
onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)}
|
||||||
<input
|
label={I18NextService.i18n.t("verify_password") ?? undefined}
|
||||||
type="password"
|
/>
|
||||||
id="verify-password"
|
|
||||||
value={this.state.form.password_verify}
|
|
||||||
onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)}
|
|
||||||
className="form-control"
|
|
||||||
required
|
|
||||||
autoComplete="new-password"
|
|
||||||
minLength={10}
|
|
||||||
maxLength={60}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3 row">
|
||||||
<div className="col-sm-10">
|
<div className="col-sm-10">
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import { myAuth, setIsoData } from "@utils/app";
|
import { myAuth, setIsoData } from "@utils/app";
|
||||||
import { isBrowser } from "@utils/browser";
|
import { isBrowser } from "@utils/browser";
|
||||||
import { validEmail } from "@utils/helpers";
|
import { validEmail } from "@utils/helpers";
|
||||||
import { Options, passwordStrength } from "check-password-strength";
|
|
||||||
import { NoOptionI18nKeys } from "i18next";
|
|
||||||
import { Component, linkEvent } from "inferno";
|
import { Component, linkEvent } from "inferno";
|
||||||
import { T } from "inferno-i18next-dess";
|
import { T } from "inferno-i18next-dess";
|
||||||
import {
|
import {
|
||||||
|
@ -20,33 +18,7 @@ import { toast } from "../../toast";
|
||||||
import { HtmlTags } from "../common/html-tags";
|
import { HtmlTags } from "../common/html-tags";
|
||||||
import { Icon, Spinner } from "../common/icon";
|
import { Icon, Spinner } from "../common/icon";
|
||||||
import { MarkdownTextArea } from "../common/markdown-textarea";
|
import { MarkdownTextArea } from "../common/markdown-textarea";
|
||||||
|
import PasswordInput from "../common/password-input";
|
||||||
const passwordStrengthOptions: Options<string> = [
|
|
||||||
{
|
|
||||||
id: 0,
|
|
||||||
value: "very_weak",
|
|
||||||
minDiversity: 0,
|
|
||||||
minLength: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
value: "weak",
|
|
||||||
minDiversity: 2,
|
|
||||||
minLength: 10,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
value: "medium",
|
|
||||||
minDiversity: 3,
|
|
||||||
minLength: 12,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
value: "strong",
|
|
||||||
minDiversity: 4,
|
|
||||||
minLength: 14,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
registerRes: RequestState<LoginResponse>;
|
registerRes: RequestState<LoginResponse>;
|
||||||
|
@ -210,57 +182,26 @@ export class Signup extends Component<any, State> {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label
|
<PasswordInput
|
||||||
className="col-sm-2 col-form-label"
|
id="register-password"
|
||||||
htmlFor="register-password"
|
value={this.state.form.password}
|
||||||
>
|
onInput={linkEvent(this, this.handleRegisterPasswordChange)}
|
||||||
{I18NextService.i18n.t("password")}
|
showStrength
|
||||||
</label>
|
label={I18NextService.i18n.t("password") ?? undefined}
|
||||||
<div className="col-sm-10">
|
/>
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
id="register-password"
|
|
||||||
value={this.state.form.password}
|
|
||||||
autoComplete="new-password"
|
|
||||||
onInput={linkEvent(this, this.handleRegisterPasswordChange)}
|
|
||||||
minLength={10}
|
|
||||||
maxLength={60}
|
|
||||||
className="form-control"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
{this.state.form.password && (
|
|
||||||
<div className={this.passwordColorClass}>
|
|
||||||
{I18NextService.i18n.t(
|
|
||||||
this.passwordStrength as NoOptionI18nKeys
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label
|
<PasswordInput
|
||||||
className="col-sm-2 col-form-label"
|
id="register-verify-password"
|
||||||
htmlFor="register-verify-password"
|
value={this.state.form.password_verify}
|
||||||
>
|
onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)}
|
||||||
{I18NextService.i18n.t("verify_password")}
|
label={I18NextService.i18n.t("verify_password") ?? undefined}
|
||||||
</label>
|
/>
|
||||||
<div className="col-sm-10">
|
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
id="register-verify-password"
|
|
||||||
value={this.state.form.password_verify}
|
|
||||||
autoComplete="new-password"
|
|
||||||
onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)}
|
|
||||||
maxLength={60}
|
|
||||||
className="form-control"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{siteView.local_site.registration_mode == "RequireApplication" && (
|
{siteView.local_site.registration_mode === "RequireApplication" && (
|
||||||
<>
|
<>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3 row">
|
||||||
<div className="offset-sm-2 col-sm-10">
|
<div className="offset-sm-2 col-sm-10">
|
||||||
|
@ -411,25 +352,6 @@ export class Signup extends Component<any, State> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get passwordStrength(): string | undefined {
|
|
||||||
const password = this.state.form.password;
|
|
||||||
return password
|
|
||||||
? passwordStrength(password, passwordStrengthOptions).value
|
|
||||||
: undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
get passwordColorClass(): string {
|
|
||||||
const strength = this.passwordStrength;
|
|
||||||
|
|
||||||
if (strength && ["weak", "medium"].includes(strength)) {
|
|
||||||
return "text-warning";
|
|
||||||
} else if (strength == "strong") {
|
|
||||||
return "text-success";
|
|
||||||
} else {
|
|
||||||
return "text-danger";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleRegisterSubmit(i: Signup, event: any) {
|
async handleRegisterSubmit(i: Signup, event: any) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { HttpService, I18NextService, UserService } from "../../services";
|
||||||
import { RequestState } from "../../services/HttpService";
|
import { RequestState } from "../../services/HttpService";
|
||||||
import { HtmlTags } from "../common/html-tags";
|
import { HtmlTags } from "../common/html-tags";
|
||||||
import { Spinner } from "../common/icon";
|
import { Spinner } from "../common/icon";
|
||||||
|
import PasswordInput from "../common/password-input";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
passwordChangeRes: RequestState<LoginResponse>;
|
passwordChangeRes: RequestState<LoginResponse>;
|
||||||
|
@ -60,37 +61,22 @@ export class PasswordChange extends Component<any, State> {
|
||||||
passwordChangeForm() {
|
passwordChangeForm() {
|
||||||
return (
|
return (
|
||||||
<form onSubmit={linkEvent(this, this.handlePasswordChangeSubmit)}>
|
<form onSubmit={linkEvent(this, this.handlePasswordChangeSubmit)}>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label className="col-sm-2 col-form-label" htmlFor="new-password">
|
<PasswordInput
|
||||||
{I18NextService.i18n.t("new_password")}
|
id="new-password"
|
||||||
</label>
|
value={this.state.form.password}
|
||||||
<div className="col-sm-10">
|
onInput={linkEvent(this, this.handlePasswordChange)}
|
||||||
<input
|
showStrength
|
||||||
id="new-password"
|
label={I18NextService.i18n.t("new_password") ?? undefined}
|
||||||
type="password"
|
/>
|
||||||
value={this.state.form.password}
|
|
||||||
onInput={linkEvent(this, this.handlePasswordChange)}
|
|
||||||
className="form-control"
|
|
||||||
required
|
|
||||||
maxLength={60}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label className="col-sm-2 col-form-label" htmlFor="verify-password">
|
<PasswordInput
|
||||||
{I18NextService.i18n.t("verify_password")}
|
id="password"
|
||||||
</label>
|
value={this.state.form.password_verify}
|
||||||
<div className="col-sm-10">
|
onInput={linkEvent(this, this.handleVerifyPasswordChange)}
|
||||||
<input
|
label={I18NextService.i18n.t("verify_password") ?? undefined}
|
||||||
id="verify-password"
|
/>
|
||||||
type="password"
|
|
||||||
value={this.state.form.password_verify}
|
|
||||||
onInput={linkEvent(this, this.handleVerifyPasswordChange)}
|
|
||||||
className="form-control"
|
|
||||||
required
|
|
||||||
maxLength={60}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3 row">
|
||||||
<div className="col-sm-10">
|
<div className="col-sm-10">
|
||||||
|
|
|
@ -40,6 +40,7 @@ import { ImageUploadForm } from "../common/image-upload-form";
|
||||||
import { LanguageSelect } from "../common/language-select";
|
import { LanguageSelect } from "../common/language-select";
|
||||||
import { ListingTypeSelect } from "../common/listing-type-select";
|
import { ListingTypeSelect } from "../common/listing-type-select";
|
||||||
import { MarkdownTextArea } from "../common/markdown-textarea";
|
import { MarkdownTextArea } from "../common/markdown-textarea";
|
||||||
|
import PasswordInput from "../common/password-input";
|
||||||
import { SearchableSelect } from "../common/searchable-select";
|
import { SearchableSelect } from "../common/searchable-select";
|
||||||
import { SortSelect } from "../common/sort-select";
|
import { SortSelect } from "../common/sort-select";
|
||||||
import Tabs from "../common/tabs";
|
import Tabs from "../common/tabs";
|
||||||
|
@ -318,59 +319,33 @@ export class Settings extends Component<any, SettingsState> {
|
||||||
<>
|
<>
|
||||||
<h2 className="h5">{I18NextService.i18n.t("change_password")}</h2>
|
<h2 className="h5">{I18NextService.i18n.t("change_password")}</h2>
|
||||||
<form onSubmit={linkEvent(this, this.handleChangePasswordSubmit)}>
|
<form onSubmit={linkEvent(this, this.handleChangePasswordSubmit)}>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label className="col-sm-5 col-form-label" htmlFor="user-password">
|
<PasswordInput
|
||||||
{I18NextService.i18n.t("new_password")}
|
id="new-password"
|
||||||
</label>
|
value={this.state.changePasswordForm.new_password}
|
||||||
<div className="col-sm-7">
|
onInput={linkEvent(this, this.handleNewPasswordChange)}
|
||||||
<input
|
cols={7}
|
||||||
type="password"
|
showStrength
|
||||||
id="user-password"
|
label={I18NextService.i18n.t("new_password") ?? undefined}
|
||||||
className="form-control"
|
/>
|
||||||
value={this.state.changePasswordForm.new_password}
|
|
||||||
autoComplete="new-password"
|
|
||||||
maxLength={60}
|
|
||||||
onInput={linkEvent(this, this.handleNewPasswordChange)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label
|
<PasswordInput
|
||||||
className="col-sm-5 col-form-label"
|
id="verify-new-password"
|
||||||
htmlFor="user-verify-password"
|
value={this.state.changePasswordForm.new_password_verify}
|
||||||
>
|
onInput={linkEvent(this, this.handleNewPasswordVerifyChange)}
|
||||||
{I18NextService.i18n.t("verify_password")}
|
cols={7}
|
||||||
</label>
|
label={I18NextService.i18n.t("verify_password") ?? undefined}
|
||||||
<div className="col-sm-7">
|
/>
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
id="user-verify-password"
|
|
||||||
className="form-control"
|
|
||||||
value={this.state.changePasswordForm.new_password_verify}
|
|
||||||
autoComplete="new-password"
|
|
||||||
maxLength={60}
|
|
||||||
onInput={linkEvent(this, this.handleNewPasswordVerifyChange)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-3 row">
|
<div className="mb-3">
|
||||||
<label
|
<PasswordInput
|
||||||
className="col-sm-5 col-form-label"
|
id="user-old-password"
|
||||||
htmlFor="user-old-password"
|
value={this.state.changePasswordForm.old_password}
|
||||||
>
|
onInput={linkEvent(this, this.handleOldPasswordChange)}
|
||||||
{I18NextService.i18n.t("old_password")}
|
cols={7}
|
||||||
</label>
|
label={I18NextService.i18n.t("old_password") ?? undefined}
|
||||||
<div className="col-sm-7">
|
/>
|
||||||
<input
|
|
||||||
type="password"
|
|
||||||
id="user-old-password"
|
|
||||||
className="form-control"
|
|
||||||
value={this.state.changePasswordForm.old_password}
|
|
||||||
autoComplete="new-password"
|
|
||||||
maxLength={60}
|
|
||||||
onInput={linkEvent(this, this.handleOldPasswordChange)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="input-group mb-3">
|
<div className="input-group mb-3">
|
||||||
<button
|
<button
|
||||||
|
@ -825,19 +800,22 @@ export class Settings extends Component<any, SettingsState> {
|
||||||
</button>
|
</button>
|
||||||
{this.state.deleteAccountShowConfirm && (
|
{this.state.deleteAccountShowConfirm && (
|
||||||
<>
|
<>
|
||||||
<div className="my-2 alert alert-danger" role="alert">
|
<label
|
||||||
|
className="my-2 alert alert-danger d-block"
|
||||||
|
role="alert"
|
||||||
|
htmlFor="password-delete-account"
|
||||||
|
>
|
||||||
{I18NextService.i18n.t("delete_account_confirm")}
|
{I18NextService.i18n.t("delete_account_confirm")}
|
||||||
</div>
|
</label>
|
||||||
<input
|
<PasswordInput
|
||||||
type="password"
|
id="password-delete-account"
|
||||||
value={this.state.deleteAccountForm.password}
|
value={this.state.deleteAccountForm.password}
|
||||||
autoComplete="new-password"
|
|
||||||
maxLength={60}
|
|
||||||
onInput={linkEvent(
|
onInput={linkEvent(
|
||||||
this,
|
this,
|
||||||
this.handleDeleteAccountPasswordChange
|
this.handleDeleteAccountPasswordChange
|
||||||
)}
|
)}
|
||||||
className="form-control my-2"
|
className="my-2"
|
||||||
|
cols={null}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
className="btn btn-danger me-4"
|
className="btn btn-danger me-4"
|
||||||
|
|
Loading…
Reference in a new issue