From 780bd42ceb8d5cb5fb037108e1cc5194ce034f62 Mon Sep 17 00:00:00 2001 From: okbel Date: Wed, 2 May 2018 13:49:23 -0300 Subject: [PATCH] Moving gdpr to `talk-plugin-local-auth` --- plugins/talk-plugin-auth/client/index.js | 4 - .../components/ChangeUsername.css | 122 ------------ .../components/ChangeUsername.js | 188 ------------------ .../containers/ChangeUsername.js | 12 -- .../components/ChangeEmailContentDialog.css | 0 .../components/ChangeEmailContentDialog.js | 0 .../client}/components/ChangePassword.css | 0 .../client}/components/ChangePassword.js | 0 .../ChangeUsernameContentDialog.css | 0 .../components/ChangeUsernameContentDialog.js | 0 .../components/ChangeUsernameDialog.css | 0 .../components/ChangeUsernameDialog.js | 0 .../components/ConfirmChangesDialog.css | 0 .../components/ConfirmChangesDialog.js | 0 .../client}/components/ErrorMessage.css | 0 .../client}/components/ErrorMessage.js | 0 .../client}/components/InputField.css | 0 .../client}/components/InputField.js | 0 .../client}/components/Profile.css | 0 .../client}/components/Profile.js | 0 .../client}/containers/ChangePassword.js | 0 .../client}/containers/Profile.js | 0 .../talk-plugin-local-auth/client/index.js | 10 +- 23 files changed, 9 insertions(+), 327 deletions(-) delete mode 100644 plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.css delete mode 100644 plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.js delete mode 100644 plugins/talk-plugin-auth/client/profile-settings/containers/ChangeUsername.js rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ChangeEmailContentDialog.css (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ChangeEmailContentDialog.js (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ChangePassword.css (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ChangePassword.js (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ChangeUsernameContentDialog.css (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ChangeUsernameContentDialog.js (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ChangeUsernameDialog.css (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ChangeUsernameDialog.js (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ConfirmChangesDialog.css (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ConfirmChangesDialog.js (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ErrorMessage.css (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/ErrorMessage.js (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/InputField.css (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/InputField.js (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/Profile.css (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/components/Profile.js (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/containers/ChangePassword.js (100%) rename plugins/{talk-plugin-auth/client/profile-settings => talk-plugin-local-auth/client}/containers/Profile.js (100%) diff --git a/plugins/talk-plugin-auth/client/index.js b/plugins/talk-plugin-auth/client/index.js index 6341dc7c9..13abce1d9 100644 --- a/plugins/talk-plugin-auth/client/index.js +++ b/plugins/talk-plugin-auth/client/index.js @@ -4,8 +4,6 @@ import SetUsernameDialog from './stream/containers/SetUsernameDialog'; import translations from './translations.yml'; import Login from './login/containers/Main'; import reducer from './login/reducer'; -import ChangePassword from './profile-settings/containers/ChangePassword'; -import Profile from './profile-settings/containers/Profile'; export default { reducer, @@ -13,7 +11,5 @@ export default { slots: { stream: [UserBox, SignInButton, SetUsernameDialog], login: [Login], - profileHeader: [Profile], - profileSettings: [ChangePassword], }, }; diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.css b/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.css deleted file mode 100644 index 5b4631ecf..000000000 --- a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.css +++ /dev/null @@ -1,122 +0,0 @@ -.container { - margin-bottom: 20px; - display: flex; - position: relative; - color: #202020; - padding: 10px; - border-radius: 2px; - box-sizing: border-box; - justify-content: space-between; - - &.editing { - background-color: #EDEDED; - } -} - -.content { - flex-grow: 1; -} - -.actions { - flex-grow: 0; - display: flex; - flex-direction: column; - align-items: center; -} - -.email { - margin: 0; -} - -.username { - margin-bottom: 4px; -} - -.button { - border: 1px solid #787d80; - background-color: transparent; - height: 30px; - font-size: 0.9em; - line-height: normal; -} - -.saveButton { - background-color: #3498DB; - border-color: #3498DB; - color: white; - - > i { - font-size: 17px; - } - - &:hover { - background-color: #399ee2; - color: white; - } - - &:disabled { - border-color: #e0e0e0; - - &:hover { - background-color: #e0e0e0; - color: #4f5c67; - cursor: default; - } - } -} - -.cancelButton { - color:#787D80; - margin-top: 6px; - font-size: 0.9em; - - &:hover { - cursor: pointer; - } -} - -.detailLabel { - border: solid 1px #787D80; - border-radius: 2px; - background-color: white; - height: 30px; - display: inline-block; - width: 230px; - display: flex; - - > .detailLabelIcon { - font-size: 1.2em; - padding: 0 5px; - color: #787D80; - line-height: 30px; - } - - &.disabled { - background-color: #E0E0E0; - } -} - -.detailValue { - background: transparent; - border: none; - font-size: 1em; - color: #000; - height: 30px; - outline: none; - flex: 1; -} - -.bottomText { - color: #474747; - font-size: 0.9em; -} - -.detailList { - list-style: none; - margin: 0; - padding: 0; -} - -.detailItem { - margin-bottom: 12px; -} diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.js b/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.js deleted file mode 100644 index 8188bdfbe..000000000 --- a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsername.js +++ /dev/null @@ -1,188 +0,0 @@ -import React from 'react'; -import cn from 'classnames'; -import PropTypes from 'prop-types'; -import styles from './ChangeUsername.css'; -import { Button } from 'plugin-api/beta/client/components/ui'; -import ChangeUsernameDialog from './ChangeUsernameDialog'; -import { t } from 'plugin-api/beta/client/services'; -import InputField from './InputField'; -import { getErrorMessages } from 'coral-framework/utils'; -import { canUsernameBeUpdated } from 'coral-framework/utils/user'; - -const initialState = { - editing: false, - showDialog: false, - formData: {}, -}; - -class ChangeUsername extends React.Component { - state = initialState; - - clearForm = () => { - this.setState(initialState); - }; - - enableEditing = () => { - this.setState({ - editing: true, - }); - }; - - disableEditing = () => { - this.setState({ - editing: false, - }); - }; - - cancel = () => { - this.clearForm(); - this.disableEditing(); - }; - - showDialog = () => { - this.setState({ - showDialog: true, - }); - }; - - onSave = async () => { - this.showDialog(); - }; - - saveChanges = async () => { - const { newUsername } = this.state.formData; - const { changeUsername } = this.props; - - try { - await changeUsername(newUsername); - this.props.notify( - 'success', - t('talk-plugin-auth.change_username.changed_username_success_msg') - ); - } catch (err) { - this.props.notify('error', getErrorMessages(err)); - } - - this.clearForm(); - this.disableEditing(); - }; - - onChange = e => { - const { name, value } = e.target; - - this.setState(state => ({ - formData: { - ...state.formData, - [name]: value, - }, - })); - }; - - closeDialog = () => { - this.setState({ - showDialog: false, - }); - }; - - render() { - const { - username, - emailAddress, - root: { me: { state: { status } } }, - notify, - } = this.props; - const { editing, formData, showDialog } = this.state; - - return ( -
- - - {editing ? ( -
-
- - - {t('talk-plugin-auth.change_username.change_username_note')} - - - -
-
- ) : ( -
-

{username}

- {emailAddress ? ( -

{emailAddress}

- ) : null} -
- )} - {editing ? ( -
- - - {t('talk-plugin-auth.change_username.cancel')} - -
- ) : ( -
- -
- )} -
- ); - } -} - -ChangeUsername.propTypes = { - root: PropTypes.object.isRequired, - changeUsername: PropTypes.func.isRequired, - notify: PropTypes.func.isRequired, - username: PropTypes.string, - emailAddress: PropTypes.string, -}; - -export default ChangeUsername; diff --git a/plugins/talk-plugin-auth/client/profile-settings/containers/ChangeUsername.js b/plugins/talk-plugin-auth/client/profile-settings/containers/ChangeUsername.js deleted file mode 100644 index 87e1e18b5..000000000 --- a/plugins/talk-plugin-auth/client/profile-settings/containers/ChangeUsername.js +++ /dev/null @@ -1,12 +0,0 @@ -import { compose } from 'react-apollo'; -import { bindActionCreators } from 'redux'; -import { connect } from 'plugin-api/beta/client/hocs'; -import ChangeUsername from '../components/ChangeUsername'; -import { notify } from 'coral-framework/actions/notification'; -import { withChangeUsername } from 'plugin-api/beta/client/hocs'; - -const mapDispatchToProps = dispatch => bindActionCreators({ notify }, dispatch); - -export default compose(connect(null, mapDispatchToProps), withChangeUsername)( - ChangeUsername -); diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeEmailContentDialog.css b/plugins/talk-plugin-local-auth/client/components/ChangeEmailContentDialog.css similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ChangeEmailContentDialog.css rename to plugins/talk-plugin-local-auth/client/components/ChangeEmailContentDialog.css diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeEmailContentDialog.js b/plugins/talk-plugin-local-auth/client/components/ChangeEmailContentDialog.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ChangeEmailContentDialog.js rename to plugins/talk-plugin-local-auth/client/components/ChangeEmailContentDialog.js diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangePassword.css b/plugins/talk-plugin-local-auth/client/components/ChangePassword.css similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ChangePassword.css rename to plugins/talk-plugin-local-auth/client/components/ChangePassword.css diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangePassword.js b/plugins/talk-plugin-local-auth/client/components/ChangePassword.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ChangePassword.js rename to plugins/talk-plugin-local-auth/client/components/ChangePassword.js diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameContentDialog.css b/plugins/talk-plugin-local-auth/client/components/ChangeUsernameContentDialog.css similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameContentDialog.css rename to plugins/talk-plugin-local-auth/client/components/ChangeUsernameContentDialog.css diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameContentDialog.js b/plugins/talk-plugin-local-auth/client/components/ChangeUsernameContentDialog.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameContentDialog.js rename to plugins/talk-plugin-local-auth/client/components/ChangeUsernameContentDialog.js diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameDialog.css b/plugins/talk-plugin-local-auth/client/components/ChangeUsernameDialog.css similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameDialog.css rename to plugins/talk-plugin-local-auth/client/components/ChangeUsernameDialog.css diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameDialog.js b/plugins/talk-plugin-local-auth/client/components/ChangeUsernameDialog.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ChangeUsernameDialog.js rename to plugins/talk-plugin-local-auth/client/components/ChangeUsernameDialog.js diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ConfirmChangesDialog.css b/plugins/talk-plugin-local-auth/client/components/ConfirmChangesDialog.css similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ConfirmChangesDialog.css rename to plugins/talk-plugin-local-auth/client/components/ConfirmChangesDialog.css diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ConfirmChangesDialog.js b/plugins/talk-plugin-local-auth/client/components/ConfirmChangesDialog.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ConfirmChangesDialog.js rename to plugins/talk-plugin-local-auth/client/components/ConfirmChangesDialog.js diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ErrorMessage.css b/plugins/talk-plugin-local-auth/client/components/ErrorMessage.css similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ErrorMessage.css rename to plugins/talk-plugin-local-auth/client/components/ErrorMessage.css diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/ErrorMessage.js b/plugins/talk-plugin-local-auth/client/components/ErrorMessage.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/ErrorMessage.js rename to plugins/talk-plugin-local-auth/client/components/ErrorMessage.js diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/InputField.css b/plugins/talk-plugin-local-auth/client/components/InputField.css similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/InputField.css rename to plugins/talk-plugin-local-auth/client/components/InputField.css diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/InputField.js b/plugins/talk-plugin-local-auth/client/components/InputField.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/InputField.js rename to plugins/talk-plugin-local-auth/client/components/InputField.js diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/Profile.css b/plugins/talk-plugin-local-auth/client/components/Profile.css similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/Profile.css rename to plugins/talk-plugin-local-auth/client/components/Profile.css diff --git a/plugins/talk-plugin-auth/client/profile-settings/components/Profile.js b/plugins/talk-plugin-local-auth/client/components/Profile.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/components/Profile.js rename to plugins/talk-plugin-local-auth/client/components/Profile.js diff --git a/plugins/talk-plugin-auth/client/profile-settings/containers/ChangePassword.js b/plugins/talk-plugin-local-auth/client/containers/ChangePassword.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/containers/ChangePassword.js rename to plugins/talk-plugin-local-auth/client/containers/ChangePassword.js diff --git a/plugins/talk-plugin-auth/client/profile-settings/containers/Profile.js b/plugins/talk-plugin-local-auth/client/containers/Profile.js similarity index 100% rename from plugins/talk-plugin-auth/client/profile-settings/containers/Profile.js rename to plugins/talk-plugin-local-auth/client/containers/Profile.js diff --git a/plugins/talk-plugin-local-auth/client/index.js b/plugins/talk-plugin-local-auth/client/index.js index ff8b4c563..01f3f7123 100644 --- a/plugins/talk-plugin-local-auth/client/index.js +++ b/plugins/talk-plugin-local-auth/client/index.js @@ -1 +1,9 @@ -export default {}; +import ChangePassword from './containers/ChangePassword'; +import Profile from './containers/Profile'; + +export default { + slots: { + profileHeader: [Profile], + profileSettings: [ChangePassword], + }, +};