Login with email working

This commit is contained in:
Diego Mello 2020-03-27 09:49:04 -03:00
parent f0408b3bcf
commit 09ef565e08
13 changed files with 67 additions and 57 deletions

View File

@ -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}

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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é',

View File

@ -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',

View File

@ -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: 'パスワードを忘れた',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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: 'Забыли Пароль',

View File

@ -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: '忘记密码',

View File

@ -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 (
<>
<Button
title='More options'
title={collapsed ? 'More options' : 'Less options'}
type='secondary'
onPress={this.toggleServices}
theme={theme}
@ -569,6 +584,7 @@ class LoginSignupView extends React.Component {
loading={isFetching}
disabled={!this.valid()}
theme={theme}
style={{ marginTop: 16 }}
/>
{Accounts_PasswordReset && (
<Button
@ -577,6 +593,8 @@ class LoginSignupView extends React.Component {
onPress={this.forgotPassword}
testID='login-view-forgot-password'
theme={theme}
color={themes[theme].auxiliaryText}
fontSize={14}
/>
)}
{Accounts_RegistrationForm === 'Public' ? (
@ -600,10 +618,8 @@ class LoginSignupView extends React.Component {
return (
<FormContainer theme={theme}>
<FormContainerInner>
{this.renderServices()}
{this.renderServicesSeparator()}
{/* {this.renderLogin()}
{this.renderRegister()} */}
{!showTOTP ? this.renderServices() : null}
{!showTOTP ? this.renderServicesSeparator() : null}
{!showTOTP ? this.renderUserForm() : null}
{showTOTP ? this.renderTOTP() : null}
</FormContainerInner>
@ -633,4 +649,8 @@ const mapStateToProps = state => ({
Accounts_PasswordReset: state.settings.Accounts_PasswordReset
});
export default connect(mapStateToProps)(withTheme(LoginSignupView));
const mapDispatchToProps = dispatch => ({
loginRequest: params => dispatch(loginRequestAction(params))
});
export default connect(mapStateToProps, mapDispatchToProps)(withTheme(LoginSignupView));