Skip to content

Commit

Permalink
[feat] added resetPassword screen, implemented most functionality exc…
Browse files Browse the repository at this point in the history
…ept checking if new pwd matches existing pwd, and styled page
  • Loading branch information
kylezryr committed Feb 25, 2024
1 parent 373893a commit c8583e8
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 147 deletions.
287 changes: 144 additions & 143 deletions src/app/auth/resetPassword/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,156 +85,157 @@ function ResetPasswordScreen() {

return (
<View style={styles.container}>
<Text style={[globalStyles.h1]}>Create a New Password</Text>
<View style = {styles.newPassword}>
<UserStringInput
placeholder="Password"
label="New password"
placeholderTextColor={colors.darkGrey}
onChange={text => {
setPassword(text);
checkPassword(text);
}}
value={password}
attributes={{
textContentType: 'password',
secureTextEntry: passwordTextHidden,
}}
>
<RNEIcon
name={passwordTextHidden ? 'visibility-off' : 'visibility'}
type="material"
style={styles.icon}
onPress={() => setPasswordTextHidden(!passwordTextHidden)}
/>
</UserStringInput>
</View>

{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={hasUppercase ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
hasUppercase
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
At least 1 uppercase letter
</Text>
</View>
)}
{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={hasLowercase ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
hasLowercase
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
At least 1 lowercase letter
</Text>
</View>
)}
{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={hasNumber ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
hasNumber
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
<View>
<Text style={[globalStyles.h1]}>Create a New Password</Text>
<View style={styles.newPassword}>
<UserStringInput
placeholder="Password"
label="New password"
placeholderTextColor={colors.darkGrey}
onChange={text => {
setPassword(text);
checkPassword(text);
}}
value={password}
attributes={{
textContentType: 'password',
secureTextEntry: passwordTextHidden,
}}
>
At least 1 number
</Text>
<RNEIcon
name={passwordTextHidden ? 'visibility-off' : 'visibility'}
type="material"
style={styles.icon}
onPress={() => setPasswordTextHidden(!passwordTextHidden)}
/>
</UserStringInput>
</View>
)}
{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={hasLength ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
hasLength
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
At least 8 characters
</Text>
</View>
)}
{/* functionality for this has not been implemented */}
{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={isDifferent ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
isDifferent
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
Must be different than your old password
</Text>
</View>
)}

<View style = {styles.newPassword}>
<UserStringInput
placeholder="Confirm Password"
label="Confirm password"
placeholderTextColor={colors.darkGrey}
onChange={text => {
setConfirmPassword(text);
checkConfirmPassword(text);
}}
value={confirmPassword}
attributes={{
textContentType: 'password',
secureTextEntry: confirmPasswordTextHidden,
}}
>
<RNEIcon
name={confirmPasswordTextHidden ? 'visibility-off' : 'visibility'}
type="material"
style={styles.icon}
onPress={() =>
setConfirmPasswordTextHidden(!confirmPasswordTextHidden)
}
/>
</UserStringInput>
</View>
{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={hasUppercase ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
hasUppercase
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
At least 1 uppercase letter
</Text>
</View>
)}
{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={hasLowercase ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
hasLowercase
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
At least 1 lowercase letter
</Text>
</View>
)}
{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={hasNumber ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
hasNumber
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
At least 1 number
</Text>
</View>
)}
{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={hasLength ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
hasLength
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
At least 8 characters
</Text>
</View>
)}
{/* functionality for this has not been implemented */}
{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={isDifferent ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
isDifferent
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
Must be different than your old password
</Text>
</View>
)}

{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={isMatching ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
isMatching
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
<View style={styles.newPassword}>
<UserStringInput
placeholder="Confirm Password"
label="Confirm password"
placeholderTextColor={colors.darkGrey}
onChange={text => {
setConfirmPassword(text);
checkConfirmPassword(text);
}}
value={confirmPassword}
attributes={{
textContentType: 'password',
secureTextEntry: confirmPasswordTextHidden,
}}
>
Inputs must match
</Text>
<RNEIcon
name={confirmPasswordTextHidden ? 'visibility-off' : 'visibility'}
type="material"
style={styles.icon}
onPress={() =>
setConfirmPasswordTextHidden(!confirmPasswordTextHidden)
}
/>
</UserStringInput>
</View>
)}

{password !== '' && (
<View style={styles.passwordComplexity}>
<Icon type={isMatching ? 'green_check' : 'grey_dot'} />
<Text
style={[
globalStyles.errorMessage,
styles.passwordErrorText,
isMatching
? { color: colors.textGreen }
: { color: colors.textGrey },
]}
>
Inputs must match
</Text>
</View>
)}
</View>
<View style={styles.updatePassword}>
<StyledButton
disabled={!hasLength || !isMatching}
Expand Down
7 changes: 3 additions & 4 deletions src/app/auth/resetPassword/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ export default StyleSheet.create({
paddingVertical: 63,
paddingLeft: 43,
paddingRight: 44,
flex: 1,
justifyContent: 'space-between',
},

newPassword: {
paddingBottom: 8,
},

updatePassword: {
justifyContent: 'flex-end',
marginBottom: 99,
},
updatePassword: {},

passwordComplexity: {
display: 'flex',
Expand Down

0 comments on commit c8583e8

Please sign in to comment.