Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

add show secure password to login/signup

ammarahm-eda5f789a5f3f5
diff --git a/apps/mobile/src/views/Login/index.js b/apps/mobile/src/views/Login/index.js
index 4cdf9a9cd..835b019fe 100644
--- a/apps/mobile/src/views/Login/index.js
+++ b/apps/mobile/src/views/Login/index.js
@@ -33,6 +33,7 @@ export const Login = ({navigation}) => {
const [invalidPassword, setInvalidPassword] = useState(false);
const [username, setUsername] = useState(null);
const [invalidUsername, setInvalidUsername] = useState(false);
+ const [secureEntry, setSecureEntry] = useState(true);
const isFocused = useIsFocused();
@@ -67,12 +68,12 @@ export const Login = ({navigation}) => {
const _logIn = async () => {
if (!password || password.length < 8) {
- ToastEvent.show("Invalid username or password", 'error');
+ ToastEvent.show('Invalid username or password', 'error');
return;
}
if (!username) {
- ToastEvent.show("Invalid username or password", 'error');
- return
+ ToastEvent.show('Invalid username or password', 'error');
+ return;
}
setLoggingIn(true);
_username.current.blur();
@@ -350,6 +351,7 @@ export const Login = ({navigation}) => {
style={{
marginBottom: 15,
marginTop: 15,
+ justifyContent: 'center',
}}>
<Text
style={{
@@ -369,6 +371,19 @@ export const Login = ({navigation}) => {
/>
) : null}
</Text>
+ <Icon
+ name="eye"
+ size={20}
+ onPress={() => {
+ setSecureEntry(!secureEntry);
+ }}
+ style={{
+ position: 'absolute',
+ right: 30,
+ zIndex: 10,
+ }}
+ color={secureEntry ? colors.icon : colors.accent}
+ />
<TextInput
ref={_pass}
onFocus={() => {
@@ -382,7 +397,7 @@ export const Login = ({navigation}) => {
}}
defaultValue={password}
onBlur={() => {
- if (!validatePass(password) && password.length > 0) {
+ if (!validatePass(password) && password?.length > 0) {
setInvalidPassword(true);
_pass.current.setNativeProps({
style: {
@@ -401,7 +416,6 @@ export const Login = ({navigation}) => {
}}
onChangeText={value => {
setPassword(value);
-
if (invalidPassword && validatePass(password)) {
setInvalidPassword(false);
_pass.current.setNativeProps({
@@ -427,14 +441,16 @@ export const Login = ({navigation}) => {
borderWidth: 1.5,
borderColor: colors.nav,
marginHorizontal: 12,
+ paddingRight:24,
borderRadius: 5,
fontSize: SIZE.sm,
fontFamily: WEIGHT.regular,
}}
- secureTextEntry={true}
+ secureTextEntry={secureEntry}
placeholder="Password"
placeholderTextColor={colors.icon}
/>
+
{/* <View
style={{
paddingHorizontal: 12,
diff --git a/apps/mobile/src/views/Signup/index.js b/apps/mobile/src/views/Signup/index.js
index 57397c8af..00459c0ce 100644
--- a/apps/mobile/src/views/Signup/index.js
+++ b/apps/mobile/src/views/Signup/index.js
@@ -47,6 +47,7 @@ export const Signup = ({navigation}) => {
const [confirmPassword, setConfirmPassword] = useState(false);
const [key, setKey] = useState('');
const [passwordReEnter, setPasswordReEnter] = useState(null);
+ const [secureEntry, setSecureEntry] = useState(true);
let isFocused = useIsFocused();
const handleBackPress = () => {
@@ -329,7 +330,7 @@ export const Signup = ({navigation}) => {
}}
defaultValue={username}
onBlur={() => {
- if (!validateUsername(username) && username.length > 0) {
+ if (!validateUsername(username) && username?.length > 0) {
setInvalidUsername(true);
_username.current.setNativeProps({
style: {
@@ -421,7 +422,7 @@ export const Signup = ({navigation}) => {
}}
defaultValue={email}
onBlur={() => {
- if (!validateEmail(email) && email.length > 0) {
+ if (!validateEmail(email) && email?.length > 0) {
setInvalidEmail(true);
_email.current.setNativeProps({
style: {
@@ -479,6 +480,7 @@ export const Signup = ({navigation}) => {
style={{
marginTop: 15,
marginBottom: 15,
+ justifyContent:'center'
}}>
<Text
style={{
@@ -499,6 +501,19 @@ export const Signup = ({navigation}) => {
/>
) : null}
</Text>
+ <Icon
+ name="eye"
+ size={20}
+ onPress={() => {
+ setSecureEntry(!secureEntry);
+ }}
+ style={{
+ position: 'absolute',
+ right: 30,
+ zIndex: 10,
+ }}
+ color={secureEntry ? colors.icon : colors.accent}
+ />
<TextInput
ref={_pass}
onFocus={() => {
@@ -557,18 +572,22 @@ export const Signup = ({navigation}) => {
borderWidth: 1.5,
borderColor: colors.nav,
marginHorizontal: 12,
+ paddingRight:24,
borderRadius: 5,
fontSize: SIZE.sm,
fontFamily: WEIGHT.regular,
}}
- secureTextEntry={true}
+ secureTextEntry={secureEntry}
placeholder="Password"
placeholderTextColor={colors.icon}
/>
- <TextInput
+
+ </View>
+
+ <TextInput
ref={_passConfirm}
- editable={password ? true : false}
+ editable={password && !invalidPassword ? true : false}
defaultValue={passwordReEnter}
onChangeText={value => {
setPasswordReEnter(value);
@@ -611,15 +630,14 @@ export const Signup = ({navigation}) => {
borderColor: colors.nav,
marginHorizontal: 12,
borderRadius: 5,
- marginTop: 12,
+ marginBottom: 12,
fontSize: SIZE.sm,
fontFamily: WEIGHT.regular,
}}
- secureTextEntry={true}
+ secureTextEntry={secureEntry}
placeholder="Confirm Password"
placeholderTextColor={colors.icon}
/>
- </View>
<TouchableOpacity
activeOpacity={opacity}
onPress={_signUp}