mirror of
https://github.com/wassname/talk.git
synced 2026-07-10 17:27:29 +08:00
Apply suggestions
This commit is contained in:
@@ -8,7 +8,7 @@ class SignInContainer extends Component {
|
||||
state = {
|
||||
email: '',
|
||||
password: '',
|
||||
recaptchaResponse: '',
|
||||
recaptchaResponse: null,
|
||||
};
|
||||
|
||||
handleSubmit = () => {
|
||||
|
||||
@@ -46,7 +46,7 @@ export default hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return translateError(this.state.error);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return translateError(this.state.error);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ const withSetUsername = hoistStatics(WrappedComponent => {
|
||||
if (!value) {
|
||||
return t('error.required_field');
|
||||
}
|
||||
return validate.username(value) ? '' : errorMsg.username;
|
||||
return validate.username(value) ? null : errorMsg.username;
|
||||
};
|
||||
|
||||
setUsername = async username => {
|
||||
@@ -64,7 +64,7 @@ const withSetUsername = hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return getErrorMessages(this.state.error).join(', ');
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export default hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return this.state.error.translation_key === 'NOT_AUTHORIZED'
|
||||
? t('error.email_password')
|
||||
|
||||
@@ -51,7 +51,7 @@ const withSignUp = hoistStatics(WrappedComponent => {
|
||||
|
||||
validate = (field, value) => {
|
||||
if (!allFields.includes(field)) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
|
||||
if (requiredFields.includes(field) && !value) {
|
||||
@@ -59,10 +59,10 @@ const withSignUp = hoistStatics(WrappedComponent => {
|
||||
}
|
||||
|
||||
if (field in validate) {
|
||||
return validate[field](value) ? '' : errorMsg[field];
|
||||
return validate[field](value) ? null : errorMsg[field];
|
||||
}
|
||||
|
||||
return '';
|
||||
return null;
|
||||
};
|
||||
|
||||
signUp = ({ username, email, password }, redirectUri) => {
|
||||
@@ -96,7 +96,7 @@ const withSignUp = hoistStatics(WrappedComponent => {
|
||||
|
||||
getErrorMessage() {
|
||||
if (!this.state.error) {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
return translateError(this.state.error);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { setView, setEmail, setPassword } from '../actions';
|
||||
|
||||
class SignInContainer extends Component {
|
||||
state = {
|
||||
recaptchaResponse: '',
|
||||
recaptchaResponse: null,
|
||||
};
|
||||
|
||||
handleSubmit = () => {
|
||||
|
||||
@@ -12,10 +12,10 @@ class SignUpContainer extends Component {
|
||||
state = {
|
||||
username: '',
|
||||
passwordRepeat: '',
|
||||
usernameError: '',
|
||||
emailError: '',
|
||||
passwordError: '',
|
||||
passwordRepeatError: '',
|
||||
usernameError: null,
|
||||
emailError: null,
|
||||
passwordError: null,
|
||||
passwordRepeatError: null,
|
||||
};
|
||||
|
||||
validate = data => {
|
||||
@@ -30,7 +30,9 @@ class SignUpContainer extends Component {
|
||||
});
|
||||
|
||||
if (data.password !== data.passwordRepeat) {
|
||||
changes['passwordRepeatError'] = t('sign_in.passwords_dont_match');
|
||||
changes['passwordRepeatError'] = t(
|
||||
'talk-plugin-auth.login.passwords_dont_match'
|
||||
);
|
||||
valid = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import SetUsernameDialog from '../components/SetUsernameDialog';
|
||||
class SetUsernameDialogContainer extends Component {
|
||||
state = {
|
||||
username: this.props.username,
|
||||
usernameError: '',
|
||||
usernameError: null,
|
||||
};
|
||||
|
||||
handleSubmit = () => {
|
||||
|
||||
Reference in New Issue
Block a user