From bd53f10099734bfaa2f22588518c1f74a16d606f Mon Sep 17 00:00:00 2001 From: Gleidson Daniel Silva Date: Wed, 5 Jun 2024 13:27:29 -0400 Subject: [PATCH] feat: request password change (#5722) * feat: add ChangePasswordRequired container * chore: add support do multiple inputs on ActionSheetContentWithInputAndSubmit * chore: add requirePasswordChange definition * chore: add setUserPassword function for setting user password * fix: handle error message with optional chaining in showErrorAlertWithEMessage * chore: Update defaultSettings.ts with new account-related values * feat: add requirePasswordChange prop * feat: add ChangePasswordRequired component * chore: finish some implementations on requirePasswordChange * action: organized translations * fix lint * lint * test: add e2e * feat add pt-br * action: organized translations * fix lint * time * fix tests * improve key name * Update app/containers/ChangePasswordRequired.tsx Co-authored-by: Diego Mello --------- Co-authored-by: GleidsonDaniel Co-authored-by: Diego Mello --- .../index.tsx | 110 +++++++++++++----- app/containers/ChangePasswordRequired.tsx | 107 +++++++++++++++++ app/definitions/ILoggedUser.ts | 1 + app/i18n/locales/en.json | 5 + app/i18n/locales/pt-BR.json | 5 + app/lib/constants/defaultSettings.ts | 6 + app/lib/database/model/servers/User.js | 2 + app/lib/database/model/servers/migrations.js | 11 ++ app/lib/database/schema/servers.js | 5 +- app/lib/methods/helpers/info.ts | 2 +- app/lib/services/connect.ts | 3 +- app/lib/services/restApi.ts | 2 + app/sagas/login.js | 16 ++- app/sagas/selectServer.ts | 3 +- .../DeleteAccountActionSheetContent/index.tsx | 2 +- app/views/ProfileView/index.tsx | 13 +-- app/views/RoomsListView/index.tsx | 30 +++-- e2e/helpers/data_setup.ts | 5 +- e2e/tests/assorted/03-profile.spec.ts | 10 +- .../08-change-password-required.spec.ts | 63 ++++++++++ 20 files changed, 333 insertions(+), 68 deletions(-) create mode 100644 app/containers/ChangePasswordRequired.tsx create mode 100644 e2e/tests/onboarding/08-change-password-required.spec.ts diff --git a/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx b/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx index 9003827a15..ae0f2c3bb2 100644 --- a/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx +++ b/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useRef } from 'react'; import { StyleSheet, Text, View } from 'react-native'; import { CustomIcon, TIconsName } from '../../CustomIcon'; @@ -42,22 +42,28 @@ const FooterButtons = ({ confirmTitle = '', disabled = false, cancelBackgroundColor = '', - confirmBackgroundColor = '' + confirmBackgroundColor = '', + testID = '' }): React.ReactElement => { const { colors } = useTheme(); return (