renamed passwordForm to SetPasswordForm
This commit is contained in:
parent
a7a8515431
commit
b9f1870760
|
@ -19,7 +19,7 @@ interface formValues {
|
|||
passphrase: string;
|
||||
confirm: string;
|
||||
}
|
||||
function SetPassword(props: Props) {
|
||||
function SetPasswordForm(props: Props) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const onSubmit = async (
|
||||
values: formValues,
|
||||
|
@ -94,7 +94,7 @@ function SetPassword(props: Props) {
|
|||
<Form.Control
|
||||
type="password"
|
||||
placeholder={
|
||||
constants.PASSPHRASE_CONFIRM
|
||||
constants.RE_ENTER_PASSPHRASE
|
||||
}
|
||||
value={values.confirm}
|
||||
onChange={handleChange('confirm')}
|
||||
|
@ -129,4 +129,4 @@ function SetPassword(props: Props) {
|
|||
</Container>
|
||||
);
|
||||
}
|
||||
export default SetPassword;
|
||||
export default SetPasswordForm;
|
|
@ -10,7 +10,7 @@ import CryptoWorker, {
|
|||
} from 'utils/crypto';
|
||||
import { getActualKey } from 'utils/common/key';
|
||||
import { logoutUser, setKeys, UpdatedKey } from 'services/userService';
|
||||
import PasswordForm from 'components/PasswordForm';
|
||||
import SetPasswordForm from 'components/SetPasswordForm';
|
||||
|
||||
export interface KEK {
|
||||
key: string;
|
||||
|
@ -44,10 +44,8 @@ export default function Generate() {
|
|||
setFieldError('confirm', constants.PASSWORD_GENERATION_FAILED);
|
||||
return;
|
||||
}
|
||||
const encryptedKeyAttributes: B64EncryptionResult = await cryptoWorker.encryptToB64(
|
||||
key,
|
||||
kek.key
|
||||
);
|
||||
const encryptedKeyAttributes: B64EncryptionResult =
|
||||
await cryptoWorker.encryptToB64(key, kek.key);
|
||||
const updatedKey: UpdatedKey = {
|
||||
kekSalt,
|
||||
encryptedKey: encryptedKeyAttributes.encryptedData,
|
||||
|
@ -73,7 +71,7 @@ export default function Generate() {
|
|||
router.push('/gallery');
|
||||
};
|
||||
return (
|
||||
<PasswordForm
|
||||
<SetPasswordForm
|
||||
callback={onSubmit}
|
||||
buttonText={constants.CHANGE_PASSWORD}
|
||||
back={
|
||||
|
|
|
@ -9,7 +9,7 @@ import CryptoWorker, {
|
|||
setSessionKeys,
|
||||
generateAndSaveIntermediateKeyAttributes,
|
||||
} from 'utils/crypto';
|
||||
import PasswordForm from 'components/PasswordForm';
|
||||
import SetPasswordForm from 'components/SetPasswordForm';
|
||||
import { KeyAttributes } from 'types';
|
||||
import { setJustSignedUp } from 'utils/storage';
|
||||
import RecoveryKeyModal from 'components/RecoveryKeyModal';
|
||||
|
@ -52,24 +52,16 @@ export default function Generate() {
|
|||
setFieldError('confirm', constants.PASSWORD_GENERATION_FAILED);
|
||||
return;
|
||||
}
|
||||
const masterKeyEncryptedWithKek: B64EncryptionResult = await cryptoWorker.encryptToB64(
|
||||
masterKey,
|
||||
kek.key
|
||||
);
|
||||
const masterKeyEncryptedWithRecoveryKey: B64EncryptionResult = await cryptoWorker.encryptToB64(
|
||||
masterKey,
|
||||
recoveryKey
|
||||
);
|
||||
const recoveryKeyEncryptedWithMasterKey: B64EncryptionResult = await cryptoWorker.encryptToB64(
|
||||
recoveryKey,
|
||||
masterKey
|
||||
);
|
||||
const masterKeyEncryptedWithKek: B64EncryptionResult =
|
||||
await cryptoWorker.encryptToB64(masterKey, kek.key);
|
||||
const masterKeyEncryptedWithRecoveryKey: B64EncryptionResult =
|
||||
await cryptoWorker.encryptToB64(masterKey, recoveryKey);
|
||||
const recoveryKeyEncryptedWithMasterKey: B64EncryptionResult =
|
||||
await cryptoWorker.encryptToB64(recoveryKey, masterKey);
|
||||
|
||||
const keyPair = await cryptoWorker.generateKeyPair();
|
||||
const encryptedKeyPairAttributes: B64EncryptionResult = await cryptoWorker.encryptToB64(
|
||||
keyPair.privateKey,
|
||||
masterKey
|
||||
);
|
||||
const encryptedKeyPairAttributes: B64EncryptionResult =
|
||||
await cryptoWorker.encryptToB64(keyPair.privateKey, masterKey);
|
||||
|
||||
const keyAttributes: KeyAttributes = {
|
||||
kekSalt,
|
||||
|
@ -101,7 +93,7 @@ export default function Generate() {
|
|||
|
||||
return (
|
||||
<>
|
||||
<PasswordForm
|
||||
<SetPasswordForm
|
||||
callback={onSubmit}
|
||||
buttonText={constants.SET_PASSPHRASE}
|
||||
back={logoutUser}
|
||||
|
|
|
@ -51,7 +51,8 @@ const englishConstants = {
|
|||
</p>
|
||||
),
|
||||
PASSPHRASE_HINT: 'password',
|
||||
PASSPHRASE_CONFIRM: 'password again',
|
||||
RE_ENTER_PASSPHRASE: 'password again',
|
||||
CONFIRM_PASSPHRASE: 'confirm your password',
|
||||
PASSPHRASE_MATCH_ERROR: `passwords don't match`,
|
||||
CONSOLE_WARNING_STOP: 'STOP!',
|
||||
CONSOLE_WARNING_DESC: `This is a browser feature intended for developers. Please don't copy-paste unverified code here.`,
|
||||
|
|
Loading…
Reference in a new issue