diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangePassword.js b/plugins/talk-plugin-auth/client/profile-settings/components/ChangePassword.js
index 3479b5dd9..90940728d 100644
--- a/plugins/talk-plugin-auth/client/profile-settings/components/ChangePassword.js
+++ b/plugins/talk-plugin-auth/client/profile-settings/components/ChangePassword.js
@@ -7,7 +7,6 @@ import validate from 'coral-framework/helpers/validate';
import errorMsj from 'coral-framework/helpers/error';
import isEqual from 'lodash/isEqual';
import { t } from 'plugin-api/beta/client/services';
-import Form from './Form';
import InputField from './InputField';
import { getErrorMessages } from 'coral-framework/utils';
@@ -148,7 +147,7 @@ class ChangePassword extends React.Component {
{t('talk-plugin-auth.change_password.change_password')}
{editing && (
-
diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.js b/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.js
index b5bd8916b..4fcca70fd 100644
--- a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.js
+++ b/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.js
@@ -2,17 +2,14 @@ import React from 'react';
import cn from 'classnames';
import PropTypes from 'prop-types';
import styles from './ChangeUsername.css';
-import { Icon, Button } from 'plugin-api/beta/client/components/ui';
+import { Button } from 'plugin-api/beta/client/components/ui';
import ChangeUsernameDialog from './ChangeUsernameDialog';
-import validate from 'coral-framework/helpers/validate';
-import errorMsj from 'coral-framework/helpers/error';
import { t } from 'plugin-api/beta/client/services';
import InputField from './InputField';
const initialState = {
editing: false,
showDialog: false,
- errors: {},
formData: {},
};
@@ -54,63 +51,15 @@ class ChangeUsername extends React.Component {
// savechanges
};
- fieldValidation = (value, type, name) => {
- if (!value.length) {
- this.addError({
- [name]: t('talk-plugin-auth.change_password.required_field'),
- });
- } else if (!validate[type](value)) {
- this.addError({ [name]: errorMsj[type] });
- } else {
- this.removeError(name);
- }
- };
-
- hasError = err => {
- return Object.keys(this.state.errors).indexOf(err) !== -1;
- };
-
- addError = err => {
- this.setState(
- ({ errors }) => ({
- errors: { ...errors, ...err },
- }),
- () => {
- console.log(this.state);
- }
- );
- };
-
- removeError = errKey => {
- this.setState(
- state => {
- const { [errKey]: _, ...errors } = state.errors;
- return {
- errors,
- };
- },
- () => {
- console.log(this.state);
- }
- );
- };
-
onChange = e => {
- const { name, value, type, dataset: { validationType } } = e.target;
+ const { name, value } = e.target;
- this.setState(
- state => ({
- formData: {
- ...state.formData,
- [name]: value,
- },
- }),
- () => {
- const fieldType = !validationType ? type : validationType;
- this.fieldValidation(value, fieldType, name);
- // the username cannot be the same
- }
- );
+ this.setState(state => ({
+ formData: {
+ ...state.formData,
+ [name]: value,
+ },
+ }));
};
closeDialog = () => {
@@ -139,7 +88,7 @@ class ChangeUsername extends React.Component {
{editing ? (
-
+
- Usernames can be changed every 14 days
+ {t('talk-plugin-auth.change_username.change_username_note')}
-
+
) : (
) : (
@@ -193,7 +142,7 @@ class ChangeUsername extends React.Component {
icon="settings"
onClick={this.enableEditing}
>
- Edit Profile
+ {t('talk-plugin-auth.change_username.edit_profile')}
)}
diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameDialog.js b/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameDialog.js
index 22c74bce3..a561106c9 100644
--- a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameDialog.js
+++ b/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameDialog.js
@@ -1,8 +1,8 @@
import React from 'react';
+import PropTypes from 'prop-types';
import cn from 'classnames';
import styles from './ChangeUsernameDialog.css';
import InputField from './InputField';
-import Form from './Form';
import { Button, Dialog } from 'plugin-api/beta/client/components/ui';
class ChangeUsernameDialog extends React.Component {
@@ -51,7 +51,7 @@ class ChangeUsernameDialog extends React.Component {
New Username: {this.props.formData.newUsername}
-