diff --git a/public/api/User.php b/public/api/User.php index 0c1208f..34ebb39 100644 --- a/public/api/User.php +++ b/public/api/User.php @@ -13,7 +13,7 @@ class User { } public function logIn ($email, $password) { - $query = 'SELECT * FROM users WHERE email=:email OR username=:email'; + $query = 'SELECT * FROM users WHERE email=:email'; $user = $this->db->query($query, array(':email' => $email))->fetch(); if ($user) { if ($user['old_password'] !== null) { @@ -39,22 +39,15 @@ class User { return $user->rowCount() > 0; } - public function usernameExists ($username) { - $query = 'SELECT * FROM users WHERE username=?'; - $user = $this->db->query($query, array($username)); - return $user->rowCount() > 0; - } - public function create ($email, $password, $user_data) { - $insert_user_query = 'INSERT INTO users (email, password, public_name, username, allow_email, created_on) -VALUES (?, ?, ?, ?, ?, ?)'; + $insert_user_query = 'INSERT INTO users (email, password, public_name, allow_email, created_on) +VALUES (?, ?, ?, ?, ?)'; $password_hash = password_hash($password, PASSWORD_DEFAULT); $insert_user = $this->db->execute($insert_user_query, array( $email, $password_hash, $user_data['publicName'] !== '' ? $user_data['publicName'] : null, - $user_data['username'] !== '' ? $user_data['username'] : null, $user_data['allowEmail'] ? 1 : 0, time(), )); @@ -108,7 +101,6 @@ VALUES (?, ?, ?, ?, ?, ?)'; if ($stmt && $user) { return array( 'email' => $user['email'], - 'username' => $user['username'], 'publicName' => $user['public_name'], 'allowEmails' => $user['allow_email'] == 1 ? true : false, ); diff --git a/src/components/management/AccountManager/LoginForm.jsx b/src/components/management/AccountManager/LoginForm.jsx index 0263a32..87a8f63 100644 --- a/src/components/management/AccountManager/LoginForm.jsx +++ b/src/components/management/AccountManager/LoginForm.jsx @@ -1,11 +1,6 @@ import Inferno from 'inferno'; import { Component } from 'inferno'; import PropTypes from 'prop-types'; -import marked from 'marked'; -import store from 'store'; - -import { Modal } from '../../structure/Modal'; -import { SearchBox } from '../../management/SearchBox'; import { request } from '../../../Helpers'; @@ -26,19 +21,15 @@ export class LoginForm extends Component { loginPasswordError: '', loginFormIsValid: true, signupEmail: '', - // signupUsername: '', signupPublicName: '', signupPassword: '', signupConfirm: '', signupAllowEmail: true, signupEmailError: '', - // signupUsernameError: '', signupPasswordError: '', signupConfirmError: '', signupEmailChecking: false, - // signupUsernameChecking: false, signupEmailIsUnique: true, - // signupUsernameIsUnique: true, signupFormIsValid: true, }; } @@ -56,15 +47,11 @@ export class LoginForm extends Component { signupEmailError, signupEmailChecking, signupEmailIsUnique, - // signupUsernameError, - // signupUsernameChecking, - // signupUsernameIsUnique, signupPasswordError, signupConfirmError, } = this.state; - return !signupEmailChecking && !signupUsernameChecking + return !signupEmailChecking && signupEmailIsUnique && signupEmailError === '' - // && signupUsernameIsUnique && signupUsernameError === '' && signupPasswordError === '' && signupConfirmError === ''; } @@ -101,13 +88,6 @@ export class LoginForm extends Component { } } - // if (field === 'signupUsername') { - // if (value !== '' && /[^a-zA-Z0-9]+/g.test(value)) { - // isValid = false; - // fieldErrors[errorFieldName] = 'Please use only letters and numbers'; - // } - // } - if (isValid) { fieldErrors[errorFieldName] = ''; } @@ -118,12 +98,9 @@ export class LoginForm extends Component { const { signupEmailChecking, signupEmailIsUnique, - // signupUsernameChecking, - // signupUsernameIsUnique, } = this.state; const fields = [ 'signupEmail', - // 'signupUsername', 'signupPassword', 'signupConfirm' ]; @@ -133,7 +110,6 @@ export class LoginForm extends Component { errors = Object.assign(errors, fieldErrors); }); errors.signupFormIsValid = !signupEmailChecking && signupEmailIsUnique - // && !signupUsernameChecking && signupUsernameIsUnique && Object.keys(errors).every(field => errors[field] === ''); this.setState(errors, callback); } @@ -169,21 +145,6 @@ export class LoginForm extends Component { }); }); } - // else if (field === 'signupUsername') { - // this.setState({ signupUsernameChecking: true }, () => { - // request('check-username', { username: value }, (response) => { - // const { data, error } = response; - // fieldUpdate['signupUsernameChecking'] = false; - // if (error) { - // console.error(data); - // } else { - // fieldUpdate['signupUsernameIsUnique'] = !data; - // } - // }).then(() => { - // this.setState(fieldUpdate); - // }); - // }); - // } } logIn () { @@ -200,13 +161,11 @@ export class LoginForm extends Component { if (this.signupFormIsValid) { const { signupEmail, - // signupUsername, signupPublicName, signupPassword, signupAllowEmail } = this.state; this.props.signUp(signupEmail, signupPassword, { - // username: signupUsername, publicName: signupPublicName, allowEmail: signupAllowEmail, }); @@ -216,7 +175,7 @@ export class LoginForm extends Component { render () { return ( -
This username address is already in use
} - {this.state.signupUsernameError} -- Per your GDPR rights in Articles 13–15 and 20, - we allow you to request any and all data we have stored about you. The only data we have about - you personally is your email address and your Public Name, if you decided to set one. All other - data (your Dictionary data) is visible and accessible via the Export button under your Dictionary's - Settings. Send an email to help@lexicon.ga to request your information. -
-- Per your GDPR rights in Article 17, if you wish - for your account to be deleted, please contact us at help@lexicon.ga, and we will delete your account - and all associated dictionaries and words as quickly as possible. Note that you can delete dictionaries - yourself via your Dictionary's Settings. -
-- Anything that is deleted from our system is permanently and irretrievably removed from our system and - cannot be restored, though search engines or internet archives may retain a cached version of your content - (there is nothing we can do about this, and you will need to seek out removal of that information by directly - contacting the services that are caching your data). -
-+ Per your GDPR rights in Articles 13–15 and 20, + we allow you to request any and all data we have stored about you. The only data we have about + you personally is your email address and your Public Name, if you decided to set one. All other + data (your Dictionary data) is visible and accessible via the Export button under your Dictionary's + Settings. Send an email to help@lexicon.ga to request your information. +
++ Per your GDPR rights in Article 17, if you wish + for your account to be deleted, please contact us at help@lexicon.ga, and we will delete your account + and all associated dictionaries and words as quickly as possible. Note that you can delete dictionaries + yourself via your Dictionary's Settings. +
++ Anything that is deleted from our system is permanently and irretrievably removed from our system and + cannot be restored, though search engines or internet archives may retain a cached version of your content + (there is nothing we can do about this, and you will need to seek out removal of that information by directly + contacting the services that are caching your data). +
+