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
some cleanup on Signup and login page
ammarahm-ed8a2267c439b8
diff --git a/apps/mobile/src/components/Seperator/index.js b/apps/mobile/src/components/Seperator/index.jsindex c1454a904..c2df766bb 100644--- a/apps/mobile/src/components/Seperator/index.js+++ b/apps/mobile/src/components/Seperator/index.js@@ -5,8 +5,8 @@ const Seperator = ({half = false}) => {return (<Viewstyle={{- width: half ? 10 : 20,- height: half ? 10 : 20,+ width: half ? 7.5 :15,+ height: half ? 7.5 : 15,}}/>);diff --git a/apps/mobile/src/views/Login/index.js b/apps/mobile/src/views/Login/index.jsindex a6a8e5cec..d4fe004aa 100644--- a/apps/mobile/src/views/Login/index.js+++ b/apps/mobile/src/views/Login/index.js@@ -11,6 +11,7 @@ import * as Animatable from 'react-native-animatable';import {TextInput} from 'react-native-gesture-handler';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import {opacity, pv, SIZE, WEIGHT} from '../../common/common';+import {Button} from '../../components/Button';import {useTracked} from '../../provider';import {ACTIONS} from '../../provider/actions';import {eSendEvent} from '../../services/eventManager';@@ -22,8 +23,7 @@ import {refreshNotesPage,} from '../../services/events';import {validatePass, validateUsername} from '../../services/validation';-import {db, DDS, getElevation, ToastEvent} from '../../utils/utils';-import {Button} from '../../components/Button';+import {db, DDS, ToastEvent} from '../../utils/utils';import Seperator from '../../components/Seperator';export const Login = ({route, navigation}) => {@@ -72,7 +72,7 @@ export const Login = ({route, navigation}) => {};}, [isFocused]);- const _logIn = async () => {+ const login = async () => {if (!password ||password.length < 8 ||@@ -80,7 +80,7 @@ export const Login = ({route, navigation}) => {invalidPassword ||invalidUsername) {- ToastEvent.show('username or password invalid', 'error');+ ToastEvent.show('username or password is invalid', 'error');return;}@@ -183,6 +183,7 @@ export const Login = ({route, navigation}) => {}}}, [isFocused]);+return (<Viewstyle={{@@ -401,152 +402,144 @@ export const Login = ({route, navigation}) => {</Text>) : null}+ <Seperator /><View+ ref={_passContainer}style={{- marginBottom: 15,- marginTop: 15,- justifyContent: 'center',+ borderWidth: 1.5,+ borderColor: colors.nav,+ borderRadius: 5,+ flexDirection: 'row',+ justifyContent: 'space-between',+ alignItems: 'center',+ paddingHorizontal: 10,}}>- <View- ref={_passContainer}- style={{- borderWidth: 1.5,- borderColor: colors.nav,- borderRadius: 5,- flexDirection: 'row',- justifyContent: 'space-between',- alignItems: 'center',- paddingHorizontal: 10,- }}>- <TextInput- ref={_pass}- onFocus={() => {- if (!invalidPassword) {- _passContainer.current?.setNativeProps({- style: {- borderColor: colors.accent,- },- });- }- }}- onBlur={() => {- if (!validatePass(password) && password?.length > 0) {- setInvalidPassword(true);+ <TextInput+ ref={_pass}+ onFocus={() => {+ if (!invalidPassword) {+ _passContainer.current?.setNativeProps({+ style: {+ borderColor: colors.accent,+ },+ });+ }+ }}+ onBlur={() => {+ if (!validatePass(password) && password?.length > 0) {+ setInvalidPassword(true);- _passContainer.current?.setNativeProps({- style: {- borderColor: colors.errorText,- },- });- } else {- setInvalidPassword(false);- _passContainer.current?.setNativeProps({- style: {- borderColor: colors.nav,- },- });- }- }}- onChangeText={(value) => {- setPassword(value);- console.log(value, 'VALUE');- if (invalidPassword && validatePass(password)) {- setInvalidPassword(false);+ _passContainer.current?.setNativeProps({+ style: {+ borderColor: colors.errorText,+ },+ });+ } else {+ setInvalidPassword(false);+ _passContainer.current?.setNativeProps({+ style: {+ borderColor: colors.nav,+ },+ });+ }+ }}+ onChangeText={(value) => {+ setPassword(value);+ console.log(value, 'VALUE');+ if (invalidPassword && validatePass(password)) {+ setInvalidPassword(false);- _passContainer.current.setNativeProps({- style: {- borderColor: colors.accent,- },- });- }- }}- onSubmitEditing={() => {- if (!validatePass(password)) {- setInvalidPassword(true);- _pass.current.setNativeProps({- style: {- color: colors.errorText,- },- });- }- }}- style={{- paddingVertical: pv,- paddingHorizontal: 0,- fontSize: SIZE.sm,- fontFamily: WEIGHT.regular,- width: '85%',- maxWidth: '85%',- }}- secureTextEntry={secureEntry}- placeholder="Password"- placeholderTextColor={colors.icon}- />+ _passContainer.current.setNativeProps({+ style: {+ borderColor: colors.accent,+ },+ });+ }+ }}+ onSubmitEditing={() => {+ if (!validatePass(password)) {+ setInvalidPassword(true);+ _pass.current.setNativeProps({+ style: {+ color: colors.errorText,+ },+ });+ }+ }}+ style={{+ paddingVertical: pv,+ paddingHorizontal: 0,+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.regular,+ width: '85%',+ maxWidth: '85%',+ }}+ secureTextEntry={secureEntry}+ placeholder="Password"+ placeholderTextColor={colors.icon}+ />+ <Icon+ name="eye"+ size={SIZE.md}+ onPress={() => {+ setSecureEntry(!secureEntry);+ }}+ style={{+ width: 25,+ }}+ color={secureEntry ? colors.icon : colors.accent}+ />+ </View>++ {invalidPassword ? (+ <Text+ style={{+ textAlign: 'right',+ fontFamily: WEIGHT.regular,+ textAlignVertical: 'bottom',+ fontSize: SIZE.xs,+ marginTop: 2.5,+ }}><Icon- name="eye"- size={SIZE.md}- onPress={() => {- setSecureEntry(!secureEntry);- }}- style={{- width: 25,- }}- color={secureEntry ? colors.icon : colors.accent}- />- </View>+ name="alert-circle-outline"+ size={SIZE.xs}+ color={colors.errorText}+ />{' '}+ Password is invalid+ </Text>+ ) : null}- {invalidPassword ? (- <Text- style={{- textAlign: 'right',- fontFamily: WEIGHT.regular,- textAlignVertical: 'bottom',- fontSize: SIZE.xs,- marginTop: 2.5,- }}>- <Icon- name="alert-circle-outline"- size={SIZE.xs}- color={colors.errorText}- />{' '}- Password is invalid- </Text>- ) : null}- </View>- <Button title="Login" onPress={_logIn} width="100%" />+ <Seperator />++ <Button title="Login" onPress={login} width="100%" /></View>- <View+ <TouchableOpacity+ onPress={() => {+ navigation.navigate('Signup', {+ root: true,+ });+ }}+ activeOpacity={opacity}style={{- width: '100%',- alignItems: 'center',- justifyContent: 'center',+ alignSelf: 'center',}}>- <TouchableOpacity- onPress={() => {- navigation.navigate('Signup', {- root: true,- });- }}- activeOpacity={opacity}- style={{}}>+ <Text+ style={{+ fontSize: SIZE.xs + 1,+ fontFamily: WEIGHT.regular,+ color: colors.pri,+ height: 25,+ }}>+ Don't have an account yet?{' '}<Textstyle={{- fontSize: SIZE.xs + 1,- fontFamily: WEIGHT.regular,- color: colors.pri,- height: 25,+ color: colors.accent,}}>- Don't have an account yet?{' '}- <Text- style={{- color: colors.accent,- }}>- Sign Up- </Text>+ Sign Up</Text>- </TouchableOpacity>- </View>+ </Text>+ </TouchableOpacity></View></View></>diff --git a/apps/mobile/src/views/Signup/index.js b/apps/mobile/src/views/Signup/index.jsindex 5db297a18..7d86f23c2 100644--- a/apps/mobile/src/views/Signup/index.js+++ b/apps/mobile/src/views/Signup/index.js@@ -34,6 +34,8 @@ import {validateUsername,} from '../../services/validation';import {db, DDS, getElevation, ToastEvent} from '../../utils/utils';+import {Button} from '../../components/Button';+import Seperator from '../../components/Seperator';const _email = createRef();const _pass = createRef();@@ -90,7 +92,7 @@ export const Signup = ({route, navigation}) => {}};- const _signUp = async () => {+ const signup = async () => {if (!validateInfo) return;setSigningIn(true);@@ -190,7 +192,7 @@ export const Signup = ({route, navigation}) => {<Modalanimated={true}animationType="fade"- visible={true}+ visible={modalVisible}transparent={true}><Viewstyle={{@@ -368,77 +370,238 @@ export const Signup = ({route, navigation}) => {width: DDS.isTab ? '80%' : '100%',height: DDS.isTab ? '80%' : '100%',alignSelf: 'center',+ paddingHorizontal: 12,}}>- <View>+ <TextInput+ ref={_username}+ onFocus={() => {+ if (!invalidUsername) {+ _username.current.setNativeProps({+ style: {+ borderColor: colors.accent,+ },+ });+ }+ }}+ defaultValue={username}+ onBlur={() => {+ if (!validateUsername(username) && username?.length > 0) {+ setInvalidUsername(true);+ _username.current.setNativeProps({+ style: {+ color: colors.errorText,+ borderColor: colors.errorText,+ },+ });+ } else {+ setInvalidUsername(false);+ _username.current.setNativeProps({+ style: {+ borderColor: colors.nav,+ },+ });+ }+ }}+ textContentType="username"+ onChangeText={(value) => {+ setUsername(value);++ if (invalidUsername && validateUsername(username)) {+ setInvalidUsername(false);+ _username.current.setNativeProps({+ style: {+ color: colors.pri,+ borderColor: colors.accent,+ },+ });+ }+ }}+ onSubmitEditing={() => {+ if (!validateUsername(username)) {+ setInvalidUsername(true);+ _username.current.setNativeProps({+ style: {+ color: colors.errorText,+ },+ });+ }+ }}+ style={{+ padding: pv,+ borderWidth: 1.5,+ borderColor: colors.nav,+ borderRadius: 5,+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.regular,+ }}+ placeholder="Username (a-z _- 0-9)"+ placeholderTextColor={colors.icon}+ />++ {invalidUsername ? (<Textstyle={{textAlign: 'right',- marginHorizontal: 12,fontFamily: WEIGHT.regular,-textAlignVertical: 'bottom',+ fontSize: SIZE.xs,+ marginTop: 2.5,+ }}>+ <Icon+ name="alert-circle-outline"+ size={SIZE.xs}+ color={colors.errorText}+ />{' '}+ Username is invalid+ </Text>+ ) : null}++ <Seperator />- position: 'absolute',- right: 5,- top: 2.5,+ <TextInput+ ref={_email}+ onFocus={() => {+ if (!invalidEmail) {+ _email.current.setNativeProps({+ style: {+ borderColor: colors.accent,+ },+ });+ }+ }}+ defaultValue={email}+ onBlur={() => {+ if (!validateEmail(email) && email?.length > 0) {+ setInvalidEmail(true);+ _email.current.setNativeProps({+ style: {+ color: colors.errorText,+ borderColor: colors.errorText,+ },+ });+ } else {+ setInvalidEmail(false);+ _email.current.setNativeProps({+ style: {+ borderColor: colors.nav,+ },+ });+ }+ }}+ textContentType="emailAddress"+ onChangeText={(value) => {+ setEmail(value);+ if (invalidEmail && validateEmail(email)) {+ setInvalidEmail(false);+ _email.current.setNativeProps({+ style: {+ color: colors.pri,+ borderColor: colors.accent,+ },+ });+ }+ }}+ onSubmitEditing={() => {+ if (!validateEmail(email)) {+ setInvalidEmail(true);+ _email.current.setNativeProps({+ style: {+ color: colors.errorText,+ },+ });+ }+ }}+ style={{+ padding: pv,+ borderWidth: 1.5,+ borderColor: colors.nav,+ borderRadius: 5,+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.regular,+ }}+ placeholder="Email"+ placeholderTextColor={colors.icon}+ />+ {invalidEmail ? (+ <Text+ style={{+ textAlign: 'right',+ fontFamily: WEIGHT.regular,+ textAlignVertical: 'bottom',+ fontSize: SIZE.xs,+ marginTop: 2.5,}}>- {invalidUsername ? (- <Icon- name="alert-circle-outline"- size={SIZE.xs}- color={colors.errorText}- />- ) : null}+ <Icon+ name="alert-circle-outline"+ size={SIZE.xs}+ color={colors.errorText}+ />{' '}+ Password is invalid</Text>+ ) : null}++ <Seperator />+ <View+ ref={_passContainer}+ style={{+ borderWidth: 1.5,+ borderColor: colors.nav,+ paddingHorizontal: 10,+ borderRadius: 5,+ flexDirection: 'row',+ justifyContent: 'space-between',+ alignItems: 'center',+ }}><TextInput- ref={_username}+ ref={_pass}onFocus={() => {- if (!invalidUsername) {- _username.current.setNativeProps({+ if (!invalidPassword) {+ _passContainer.current?.setNativeProps({style: {borderColor: colors.accent,},});}}}- defaultValue={username}+ defaultValue={password}onBlur={() => {- if (!validateUsername(username) && username?.length > 0) {- setInvalidUsername(true);- _username.current.setNativeProps({+ if (!validatePass(password) && password?.length > 0) {+ setInvalidPassword(true);+ _pass.current.setNativeProps({style: {color: colors.errorText,+ },+ });+ _passContainer.current?.setNativeProps({+ style: {borderColor: colors.errorText,},});} else {- setInvalidUsername(false);- _username.current.setNativeProps({+ setInvalidPassword(false);+ _passContainer.current?.setNativeProps({style: {borderColor: colors.nav,},});}}}- textContentType="username"onChangeText={(value) => {- setUsername(value);-- if (invalidUsername && validateUsername(username)) {- setInvalidUsername(false);- _username.current.setNativeProps({+ setPassword(value);+ if (invalidPassword && validatePass(password)) {+ setInvalidPassword(false);+ _pass.current.setNativeProps({style: {color: colors.pri,- borderColor: colors.accent,},});}}}onSubmitEditing={() => {- if (!validateUsername(username)) {- setInvalidUsername(true);- _username.current.setNativeProps({+ if (!validatePass(password)) {+ setInvalidPassword(true);+ _pass.current.setNativeProps({style: {color: colors.errorText,},@@ -446,330 +609,148 @@ export const Signup = ({route, navigation}) => {}}}style={{- padding: pv,- borderWidth: 1.5,- borderColor: colors.nav,- marginHorizontal: 12,- borderRadius: 5,+ paddingVertical: pv,+ paddingHorizontal: 0,fontSize: SIZE.sm,fontFamily: WEIGHT.regular,+ width: '85%',+ maxWidth: '85%',}}- placeholder="Username (a-z _- 0-9)"+ secureTextEntry={secureEntry}+ placeholder="Password"placeholderTextColor={colors.icon}/>- <View+ <Icon+ name="eye"+ size={20}+ onPress={() => {+ setSecureEntry(!secureEntry);+ }}style={{- marginTop: 15,- }}>- <Text- style={{- textAlign: 'right',- marginHorizontal: 12,- fontFamily: WEIGHT.regular,- textAlignVertical: 'bottom',- position: 'absolute',- right: 5,- top: 2.5,- }}>- {invalidEmail ? (- <Icon- name="alert-circle-outline"- size={SIZE.xs}- color={colors.errorText}- />- ) : null}- </Text>-- <TextInput- ref={_email}- onFocus={() => {- if (!invalidEmail) {- _email.current.setNativeProps({- style: {- borderColor: colors.accent,- },- });- }- }}- defaultValue={email}- onBlur={() => {- if (!validateEmail(email) && email?.length > 0) {- setInvalidEmail(true);- _email.current.setNativeProps({- style: {- color: colors.errorText,- borderColor: colors.errorText,- },- });- } else {- setInvalidEmail(false);- _email.current.setNativeProps({- style: {- borderColor: colors.nav,- },- });- }- }}- textContentType="emailAddress"- onChangeText={(value) => {- setEmail(value);- if (invalidEmail && validateEmail(email)) {- setInvalidEmail(false);- _email.current.setNativeProps({- style: {- color: colors.pri,- borderColor: colors.accent,- },- });- }- }}- onSubmitEditing={() => {- if (!validateEmail(email)) {- setInvalidEmail(true);- _email.current.setNativeProps({- style: {- color: colors.errorText,- },- });- }- }}- style={{- padding: pv,- borderWidth: 1.5,- borderColor: colors.nav,- marginHorizontal: 12,- borderRadius: 5,- fontSize: SIZE.sm,- fontFamily: WEIGHT.regular,- }}- placeholder="Email"- placeholderTextColor={colors.icon}- />- </View>- <View+ width: 25,+ }}+ color={secureEntry ? colors.icon : colors.accent}+ />+ </View>+ {invalidPassword ? (+ <Textstyle={{- marginBottom: 15,- marginTop: 15,- justifyContent: 'center',+ textAlign: 'right',+ fontFamily: WEIGHT.regular,+ textAlignVertical: 'bottom',+ fontSize: SIZE.xs,+ marginTop: 2.5,}}>- <Text- style={{- textAlign: 'right',- marginHorizontal: 12,- fontFamily: WEIGHT.regular,- textAlignVertical: 'bottom',- position: 'absolute',- right: 5,- top: 2.5,- }}>- {invalidPassword ? (- <Icon- name="alert-circle-outline"- size={SIZE.xs}- color={colors.errorText}- />- ) : null}- </Text>-- <View- ref={_passContainer}- style={{- borderWidth: 1.5,- borderColor: colors.nav,- paddingHorizontal: 10,- borderRadius: 5,- flexDirection: 'row',- justifyContent: 'space-between',- alignItems: 'center',- marginHorizontal: 12,- }}>- <TextInput- ref={_pass}- onFocus={() => {- if (!invalidPassword) {- _passContainer.current?.setNativeProps({- style: {- borderColor: colors.accent,- },- });- }- }}- defaultValue={password}- onBlur={() => {- if (!validatePass(password) && password?.length > 0) {- setInvalidPassword(true);- _pass.current.setNativeProps({- style: {- color: colors.errorText,- },- });- _passContainer.current?.setNativeProps({- style: {- borderColor: colors.errorText,- },- });- } else {- setInvalidPassword(false);- _passContainer.current?.setNativeProps({- style: {- borderColor: colors.nav,- },- });- }- }}- onChangeText={(value) => {- setPassword(value);- if (invalidPassword && validatePass(password)) {- setInvalidPassword(false);- _pass.current.setNativeProps({- style: {- color: colors.pri,- },- });- }- }}- onSubmitEditing={() => {- if (!validatePass(password)) {- setInvalidPassword(true);- _pass.current.setNativeProps({- style: {- color: colors.errorText,- },- });- }- }}- style={{- paddingVertical: pv,- paddingHorizontal: 0,- fontSize: SIZE.sm,- fontFamily: WEIGHT.regular,- width: '85%',- maxWidth: '85%',- }}- secureTextEntry={secureEntry}- placeholder="Password"- placeholderTextColor={colors.icon}- />-- <Icon- name="eye"- size={20}- onPress={() => {- setSecureEntry(!secureEntry);- }}- style={{- width: 25,- }}- color={secureEntry ? colors.icon : colors.accent}- />- </View>- </View>- <TextInput- ref={_passConfirm}- editable={password && !invalidPassword ? 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={() => {+ <Icon+ name="alert-circle-outline"+ size={SIZE.xs}+ color={colors.errorText}+ />{' '}+ Password is invalid+ </Text>+ ) : null}++ <Seperator />+ <TextInput+ ref={_passConfirm}+ editable={password && !invalidPassword ? 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,+ borderRadius: 5,+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.regular,+ }}+ secureTextEntry={secureEntry}+ placeholder="Confirm Password"+ placeholderTextColor={colors.icon}+ />++ {password && !invalidPassword && !confirmPassword ? (+ <Textstyle={{- padding: pv,- borderWidth: 1.5,- borderColor: colors.nav,- marginHorizontal: 12,- borderRadius: 5,- marginBottom: 12,- fontSize: SIZE.sm,+ textAlign: 'right',fontFamily: WEIGHT.regular,- }}- secureTextEntry={secureEntry}- placeholder="Confirm Password"- placeholderTextColor={colors.icon}- />- <TouchableOpacity- activeOpacity={opacity}- onPress={_signUp}- style={{- ...getElevation(5),- padding: pv + 2,- backgroundColor: colors.accent,- borderRadius: 5,- marginHorizontal: 12,- marginBottom: 10,- alignItems: 'center',+ textAlignVertical: 'bottom',+ fontSize: SIZE.xs,+ marginTop: 2.5,}}>- <Text- style={{- fontSize: SIZE.md,- fontFamily: WEIGHT.medium,- color: 'white',- }}>- Sign Up- </Text>- </TouchableOpacity>- </View>- <View+ <Icon+ name="alert-circle-outline"+ size={SIZE.xs}+ color={colors.errorText}+ />{' '}+ Passwords do not match+ </Text>+ ) : null}++ <Seperator />++ <Button title="Signup" onPress={signup} width="100%" />++ <TouchableOpacity+ onPress={() => {+ Linking.openURL('https://notesnook.com/privacy.html');+ }}+ activeOpacity={opacity}style={{- width: '100%',- alignItems: 'center',- justifyContent: 'center',- height: 75,+ alignSelf: 'center',+ marginTop: 70,}}>- <TouchableOpacity- onPress={() => {- Linking.openURL('https://notesnook.com/privacy.html');- }}- activeOpacity={opacity}- style={{}}>+ <Text+ style={{+ fontSize: SIZE.xs + 1,+ fontFamily: WEIGHT.regular,+ color: colors.pri,+ height: 25,+ }}>+ By signing up you agree to our{' '}<Textstyle={{- fontSize: SIZE.xs + 1,- fontFamily: WEIGHT.regular,- color: colors.pri,- height: 25,+ color: colors.accent,}}>- By signing up you agree to our{' '}- <Text- style={{- color: colors.accent,- }}>- privacy policy- </Text>+ privacy policy</Text>- </TouchableOpacity>- </View>+ </Text>+ </TouchableOpacity></View></>)}