Skip to content

Commit

Permalink
Add/password style alert
Browse files Browse the repository at this point in the history
  • Loading branch information
sjsjmine129 committed May 25, 2024
1 parent 955114f commit d4da5ac
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/components/MapDart.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export default function MapDart(props) {
}}>
<View>
<View style={styles.dart}>
<Text style={styles.dartText}>{data.name}</Text>
<Text style={styles.dartText} numberOfLines={1}>
{data.name}
</Text>

<View
style={{
Expand Down Expand Up @@ -66,17 +68,18 @@ const styles = StyleSheet.create({
borderRightWidth: 8,
borderTopWidth: 8,
borderRightColor: 'transparent',
borderTopColor: 'white',
borderTopColor: COLOR_PRIMARY,
},
dart: {
padding: 3,
alignItems: 'center',
backgroundColor: COLOR_WHITE,
backgroundColor: COLOR_PRIMARY,
borderRadius: 8,
borderBottomLeftRadius: 0,
},
dartText: {
fontSize: 12,
color: COLOR_TEXT_BLACK,
color: COLOR_WHITE,
maxWidth: 100,
},
});
12 changes: 11 additions & 1 deletion src/screens/signup/ResetPasswordScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ export default function ResetPasswordScreen(props) {
passwordCheckInputRef.current.focus();
};

function containsAll(text) {
const hasAlphabet = /[a-zA-Z]/.test(text);
const hasNumber = /\d/.test(text);
const hasSpecial = /[!@#$%^&*(),.?":{}|<>]/.test(text);

return hasAlphabet && hasNumber && hasSpecial;
}

const resetPassword = async () => {
console.log('email:', signUpData.email);
console.log('token:', signUpData.token);
Expand Down Expand Up @@ -161,7 +169,9 @@ export default function ResetPasswordScreen(props) {
<LongPrimaryButton
text={
password === passwordCheck
? '비밀번호 재설정'
? containsAll(password)
? '회원가입'
: '영어, 숫자, 특수문자가 포함되어야 합니다.'
: '비밀번호가 일치하지 않습니다'
}
action={resetPassword}
Expand Down
12 changes: 11 additions & 1 deletion src/screens/signup/SignupScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ export default function SignupScreen() {
}
};

function containsAll(text) {
const hasAlphabet = /[a-zA-Z]/.test(text);
const hasNumber = /\d/.test(text);
const hasSpecial = /[!@#$%^&*(),.?":{}|<>]/.test(text);

return hasAlphabet && hasNumber && hasSpecial;
}

return (
<>
<HeaderWhite title={'회원가입'} isBackButton={true} />
Expand Down Expand Up @@ -220,7 +228,9 @@ export default function SignupScreen() {
<LongPrimaryButton
text={
password === passwordCheck
? '회원가입'
? containsAll(password)
? '회원가입'
: '영어, 숫자, 특수문자가 포함되어야 합니다.'
: '비밀번호가 일치하지 않습니다'
}
action={emailSend}
Expand Down

0 comments on commit d4da5ac

Please sign in to comment.