A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix login flow
ammarahm-ed34d447789a0d
diff --git a/apps/mobile/src/services/validation.js b/apps/mobile/src/services/validation.jsindex 95bf33840..7b2986671 100644--- a/apps/mobile/src/services/validation.js+++ b/apps/mobile/src/services/validation.js@@ -14,7 +14,7 @@ export function validatePass(password) {}if (password && password.length < 8 && password.length > 0) {return false;- } else if (password && password.length > 8 && password.length > 0) {+ } else if (password && password.length >= 8 && password.length > 0) {return true;}}diff --git a/apps/mobile/src/views/Login/index.js b/apps/mobile/src/views/Login/index.jsindex 3c59635d0..4cdf9a9cd 100644--- a/apps/mobile/src/views/Login/index.js+++ b/apps/mobile/src/views/Login/index.js@@ -27,11 +27,11 @@ export const Login = ({navigation}) => {const [status, setStatus] = useState('Logging in...');const _username = createRef();const [loggingIn, setLoggingIn] = useState(false);- const [email, setEmail] = useState('');- const [password, setPassword] = useState('');+ const [email, setEmail] = useState(null);+ const [password, setPassword] = useState(null);const [invalidEmail, setInvalidEmail] = useState(false);const [invalidPassword, setInvalidPassword] = useState(false);- const [username, setUsername] = useState('');+ const [username, setUsername] = useState(null);const [invalidUsername, setInvalidUsername] = useState(false);const isFocused = useIsFocused();@@ -66,6 +66,14 @@ export const Login = ({navigation}) => {}, [isFocused]);const _logIn = async () => {+ if (!password || password.length < 8) {+ ToastEvent.show("Invalid username or password", 'error');+ return;+ }+ if (!username) {+ ToastEvent.show("Invalid username or password", 'error');+ return+ }setLoggingIn(true);_username.current.blur();_pass.current.blur();diff --git a/apps/mobile/src/views/Signup/index.js b/apps/mobile/src/views/Signup/index.jsindex 5ce1d70bb..b869f448a 100644--- a/apps/mobile/src/views/Signup/index.js+++ b/apps/mobile/src/views/Signup/index.js@@ -30,6 +30,7 @@ import {Toast} from '../../components/Toast';const _email = createRef();const _pass = createRef();const _username = createRef();+const _passConfirm = createRef();export const Signup = ({navigation}) => {const [state, dispatch] = useTracked();const {colors, isLoginNavigator} = state;@@ -43,7 +44,9 @@ export const Signup = ({navigation}) => {const [invalidPassword, setInvalidPassword] = useState(false);const [failed, setFailed] = useState(false);const [modalVisible, setModalVisible] = useState(false);+ const [confirmPassword, setConfirmPassword] = useState(false);const [key, setKey] = useState('');+ const [passwordReEnter, setPasswordReEnter] = useState('');let isFocused = useIsFocused();const handleBackPress = () => {@@ -58,6 +61,10 @@ export const Signup = ({navigation}) => {}, [isFocused]);const _signUp = async () => {+ if (!confirmPassword){+ ToastEvent.show('Passwords do not match', 'error');+ return;+ }setSigningIn(true);setStatus('Creating new user...');if (!invalidEmail && !invalidPassword && !invalidUsername) {@@ -551,6 +558,60 @@ export const Signup = ({navigation}) => {placeholder="Password"placeholderTextColor={colors.icon}/>++ <TextInput+ ref={_passConfirm}+ editable={password ? true : false}+ defaultValue={passwordReEnter}+ onChangeText={value => {+ setPasswordReEnter(value);+ if (value !== password) {+ setConfirmPassword(false);+ _passConfirm.current.setNativeProps({+ style: {+ borderColor: colors.errorText,+ },+ });+ _pass.current.setNativeProps({+ style: {+ borderColor: colors.errorText,+ },+ });+ } else {+ setConfirmPassword(true);+ _passConfirm.current.setNativeProps({+ style: {+ borderColor: colors.accent,+ },+ });+ _pass.current.setNativeProps({+ style: {+ borderColor: colors.accent,+ },+ });+ }+ }}+ onFocus={() => {+ _passConfirm.current.setNativeProps({+ style: {+ borderColor: colors.accent,+ },+ });+ }}+ style={{+ padding: pv,+ borderWidth: 1.5,+ borderColor: colors.nav,+ marginHorizontal: 12,+ borderRadius: 5,+ marginTop: 12,+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.regular,+ }}+ secureTextEntry={true}+ placeholder="Confirm Password"+ placeholderTextColor={colors.icon}+ /></View><TouchableOpacityactiveOpacity={opacity}