NastiaS
7 years ago
committed by
Gaëtan Renaudeau
11 changed files with 183 additions and 159 deletions
@ -1,91 +1,93 @@ |
|||||
// @flow
|
// UNTIL IS NEEDED SET PASSWORD STEP IS COMMENTED OUT
|
||||
|
|
||||
import React, { PureComponent } from 'react' |
// // @flow
|
||||
import bcrypt from 'bcryptjs' |
//
|
||||
|
// import React, { PureComponent } from 'react'
|
||||
import { setEncryptionKey } from 'helpers/db' |
// import bcrypt from 'bcryptjs'
|
||||
|
//
|
||||
import Box from 'components/base/Box' |
// import { setEncryptionKey } from 'helpers/db'
|
||||
import Button from 'components/base/Button' |
//
|
||||
|
// import Box from 'components/base/Box'
|
||||
import IconSetPassword from 'icons/onboarding/SetPassword' |
// import Button from 'components/base/Button'
|
||||
import PasswordModal from 'components/SettingsPage/PasswordModal' |
//
|
||||
import OnboardingFooter from '../OnboardingFooter' |
// import IconSetPassword from 'icons/onboarding/SetPassword'
|
||||
|
// import PasswordModal from 'components/SettingsPage/PasswordModal'
|
||||
import type { StepProps } from '..' |
// import OnboardingFooter from '../OnboardingFooter'
|
||||
|
//
|
||||
import { Title, Description } from '../helperComponents' |
// import type { StepProps } from '..'
|
||||
|
//
|
||||
type State = { |
// import { Title, Description } from '../helperComponents'
|
||||
isPasswordModalOpened: boolean, |
//
|
||||
isPasswordEnabled: boolean, |
// type State = {
|
||||
} |
// isPasswordModalOpened: boolean,
|
||||
|
// isPasswordEnabled: boolean,
|
||||
class SetPassword extends PureComponent<StepProps, State> { |
// }
|
||||
state = { |
//
|
||||
isPasswordModalOpened: false, |
// class SetPassword extends PureComponent<StepProps, State> {
|
||||
isPasswordEnabled: false, |
// state = {
|
||||
} |
// isPasswordModalOpened: false,
|
||||
|
// isPasswordEnabled: false,
|
||||
handleOpenPasswordModal = () => { |
// }
|
||||
this.setState({ isPasswordModalOpened: true }) |
//
|
||||
} |
// handleOpenPasswordModal = () => {
|
||||
handleClosePasswordModal = () => { |
// this.setState({ isPasswordModalOpened: true })
|
||||
this.setState({ isPasswordModalOpened: false }) |
// }
|
||||
} |
// handleClosePasswordModal = () => {
|
||||
handleChangePassword = (password: string) => { |
// this.setState({ isPasswordModalOpened: false })
|
||||
window.requestIdleCallback(() => { |
// }
|
||||
setEncryptionKey('accounts', password) |
// handleChangePassword = (password: string) => {
|
||||
const hash = password ? bcrypt.hashSync(password, 8) : undefined |
// window.requestIdleCallback(() => {
|
||||
this.props.savePassword(hash) |
// setEncryptionKey('accounts', password)
|
||||
}) |
// const hash = password ? bcrypt.hashSync(password, 8) : undefined
|
||||
} |
// this.props.savePassword(hash)
|
||||
|
// })
|
||||
handleInputChange = (key: string) => (value: string) => { |
// }
|
||||
this.setState({ [key]: value }) |
//
|
||||
} |
// handleInputChange = (key: string) => (value: string) => {
|
||||
|
// this.setState({ [key]: value })
|
||||
render() { |
// }
|
||||
const { nextStep, prevStep, t } = this.props |
//
|
||||
const { isPasswordModalOpened, isPasswordEnabled } = this.state |
// render() {
|
||||
return ( |
// const { nextStep, prevStep, t } = this.props
|
||||
<Box sticky pt={150}> |
// const { isPasswordModalOpened, isPasswordEnabled } = this.state
|
||||
<Box grow alignItems="center"> |
// return (
|
||||
<Title>{t('onboarding:setPassword.title')}</Title> |
// <Box sticky pt={150}>
|
||||
<Description style={{ maxWidth: 714 }}>{t('onboarding:setPassword.desc')}</Description> |
// <Box grow alignItems="center">
|
||||
<IconSetPassword /> |
// <Title>{t('onboarding:setPassword.title')}</Title>
|
||||
<Box style={{ paddingTop: 35 }}> |
// <Description>{t('onboarding:setPassword.desc')}</Description>
|
||||
<Button small primary onClick={() => this.handleOpenPasswordModal()}> |
// <IconSetPassword />
|
||||
Set Password |
// <Box style={{ paddingTop: 35 }}>
|
||||
</Button> |
// <Button small primary onClick={() => this.handleOpenPasswordModal()}>
|
||||
</Box> |
// Set Password
|
||||
{/* we might not be able to re-use what we have currently without modifications |
// </Button>
|
||||
the title and descriptions are not dynamic, we might need deffirent size as well */} |
// </Box>
|
||||
{isPasswordModalOpened && ( |
// {/* we might not be able to re-use what we have currently without modifications
|
||||
<PasswordModal |
// the title and descriptions are not dynamic, we might need deffirent size as well */}
|
||||
t={t} |
// {isPasswordModalOpened && (
|
||||
isOpened={isPasswordModalOpened} |
// <PasswordModal
|
||||
onClose={this.handleClosePasswordModal} |
// t={t}
|
||||
onChangePassword={this.handleChangePassword} |
// isOpened={isPasswordModalOpened}
|
||||
isPasswordEnabled={isPasswordEnabled} |
// onClose={this.handleClosePasswordModal}
|
||||
currentPasswordHash="" |
// onChangePassword={this.handleChangePassword}
|
||||
/> |
// isPasswordEnabled={isPasswordEnabled}
|
||||
)} |
// currentPasswordHash=""
|
||||
<Box onClick={() => nextStep()} style={{ padding: 15 }}> |
// />
|
||||
<Button>Skip this step</Button> |
// )}
|
||||
</Box> |
// <Box onClick={() => nextStep()} style={{ padding: 15 }}>
|
||||
</Box> |
// <Button>Skip this step</Button>
|
||||
<OnboardingFooter |
// </Box>
|
||||
horizontal |
// </Box>
|
||||
align="center" |
// <OnboardingFooter
|
||||
flow={2} |
// horizontal
|
||||
t={t} |
// align="center"
|
||||
nextStep={nextStep} |
// flow={2}
|
||||
prevStep={prevStep} |
// t={t}
|
||||
/> |
// nextStep={nextStep}
|
||||
</Box> |
// prevStep={prevStep}
|
||||
) |
// />
|
||||
} |
// </Box>
|
||||
} |
// )
|
||||
|
// }
|
||||
export default SetPassword |
// }
|
||||
|
//
|
||||
|
// export default SetPassword
|
||||
|
Loading…
Reference in new issue