|
@@ -94,18 +94,18 @@ export default class ResetPassword extends Component {
|
|
|
sendVerification() {
|
|
sendVerification() {
|
|
|
var info = this.formInfo;
|
|
var info = this.formInfo;
|
|
|
if (!info.email) {
|
|
if (!info.email) {
|
|
|
- toastShort('Please enter email address');
|
|
|
|
|
|
|
+ toastShort($t('sign.plsInputEmail'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (!/^[a-zA-Z0-9]+[\S]+@[a-zA-Z0-9_-]+[\.][\Sa-zA-Z]+$/.test(info.email)) {
|
|
if (!/^[a-zA-Z0-9]+[\S]+@[a-zA-Z0-9_-]+[\.][\Sa-zA-Z]+$/.test(info.email)) {
|
|
|
- toastShort('Email is incorrect format');
|
|
|
|
|
|
|
+ toastShort($t('sign.errEmailFormat'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
Dialog.showProgressDialog()
|
|
Dialog.showProgressDialog()
|
|
|
apiUser.sendVerificationCode(info.email).then(res => {
|
|
apiUser.sendVerificationCode(info.email).then(res => {
|
|
|
Dialog.dismissLoading()
|
|
Dialog.dismissLoading()
|
|
|
this.state.sendMinutes = res.data?.resendTime ?? 60;
|
|
this.state.sendMinutes = res.data?.resendTime ?? 60;
|
|
|
- toastShort('Send verification code successfully');
|
|
|
|
|
|
|
+ toastShort($t('sign.sendOTPSuccess'));
|
|
|
this.contdownTime();
|
|
this.contdownTime();
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
|
Dialog.dismissLoading()
|
|
Dialog.dismissLoading()
|
|
@@ -128,37 +128,37 @@ export default class ResetPassword extends Component {
|
|
|
var info = this.formInfo;
|
|
var info = this.formInfo;
|
|
|
console.log('reset info', info);
|
|
console.log('reset info', info);
|
|
|
if (!info.email) {
|
|
if (!info.email) {
|
|
|
- toastShort('Please enter email address');
|
|
|
|
|
|
|
+ toastShort($t('sign.plsInputEmail'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (!/^[a-zA-Z0-9]+[\S]+@[a-zA-Z0-9_-]+[\.][\Sa-zA-Z]+$/.test(info.email)) {
|
|
if (!/^[a-zA-Z0-9]+[\S]+@[a-zA-Z0-9_-]+[\.][\Sa-zA-Z]+$/.test(info.email)) {
|
|
|
- toastShort('Email is incorrect format');
|
|
|
|
|
|
|
+ toastShort($t('sign.errEmailFormat'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (!this.state.password) {
|
|
if (!this.state.password) {
|
|
|
- toastShort('Please enter password');
|
|
|
|
|
|
|
+ toastShort($t('sign.plsInputPassword'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (this.state.strength < this.StrengthView.maxStrength) {
|
|
if (this.state.strength < this.StrengthView.maxStrength) {
|
|
|
- toastShort('Password is not strong');
|
|
|
|
|
|
|
+ toastShort($t('sign.errPasswordStrong'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (!info.password) {
|
|
if (!info.password) {
|
|
|
- toastShort('Please enter confirm password');
|
|
|
|
|
|
|
+ toastShort($t('sign.plsInputPassword2'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (info.password != this.state.password) {
|
|
if (info.password != this.state.password) {
|
|
|
- toastShort('The twice passwords are inconsistent');
|
|
|
|
|
|
|
+ toastShort($t('sign.errPasswordConfirm'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (!info.verificationCode) {
|
|
if (!info.verificationCode) {
|
|
|
- toastShort('Please enter verification code');
|
|
|
|
|
|
|
+ toastShort($t('sign.plsInputOTP'));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
Dialog.showProgressDialog()
|
|
Dialog.showProgressDialog()
|
|
|
apiUser.updatePassword(this.formInfo).then(res => {
|
|
apiUser.updatePassword(this.formInfo).then(res => {
|
|
|
Dialog.dismissLoading()
|
|
Dialog.dismissLoading()
|
|
|
- toastShort('Reset password successfully');
|
|
|
|
|
|
|
+ toastShort($t('sign.resetPasswordSuccess'));
|
|
|
if (this.isChange) {
|
|
if (this.isChange) {
|
|
|
this.requestLogout();
|
|
this.requestLogout();
|
|
|
} else {
|
|
} else {
|
|
@@ -221,7 +221,7 @@ export default class ResetPassword extends Component {
|
|
|
/>
|
|
/>
|
|
|
<TextInput
|
|
<TextInput
|
|
|
style={styles.inputView}
|
|
style={styles.inputView}
|
|
|
- placeholder='Email Address'
|
|
|
|
|
|
|
+ placeholder={$t('sign.labelEmail')}
|
|
|
placeholderTextColor={textPlacehoder}
|
|
placeholderTextColor={textPlacehoder}
|
|
|
maxLength={50}
|
|
maxLength={50}
|
|
|
keyboardType="email-address"
|
|
keyboardType="email-address"
|
|
@@ -238,7 +238,7 @@ export default class ResetPassword extends Component {
|
|
|
/>
|
|
/>
|
|
|
<TextInput
|
|
<TextInput
|
|
|
style={[styles.inputView, {flex: 2.6, marginLeft: 2}]}
|
|
style={[styles.inputView, {flex: 2.6, marginLeft: 2}]}
|
|
|
- placeholder='OTP'
|
|
|
|
|
|
|
+ placeholder={$t('sign.labelOtp')}
|
|
|
placeholderTextColor={textPlacehoder}
|
|
placeholderTextColor={textPlacehoder}
|
|
|
maxLength={6}
|
|
maxLength={6}
|
|
|
keyboardType="number-pad"
|
|
keyboardType="number-pad"
|
|
@@ -246,7 +246,7 @@ export default class ResetPassword extends Component {
|
|
|
onChangeText={v => this.changeInfo('verificationCode', v)}
|
|
onChangeText={v => this.changeInfo('verificationCode', v)}
|
|
|
/>
|
|
/>
|
|
|
<Button
|
|
<Button
|
|
|
- text={this.state.sendMinutes > 0 ? (this.state.sendMinutes + " s") : 'EMAIL OTP'}
|
|
|
|
|
|
|
+ text={this.state.sendMinutes > 0 ? (this.state.sendMinutes + " s") : $t('sign.btnSendOTP')}
|
|
|
style={styles.sendBtn}
|
|
style={styles.sendBtn}
|
|
|
disabled={this.state.sendMinutes > 0}
|
|
disabled={this.state.sendMinutes > 0}
|
|
|
viewStyle={styles.sendBtnView}
|
|
viewStyle={styles.sendBtnView}
|
|
@@ -263,7 +263,7 @@ export default class ResetPassword extends Component {
|
|
|
<TextInput
|
|
<TextInput
|
|
|
secureTextEntry={this.state.wrongCount}
|
|
secureTextEntry={this.state.wrongCount}
|
|
|
style={styles.inputView}
|
|
style={styles.inputView}
|
|
|
- placeholder='New Password'
|
|
|
|
|
|
|
+ placeholder={$t('sign.labelNewPassword')}
|
|
|
placeholderTextColor={textPlacehoder}
|
|
placeholderTextColor={textPlacehoder}
|
|
|
maxLength={20}
|
|
maxLength={20}
|
|
|
onChangeText={(value) => this.applyStrength(value)}
|
|
onChangeText={(value) => this.applyStrength(value)}
|
|
@@ -303,14 +303,14 @@ export default class ResetPassword extends Component {
|
|
|
<TextInput
|
|
<TextInput
|
|
|
secureTextEntry={this.state.wrongCount}
|
|
secureTextEntry={this.state.wrongCount}
|
|
|
style={styles.inputView}
|
|
style={styles.inputView}
|
|
|
- placeholder='Confirm Password'
|
|
|
|
|
|
|
+ placeholder={$t('sign.labelConfirmPassword')}
|
|
|
placeholderTextColor={textPlacehoder}
|
|
placeholderTextColor={textPlacehoder}
|
|
|
maxLength={20}
|
|
maxLength={20}
|
|
|
onChangeText={v => this.changeInfo('password', v)}
|
|
onChangeText={v => this.changeInfo('password', v)}
|
|
|
/>
|
|
/>
|
|
|
</View>
|
|
</View>
|
|
|
<Button
|
|
<Button
|
|
|
- text='Confirm'
|
|
|
|
|
|
|
+ text={$t('common.confirm')}
|
|
|
style={styles.resetButton}
|
|
style={styles.resetButton}
|
|
|
onClick={() => this.onResetPassword()}
|
|
onClick={() => this.onResetPassword()}
|
|
|
/>
|
|
/>
|
|
@@ -423,7 +423,7 @@ const styles = StyleSheet.create({
|
|
|
justifyContent: 'center'
|
|
justifyContent: 'center'
|
|
|
},
|
|
},
|
|
|
sendBtnText: {
|
|
sendBtnText: {
|
|
|
- color: colorLight,
|
|
|
|
|
|
|
+ color: textButton,
|
|
|
fontSize: 13,
|
|
fontSize: 13,
|
|
|
fontWeight: 'bold'
|
|
fontWeight: 'bold'
|
|
|
},
|
|
},
|