From 09ef565e085e65836fbb395a9aa027949e3828ef Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Fri, 27 Mar 2020 09:49:04 -0300 Subject: [PATCH] Login with email working --- app/containers/Button/index.js | 5 +- app/i18n/locales/de.js | 1 - app/i18n/locales/en.js | 3 +- app/i18n/locales/es-ES.js | 1 - app/i18n/locales/fr.js | 1 - app/i18n/locales/it.js | 1 - app/i18n/locales/ja.js | 1 - app/i18n/locales/nl.js | 1 - app/i18n/locales/pt-BR.js | 1 - app/i18n/locales/pt-PT.js | 1 - app/i18n/locales/ru.js | 1 - app/i18n/locales/zh-CN.js | 1 - app/views/LoginSignupView.js | 106 ++++++++++++++++++++------------- 13 files changed, 67 insertions(+), 57 deletions(-) diff --git a/app/containers/Button/index.js b/app/containers/Button/index.js index c862b6c37..d5eb64d0a 100644 --- a/app/containers/Button/index.js +++ b/app/containers/Button/index.js @@ -44,7 +44,7 @@ export default class Button extends React.PureComponent { render() { const { - title, type, onPress, disabled, backgroundColor, color, loading, style, theme, ...otherProps + title, type, onPress, disabled, backgroundColor, color, loading, style, theme, fontSize, ...otherProps } = this.props; const isPrimary = type === 'primary'; return ( @@ -69,7 +69,8 @@ export default class Button extends React.PureComponent { style={[ styles.text, { color: isPrimary ? themes[theme].buttonText : themes[theme].bodyText }, - color && { color } + color && { color }, + fontSize && { fontSize } ]} > {title} diff --git a/app/i18n/locales/de.js b/app/i18n/locales/de.js index 89bb51057..89dd031db 100644 --- a/app/i18n/locales/de.js +++ b/app/i18n/locales/de.js @@ -197,7 +197,6 @@ export default { Finish_recording: 'Beenden Sie die Aufnahme', Following_thread: 'Thread folgen', For_your_security_you_must_enter_your_current_password_to_continue: 'Zu Ihrer Sicherheit müssen Sie Ihr aktuelles Passwort eingeben, um fortzufahren', - Forgot_my_password: 'Ich habe mein Passwort vergessen', Forgot_password_If_this_email_is_registered: 'Wenn diese E-Mail registriert ist, senden wir Anweisungen zum Zurücksetzen Ihres Passworts. Wenn Sie in Kürze keine E-Mail erhalten, kommen Sie bitte zurück und versuchen Sie es erneut.', Forgot_password: 'Passwort vergessen', Forgot_Password: 'Passwort vergessen', diff --git a/app/i18n/locales/en.js b/app/i18n/locales/en.js index 1898d2c23..1edf38eb6 100644 --- a/app/i18n/locales/en.js +++ b/app/i18n/locales/en.js @@ -197,9 +197,8 @@ export default { Finish_recording: 'Finish recording', Following_thread: 'Following thread', For_your_security_you_must_enter_your_current_password_to_continue: 'For your security, you must enter your current password to continue', - Forgot_my_password: 'Forgot my password', Forgot_password_If_this_email_is_registered: 'If this email is registered, we\'ll send instructions on how to reset your password. If you do not receive an email shortly, please come back and try again.', - Forgot_password: 'Forgot password', + Forgot_password: 'Forgot your password?', Forgot_Password: 'Forgot Password', Full_table: 'Click to see full table', Generate_New_Link: 'Generate New Link', diff --git a/app/i18n/locales/es-ES.js b/app/i18n/locales/es-ES.js index 0dda19927..800df2581 100644 --- a/app/i18n/locales/es-ES.js +++ b/app/i18n/locales/es-ES.js @@ -187,7 +187,6 @@ export default { Finish_recording: 'Finalizar grabación', Following_thread: 'Siguiendo hilo', For_your_security_you_must_enter_your_current_password_to_continue: 'Por seguridad, debes introducir tu contraseña para continuar', - Forgot_my_password: 'He olvidado mi contraseña', Forgot_password_If_this_email_is_registered: 'Si este email está registrado, te enviaremos las instrucciones para resetear tu contraseña.Si no recibes un email en un rato, vuelve aquí e inténtalo de nuevo.', Forgot_password: 'Restablecer mi contraseña', Forgot_Password: 'Restabler mi Contraseña', diff --git a/app/i18n/locales/fr.js b/app/i18n/locales/fr.js index 5e7b92b54..fbb27c635 100644 --- a/app/i18n/locales/fr.js +++ b/app/i18n/locales/fr.js @@ -158,7 +158,6 @@ export default { File_name: 'Nom de fichier', Finish_recording: 'Terminer l\'enregistrement', For_your_security_you_must_enter_your_current_password_to_continue: 'Pour votre sécurité, vous devez entrer votre mot de passe actuel pour continuer.', - Forgot_my_password: 'J\'ai oublié mon mot de passe', Forgot_password_If_this_email_is_registered: 'Si cet e-mail est enregistré, nous vous enverrons des instructions pour réinitialiser votre mot de passe. Si vous ne recevez pas d\'e-mail sous peu, veuillez revenir et réessayer.', Forgot_password: 'Mot de passe oublié', Forgot_Password: 'Mot de passe oublié', diff --git a/app/i18n/locales/it.js b/app/i18n/locales/it.js index 769147694..272cfa558 100644 --- a/app/i18n/locales/it.js +++ b/app/i18n/locales/it.js @@ -191,7 +191,6 @@ export default { Finish_recording: 'Termina registrazione', Following_thread: 'Thread seguito', For_your_security_you_must_enter_your_current_password_to_continue: 'Per garantire la sicurezza del tuo account, inserisci la password per continuare.', - Forgot_my_password: 'Ho dimenticato la password', Forgot_password_If_this_email_is_registered: 'Se questa e-mail è registrata, manderemo istruzioni su come resettare la tua password. Se non ricevi nulla, torna qui e riprova di nuovo.', Forgot_password: 'Password dimenticata', Forgot_Password: 'Password dimenticata', diff --git a/app/i18n/locales/ja.js b/app/i18n/locales/ja.js index dc685a4aa..5f2195c01 100644 --- a/app/i18n/locales/ja.js +++ b/app/i18n/locales/ja.js @@ -215,7 +215,6 @@ export default { Following_thread: 'スレッド更新時に通知', For_your_security_you_must_enter_your_current_password_to_continue: 'セキュリティのため、続けるには現在のパスワードを入力してください。', - Forgot_my_password: 'パスワードを忘れた', Forgot_password_If_this_email_is_registered: '送信したメールアドレスが登録されていれば、パスワードのリセット方法を送信しました。メールアドレスがすぐに来ない場合はやり直してください。', Forgot_password: 'パスワードを忘れた', diff --git a/app/i18n/locales/nl.js b/app/i18n/locales/nl.js index 2cd46dcec..c7491b026 100644 --- a/app/i18n/locales/nl.js +++ b/app/i18n/locales/nl.js @@ -191,7 +191,6 @@ export default { Finish_recording: 'Beëindig opname', Following_thread: 'Volg thread', For_your_security_you_must_enter_your_current_password_to_continue: 'Voor je veiligheid moet je je wachtwoord invullen om door te gaan', - Forgot_my_password: 'Wachtwoord vergeten', Forgot_password_If_this_email_is_registered: 'Als dit email adres bij ons bekend is, sturen we je instructies op om je wachtwoord te resetten. Als je geen email krijgt, probeer het dan nogmaals.', Forgot_password: 'Wachtwoord vergeten', Forgot_Password: 'Wachtwoord Vergeten', diff --git a/app/i18n/locales/pt-BR.js b/app/i18n/locales/pt-BR.js index f76ca4354..b872c9e2d 100644 --- a/app/i18n/locales/pt-BR.js +++ b/app/i18n/locales/pt-BR.js @@ -189,7 +189,6 @@ export default { Finish_recording: 'Encerrar gravação', Following_thread: 'Começou a seguir tópico', For_your_security_you_must_enter_your_current_password_to_continue: 'Para sua segurança, você precisa digitar sua senha', - Forgot_my_password: 'Esqueci minha senha', Forgot_password_If_this_email_is_registered: 'Se este e-mail estiver cadastrado, enviaremos instruções sobre como redefinir sua senha. Se você não receber um e-mail em breve, volte e tente novamente.', Forgot_password: 'Esqueci minha senha', Forgot_Password: 'Esqueci minha senha', diff --git a/app/i18n/locales/pt-PT.js b/app/i18n/locales/pt-PT.js index ca7a2cdb7..bcbc58fce 100644 --- a/app/i18n/locales/pt-PT.js +++ b/app/i18n/locales/pt-PT.js @@ -158,7 +158,6 @@ export default { File_name: 'Nome do ficheiro', Finish_recording: 'Terminar a gravação', For_your_security_you_must_enter_your_current_password_to_continue: 'Para sua segurança, você deve escrever a sua palavra-passe actual para continuar', - Forgot_my_password: 'Esqueci minha palavra-passe', Forgot_password_If_this_email_is_registered: 'Se este e-mail estiver registado, enviaremos instruções sobre como repor a sua palavra-passe. Se você não receber um e-mail em breve, volte e tente novamente.', Forgot_password: 'Esquecer palavra-passe', Forgot_Password: 'Esquecer Palavra-passe', diff --git a/app/i18n/locales/ru.js b/app/i18n/locales/ru.js index a72d2262d..4c58c104a 100644 --- a/app/i18n/locales/ru.js +++ b/app/i18n/locales/ru.js @@ -182,7 +182,6 @@ export default { Finish_recording: 'Завершить запись', Following_thread: 'Следить за темой', For_your_security_you_must_enter_your_current_password_to_continue: 'В целях вашей безопасности вы должны ввести свой текущий пароль для продолжения', - Forgot_my_password: 'Забыл свой пароль', Forgot_password_If_this_email_is_registered: 'Если эта электронная почта зарегистрирована, мы отправим инструкции о том, как сбросить пароль. Если вы не получите письмо в ближайшее время, вернитесь и повторите попытку.', Forgot_password: 'Забыли пароль', Forgot_Password: 'Забыли Пароль', diff --git a/app/i18n/locales/zh-CN.js b/app/i18n/locales/zh-CN.js index af1853b79..56c67fca0 100644 --- a/app/i18n/locales/zh-CN.js +++ b/app/i18n/locales/zh-CN.js @@ -155,7 +155,6 @@ export default { Files: '文件', Finish_recording: '完成录制', For_your_security_you_must_enter_your_current_password_to_continue: '为了安全起见,您必须输入当前密码才能继续', - Forgot_my_password: '忘记密码', Forgot_password_If_this_email_is_registered: '如果这封邮件已注册,我们将发送如何重置密码的说明。如果您没有立即收到电子邮件,请回来再试一次。', Forgot_password: '忘记密码', Forgot_Password: '忘记密码', diff --git a/app/views/LoginSignupView.js b/app/views/LoginSignupView.js index 9b610f4f3..f4a6713d0 100644 --- a/app/views/LoginSignupView.js +++ b/app/views/LoginSignupView.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - Text, View, ScrollView, Image, StyleSheet, Animated, Easing + Text, View, ScrollView, Image, StyleSheet, Animated, Easing, Keyboard } from 'react-native'; import { connect } from 'react-redux'; import { Base64 } from 'js-base64'; @@ -9,6 +9,7 @@ import { SafeAreaView } from 'react-navigation'; import { BorderlessButton } from 'react-native-gesture-handler'; import equal from 'deep-equal'; +import { analytics } from '../utils/log'; import Touch from '../utils/touch'; import sharedStyles from './Styles'; import scrollPersistTaps from '../utils/scrollPersistTaps'; @@ -25,6 +26,9 @@ import FormContainer, { FormContainerInner } from '../containers/FormContainer'; import OnboardingSeparator from '../containers/OnboardingSeparator'; import TextInput from '../containers/TextInput'; +import { loginRequest as loginRequestAction } from '../actions/login'; +import { animateNextTransition } from '../utils/layoutAnimation'; + const styles = StyleSheet.create({ container: { paddingVertical: 30 @@ -97,8 +101,7 @@ const styles = StyleSheet.create({ fontSize: 22 }, inputContainer: { - marginTop: 24, - marginBottom: 32 + marginVertical: 16 }, bottomContainer: { flexDirection: 'column', @@ -148,40 +151,40 @@ class LoginSignupView extends React.Component { this.setTitle(Site_Name); } - shouldComponentUpdate(nextProps, nextState) { - const { collapsed, servicesHeight } = this.state; - const { - server, Site_Name, services, Accounts_ShowFormLogin, Accounts_RegistrationForm, Accounts_RegistrationForm_LinkReplacementText, theme - } = this.props; - if (nextState.collapsed !== collapsed) { - return true; - } - if (nextState.servicesHeight !== servicesHeight) { - return true; - } - if (nextProps.server !== server) { - return true; - } - if (nextProps.Site_Name !== Site_Name) { - return true; - } - if (nextProps.theme !== theme) { - return true; - } - if (nextProps.Accounts_ShowFormLogin !== Accounts_ShowFormLogin) { - return true; - } - if (nextProps.Accounts_RegistrationForm !== Accounts_RegistrationForm) { - return true; - } - if (nextProps.Accounts_RegistrationForm_LinkReplacementText !== Accounts_RegistrationForm_LinkReplacementText) { - return true; - } - if (!equal(nextProps.services, services)) { - return true; - } - return false; - } + // shouldComponentUpdate(nextProps, nextState) { + // const { collapsed, servicesHeight } = this.state; + // const { + // server, Site_Name, services, Accounts_ShowFormLogin, Accounts_RegistrationForm, Accounts_RegistrationForm_LinkReplacementText, theme + // } = this.props; + // if (nextState.collapsed !== collapsed) { + // return true; + // } + // if (nextState.servicesHeight !== servicesHeight) { + // return true; + // } + // if (nextProps.server !== server) { + // return true; + // } + // if (nextProps.Site_Name !== Site_Name) { + // return true; + // } + // if (nextProps.theme !== theme) { + // return true; + // } + // if (nextProps.Accounts_ShowFormLogin !== Accounts_ShowFormLogin) { + // return true; + // } + // if (nextProps.Accounts_RegistrationForm !== Accounts_RegistrationForm) { + // return true; + // } + // if (nextProps.Accounts_RegistrationForm_LinkReplacementText !== Accounts_RegistrationForm_LinkReplacementText) { + // return true; + // } + // if (!equal(nextProps.services, services)) { + // return true; + // } + // return false; + // } componentDidUpdate(prevProps) { const { Site_Name } = this.props; @@ -377,6 +380,18 @@ class LoginSignupView extends React.Component { return user.trim() && password.trim(); } + submit = () => { + if (!this.valid()) { + return; + } + + const { user, password, code } = this.state; + const { loginRequest } = this.props; + Keyboard.dismiss(); + loginRequest({ user, password, code }); + analytics().logEvent('login'); + } + renderServicesSeparator = () => { const { collapsed } = this.state; const { @@ -397,7 +412,7 @@ class LoginSignupView extends React.Component { return ( <>