Merge branch 'master' into save-key-on-desktop
This commit is contained in:
commit
83bf1f4e79
|
@ -8,6 +8,7 @@ import FormPaperTitle from './Form/FormPaper/Title';
|
||||||
import FormPaperFooter from './Form/FormPaper/Footer';
|
import FormPaperFooter from './Form/FormPaper/Footer';
|
||||||
import LinkButton from './pages/gallery/LinkButton';
|
import LinkButton from './pages/gallery/LinkButton';
|
||||||
import SingleInputForm, { SingleInputFormProps } from './SingleInputForm';
|
import SingleInputForm, { SingleInputFormProps } from './SingleInputForm';
|
||||||
|
import { Input } from '@mui/material';
|
||||||
|
|
||||||
interface LoginProps {
|
interface LoginProps {
|
||||||
signUp: () => void;
|
signUp: () => void;
|
||||||
|
@ -48,6 +49,8 @@ export default function Login(props: LoginProps) {
|
||||||
fieldType="email"
|
fieldType="email"
|
||||||
placeholder={constants.ENTER_EMAIL}
|
placeholder={constants.ENTER_EMAIL}
|
||||||
buttonText={constants.LOGIN}
|
buttonText={constants.LOGIN}
|
||||||
|
autoComplete="username"
|
||||||
|
hiddenPostInput={<Input hidden type="password" value="" />}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<FormPaperFooter>
|
<FormPaperFooter>
|
||||||
|
|
|
@ -3,9 +3,10 @@ import constants from 'utils/strings/constants';
|
||||||
import { Formik } from 'formik';
|
import { Formik } from 'formik';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import SubmitButton from './SubmitButton';
|
import SubmitButton from './SubmitButton';
|
||||||
import { Box, TextField, Typography } from '@mui/material';
|
import { Box, Input, TextField, Typography } from '@mui/material';
|
||||||
|
|
||||||
export interface SetPasswordFormProps {
|
export interface SetPasswordFormProps {
|
||||||
|
userEmail: string;
|
||||||
callback: (
|
callback: (
|
||||||
passphrase: string,
|
passphrase: string,
|
||||||
setFieldError: (
|
setFieldError: (
|
||||||
|
@ -65,9 +66,19 @@ function SetPasswordForm(props: SetPasswordFormProps) {
|
||||||
{constants.ENTER_ENC_PASSPHRASE}
|
{constants.ENTER_ENC_PASSPHRASE}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
|
<Input
|
||||||
|
hidden
|
||||||
|
name="email"
|
||||||
|
id="email"
|
||||||
|
autoComplete="username"
|
||||||
|
type="email"
|
||||||
|
value={props.userEmail}
|
||||||
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="filled"
|
name="password"
|
||||||
|
id="password"
|
||||||
|
autoComplete="new-password"
|
||||||
type="password"
|
type="password"
|
||||||
label={constants.PASSPHRASE_HINT}
|
label={constants.PASSPHRASE_HINT}
|
||||||
value={values.passphrase}
|
value={values.passphrase}
|
||||||
|
@ -79,7 +90,9 @@ function SetPasswordForm(props: SetPasswordFormProps) {
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
variant="filled"
|
name="confirm-password"
|
||||||
|
id="confirm-password"
|
||||||
|
autoComplete="new-password"
|
||||||
type="password"
|
type="password"
|
||||||
label={constants.CONFIRM_PASSPHRASE}
|
label={constants.CONFIRM_PASSPHRASE}
|
||||||
value={values.confirm}
|
value={values.confirm}
|
||||||
|
|
|
@ -121,6 +121,9 @@ export default function SignUp(props: SignUpProps) {
|
||||||
<VerticallyCentered sx={{ mb: 1 }}>
|
<VerticallyCentered sx={{ mb: 1 }}>
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
|
id="email"
|
||||||
|
name="email"
|
||||||
|
autoComplete="username"
|
||||||
type="email"
|
type="email"
|
||||||
label={constants.ENTER_EMAIL}
|
label={constants.ENTER_EMAIL}
|
||||||
value={values.email}
|
value={values.email}
|
||||||
|
@ -133,6 +136,9 @@ export default function SignUp(props: SignUpProps) {
|
||||||
|
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
|
id="password"
|
||||||
|
name="password"
|
||||||
|
autoComplete="new-password"
|
||||||
type="password"
|
type="password"
|
||||||
label={constants.PASSPHRASE_HINT}
|
label={constants.PASSPHRASE_HINT}
|
||||||
value={values.passphrase}
|
value={values.passphrase}
|
||||||
|
@ -144,6 +150,9 @@ export default function SignUp(props: SignUpProps) {
|
||||||
|
|
||||||
<TextField
|
<TextField
|
||||||
fullWidth
|
fullWidth
|
||||||
|
id="confirm-password"
|
||||||
|
name="confirm-password"
|
||||||
|
autoComplete="new-password"
|
||||||
type="password"
|
type="password"
|
||||||
label={constants.CONFIRM_PASSPHRASE}
|
label={constants.CONFIRM_PASSPHRASE}
|
||||||
value={values.confirm}
|
value={values.confirm}
|
||||||
|
|
|
@ -23,6 +23,9 @@ export interface SingleInputFormProps {
|
||||||
initialValue?: string;
|
initialValue?: string;
|
||||||
secondaryButtonAction?: () => void;
|
secondaryButtonAction?: () => void;
|
||||||
disableAutoFocus?: boolean;
|
disableAutoFocus?: boolean;
|
||||||
|
hiddenPreInput?: any;
|
||||||
|
hiddenPostInput?: any;
|
||||||
|
autoComplete?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SingleInputForm(props: SingleInputFormProps) {
|
export default function SingleInputForm(props: SingleInputFormProps) {
|
||||||
|
@ -81,10 +84,13 @@ export default function SingleInputForm(props: SingleInputFormProps) {
|
||||||
validateOnBlur={false}>
|
validateOnBlur={false}>
|
||||||
{({ values, errors, handleChange, handleSubmit }) => (
|
{({ values, errors, handleChange, handleSubmit }) => (
|
||||||
<form noValidate onSubmit={handleSubmit}>
|
<form noValidate onSubmit={handleSubmit}>
|
||||||
|
{props.hiddenPreInput}
|
||||||
<TextField
|
<TextField
|
||||||
variant="filled"
|
variant="filled"
|
||||||
fullWidth
|
fullWidth
|
||||||
type={showPassword ? 'text' : props.fieldType}
|
type={showPassword ? 'text' : props.fieldType}
|
||||||
|
id={props.fieldType}
|
||||||
|
name={props.fieldType}
|
||||||
label={props.placeholder}
|
label={props.placeholder}
|
||||||
value={values.inputValue}
|
value={values.inputValue}
|
||||||
onChange={handleChange('inputValue')}
|
onChange={handleChange('inputValue')}
|
||||||
|
@ -92,6 +98,7 @@ export default function SingleInputForm(props: SingleInputFormProps) {
|
||||||
helperText={errors.inputValue}
|
helperText={errors.inputValue}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
autoFocus={!props.disableAutoFocus}
|
autoFocus={!props.disableAutoFocus}
|
||||||
|
autoComplete={props.autoComplete}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
endAdornment: props.fieldType === 'password' && (
|
endAdornment: props.fieldType === 'password' && (
|
||||||
<ShowHidePassword
|
<ShowHidePassword
|
||||||
|
@ -106,6 +113,7 @@ export default function SingleInputForm(props: SingleInputFormProps) {
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{props.hiddenPostInput}
|
||||||
<FlexWrapper justifyContent={'flex-end'}>
|
<FlexWrapper justifyContent={'flex-end'}>
|
||||||
{props.secondaryButtonAction && (
|
{props.secondaryButtonAction && (
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -14,7 +14,7 @@ import SetPasswordForm, {
|
||||||
} from 'components/SetPasswordForm';
|
} from 'components/SetPasswordForm';
|
||||||
import { SESSION_KEYS } from 'utils/storage/sessionStorage';
|
import { SESSION_KEYS } from 'utils/storage/sessionStorage';
|
||||||
import { PAGES } from 'constants/pages';
|
import { PAGES } from 'constants/pages';
|
||||||
import { KEK, UpdatedKey } from 'types/user';
|
import { KEK, UpdatedKey, User } from 'types/user';
|
||||||
import LinkButton from 'components/pages/gallery/LinkButton';
|
import LinkButton from 'components/pages/gallery/LinkButton';
|
||||||
import VerticallyCentered from 'components/Container';
|
import VerticallyCentered from 'components/Container';
|
||||||
import FormPaper from 'components/Form/FormPaper';
|
import FormPaper from 'components/Form/FormPaper';
|
||||||
|
@ -24,9 +24,11 @@ import FormPaperTitle from 'components/Form/FormPaper/Title';
|
||||||
export default function ChangePassword() {
|
export default function ChangePassword() {
|
||||||
const [token, setToken] = useState<string>();
|
const [token, setToken] = useState<string>();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const [user, setUser] = useState<User>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const user = getData(LS_KEYS.USER);
|
const user = getData(LS_KEYS.USER);
|
||||||
|
setUser(user);
|
||||||
if (!user?.token) {
|
if (!user?.token) {
|
||||||
router.push(PAGES.ROOT);
|
router.push(PAGES.ROOT);
|
||||||
} else {
|
} else {
|
||||||
|
@ -82,6 +84,7 @@ export default function ChangePassword() {
|
||||||
<FormPaper>
|
<FormPaper>
|
||||||
<FormPaperTitle>{constants.CHANGE_PASSWORD}</FormPaperTitle>
|
<FormPaperTitle>{constants.CHANGE_PASSWORD}</FormPaperTitle>
|
||||||
<SetPasswordForm
|
<SetPasswordForm
|
||||||
|
userEmail={user?.email}
|
||||||
callback={onSubmit}
|
callback={onSubmit}
|
||||||
buttonText={constants.CHANGE_PASSWORD}
|
buttonText={constants.CHANGE_PASSWORD}
|
||||||
back={
|
back={
|
||||||
|
|
|
@ -17,7 +17,7 @@ import SingleInputForm, {
|
||||||
} from 'components/SingleInputForm';
|
} from 'components/SingleInputForm';
|
||||||
import { AppContext } from 'pages/_app';
|
import { AppContext } from 'pages/_app';
|
||||||
import { logError } from 'utils/sentry';
|
import { logError } from 'utils/sentry';
|
||||||
import { KeyAttributes } from 'types/user';
|
import { KeyAttributes, User } from 'types/user';
|
||||||
import FormContainer from 'components/Form/FormContainer';
|
import FormContainer from 'components/Form/FormContainer';
|
||||||
import FormPaper from 'components/Form/FormPaper';
|
import FormPaper from 'components/Form/FormPaper';
|
||||||
import FormPaperTitle from 'components/Form/FormPaper/Title';
|
import FormPaperTitle from 'components/Form/FormPaper/Title';
|
||||||
|
@ -28,16 +28,18 @@ import isElectron from 'is-electron';
|
||||||
import desktopService from 'services/desktopService';
|
import desktopService from 'services/desktopService';
|
||||||
import VerticallyCentered from 'components/Container';
|
import VerticallyCentered from 'components/Container';
|
||||||
import EnteSpinner from 'components/EnteSpinner';
|
import EnteSpinner from 'components/EnteSpinner';
|
||||||
|
import { Input } from '@mui/material';
|
||||||
|
|
||||||
export default function Credentials() {
|
export default function Credentials() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [keyAttributes, setKeyAttributes] = useState<KeyAttributes>();
|
const [keyAttributes, setKeyAttributes] = useState<KeyAttributes>();
|
||||||
const appContext = useContext(AppContext);
|
const appContext = useContext(AppContext);
|
||||||
|
const [user, setUser] = useState<User>();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
router.prefetch(PAGES.GALLERY);
|
router.prefetch(PAGES.GALLERY);
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
const user = getData(LS_KEYS.USER);
|
const user = getData(LS_KEYS.USER);
|
||||||
|
setUser(user);
|
||||||
const keyAttributes = getData(LS_KEYS.KEY_ATTRIBUTES);
|
const keyAttributes = getData(LS_KEYS.KEY_ATTRIBUTES);
|
||||||
let key = getKey(SESSION_KEYS.ENCRYPTION_KEY);
|
let key = getKey(SESSION_KEYS.ENCRYPTION_KEY);
|
||||||
if (!key && isElectron()) {
|
if (!key && isElectron()) {
|
||||||
|
@ -141,6 +143,17 @@ export default function Credentials() {
|
||||||
callback={verifyPassphrase}
|
callback={verifyPassphrase}
|
||||||
placeholder={constants.RETURN_PASSPHRASE_HINT}
|
placeholder={constants.RETURN_PASSPHRASE_HINT}
|
||||||
buttonText={constants.VERIFY_PASSPHRASE}
|
buttonText={constants.VERIFY_PASSPHRASE}
|
||||||
|
hiddenPreInput={
|
||||||
|
<Input
|
||||||
|
id="email"
|
||||||
|
name="email"
|
||||||
|
autoComplete="username"
|
||||||
|
type="email"
|
||||||
|
hidden
|
||||||
|
value={user?.email}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
autoComplete={'current-password'}
|
||||||
fieldType="password"
|
fieldType="password"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import FormTitle from 'components/Form/FormPaper/Title';
|
||||||
|
|
||||||
export default function Generate() {
|
export default function Generate() {
|
||||||
const [token, setToken] = useState<string>();
|
const [token, setToken] = useState<string>();
|
||||||
|
const [user, setUser] = useState<User>();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [recoverModalView, setRecoveryModalView] = useState(false);
|
const [recoverModalView, setRecoveryModalView] = useState(false);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
@ -37,6 +38,7 @@ export default function Generate() {
|
||||||
router.prefetch(PAGES.GALLERY);
|
router.prefetch(PAGES.GALLERY);
|
||||||
router.prefetch(PAGES.CREDENTIALS);
|
router.prefetch(PAGES.CREDENTIALS);
|
||||||
const user: User = getData(LS_KEYS.USER);
|
const user: User = getData(LS_KEYS.USER);
|
||||||
|
setUser(user);
|
||||||
if (!user?.token) {
|
if (!user?.token) {
|
||||||
router.push(PAGES.ROOT);
|
router.push(PAGES.ROOT);
|
||||||
} else if (key) {
|
} else if (key) {
|
||||||
|
@ -100,6 +102,7 @@ export default function Generate() {
|
||||||
<FormPaper>
|
<FormPaper>
|
||||||
<FormTitle>{constants.SET_PASSPHRASE}</FormTitle>
|
<FormTitle>{constants.SET_PASSPHRASE}</FormTitle>
|
||||||
<SetPasswordForm
|
<SetPasswordForm
|
||||||
|
userEmail={user?.email}
|
||||||
callback={onSubmit}
|
callback={onSubmit}
|
||||||
buttonText={constants.SET_PASSPHRASE}
|
buttonText={constants.SET_PASSPHRASE}
|
||||||
back={logoutUser}
|
back={logoutUser}
|
||||||
|
|
|
@ -140,6 +140,7 @@ export default function Verify() {
|
||||||
</Typography>
|
</Typography>
|
||||||
<SingleInputForm
|
<SingleInputForm
|
||||||
fieldType="text"
|
fieldType="text"
|
||||||
|
autoComplete="one-time-code"
|
||||||
placeholder={constants.ENTER_OTT}
|
placeholder={constants.ENTER_OTT}
|
||||||
buttonText={constants.VERIFY}
|
buttonText={constants.VERIFY}
|
||||||
callback={onSubmit}
|
callback={onSubmit}
|
||||||
|
|
Loading…
Reference in a new issue