
--- client/resources/api/auth.js
+++ client/resources/api/auth.js
... | ... | @@ -24,3 +24,24 @@ |
24 | 24 |
export const checkEmailProc = (data) => { |
25 | 25 |
return apiClient.post(`/auth/checkEmail.json`, data); |
26 | 26 |
}; |
27 |
+ |
|
28 |
+// 아이디 찾기 |
|
29 |
+export const findIdProc = (data) => { |
|
30 |
+ return apiClient.post(`/auth/findId.json`, data); |
|
31 |
+} |
|
32 |
+ |
|
33 |
+// 아이디 가져오기 |
|
34 |
+export const findLoginIdProc = (data) => { |
|
35 |
+ return apiClient.post(`/auth/findLoginId.json`, data); |
|
36 |
+} |
|
37 |
+ |
|
38 |
+ |
|
39 |
+// 비밀번호 찾기 |
|
40 |
+export const findPasswordProc = (data) => { |
|
41 |
+ return apiClient.post(`/auth/findPassword.json`, data); |
|
42 |
+} |
|
43 |
+ |
|
44 |
+// 비밀번호 변경 |
|
45 |
+export const updatePasswordProc = (data) => { |
|
46 |
+ return apiClient.post(`/auth/updatePassword.json`, data); |
|
47 |
+} |
--- client/views/pages/common/Find.vue
+++ client/views/pages/common/Find.vue
... | ... | @@ -1,77 +1,88 @@ |
1 | 1 |
<template> |
2 |
- <div class="find-wrap"> |
|
3 |
- <div class="login-logo mb50"> |
|
4 |
- <img src="../../../resources/img/content/login_logo.svg" alt="로고"> |
|
5 |
- </div> |
|
6 |
- <div class="login-box"> |
|
7 |
- <p v-if="type === 'id'" class="find-title mb30">아이디 찾기</p> |
|
8 |
- <p v-else-if="type === 'pw'" class="find-title mb30">비밀번호 찾기</p> |
|
9 |
- <div class="error-message mb30"> |
|
10 |
- <p> |
|
11 |
- <img src="../../../resources/img/component/common/ico_invalid_error_20.svg" alt=""> |
|
12 |
- <span v-if="type === 'id' && step === 1">아이디 찾을 방법을 선택해주세요.</span> |
|
13 |
- <span v-if="type === 'pw' && step === 1">비밀번호 찾을 방법을 선택해주세요.</span> |
|
14 |
- <span v-if="type === 'id' && step === 2">아이디를 찾았습니다.</span> |
|
15 |
- <span v-if="type === 'pw' && step === 2">변경할 비밀번호를 입력해주세요.</span> |
|
16 |
- </p> |
|
2 |
+ <div class="find-wrap"> |
|
3 |
+ <div class="login-logo mb50"> |
|
4 |
+ <img src="../../../resources/img/content/login_logo.svg" alt="로고"> |
|
17 | 5 |
</div> |
18 |
- <div class="find-methods" v-if="step === 1"> |
|
19 |
- <div class="form-check"> |
|
20 |
- <input type="radio" id="find-phone" name="find-method" value="phone" v-model="selectedMethod"/> |
|
21 |
- <label for="find-phone">회원 정보에 등록한 휴대전화로 인증</label> |
|
22 |
- <!-- 휴대폰 인증 영역 --> |
|
23 |
- <div v-if="selectedMethod === 'phone'" class="auth-form phone-auth"> |
|
24 |
- <p class="warning">회원정보에 등록한 휴대전화 번호와 입력된 휴대전화번호가 같아야, 인증번호를 받을 수 있습니다.</p> |
|
25 |
- <input type="text" placeholder="이름" class="form-control sm mb10"/> |
|
26 |
- <div class="input-group mb10"> |
|
27 |
- <input type="tel" placeholder="휴대전화 번호" class="form-control sm "/> |
|
28 |
- <button class="btn sm black" @click="certification">인증번호 받기</button> |
|
6 |
+ <div class="login-box"> |
|
7 |
+ <p v-if="type === 'id'" class="find-title mb30">아이디 찾기</p> |
|
8 |
+ <p v-else-if="type === 'pw'" class="find-title mb30">비밀번호 찾기</p> |
|
9 |
+ <div class="error-message mb30"> |
|
10 |
+ <p> |
|
11 |
+ <img src="../../../resources/img/component/common/ico_invalid_error_20.svg" alt=""> |
|
12 |
+ <span v-if="type === 'id' && step === 1">아이디 찾을 방법을 선택해주세요.</span> |
|
13 |
+ <span v-if="type === 'pw' && step === 1">비밀번호 찾을 방법을 선택해주세요.</span> |
|
14 |
+ <span v-if="type === 'id' && step === 2">아이디를 찾았습니다.</span> |
|
15 |
+ <span v-if="type === 'pw' && step === 2">변경할 비밀번호를 입력해주세요.</span> |
|
16 |
+ </p> |
|
17 |
+ </div> |
|
18 |
+ <div class="find-methods" v-if="step === 1"> |
|
19 |
+ <div class="form-check"> |
|
20 |
+ <input type="radio" id="find-phone" name="find-method" value="phone" v-model="selectedMethod" /> |
|
21 |
+ <label for="find-phone">회원 정보에 등록한 휴대전화로 인증</label> |
|
22 |
+ <!-- 휴대폰 인증 영역 --> |
|
23 |
+ <div v-if="selectedMethod === 'phone'" class="auth-form phone-auth"> |
|
24 |
+ <p class="warning">회원정보에 등록한 휴대전화 번호와 입력된 휴대전화번호가 같아야, 인증번호를 받을 수 있습니다.</p> |
|
25 |
+ <input type="text" placeholder="아이디" class="form-control sm mb10" v-model="form.loginId" |
|
26 |
+ v-if="type === 'pw'" /> |
|
27 |
+ <input type="text" placeholder="이름" class="form-control sm mb10" v-model="form.memberName" /> |
|
28 |
+ <div class="input-group mb10"> |
|
29 |
+ <input type="tel" placeholder="휴대전화 번호" class="form-control sm " |
|
30 |
+ v-model="form.phoneNumber" /> |
|
31 |
+ <button class="btn sm black" @click="findProc">인증번호 받기</button> |
|
32 |
+ </div> |
|
33 |
+ <input type="text" placeholder="인증번호 입력" class="form-control sm" |
|
34 |
+ style="background-color: #ebebeb;" v-model="isValidCode" /> |
|
29 | 35 |
</div> |
30 |
- <input type="text" placeholder="인증번호 입력" class="form-control sm" style="background-color: #ebebeb;"/> |
|
31 | 36 |
</div> |
32 |
- </div> |
|
33 |
- <div class="form-check"> |
|
34 |
- <input type="radio" id="find-email" name="find-method" value="email" v-model="selectedMethod"/> |
|
35 |
- <label for="find-email">본인 확인 이메일로 인증</label> |
|
36 |
- <!-- 이메일 인증 영역 --> |
|
37 |
- <div v-if="selectedMethod === 'email'" class="auth-form email-auth"> |
|
38 |
- <!-- <p class="warning">회원정보에 등록한 휴대전화 번호와 입력된 휴대전화번호가 같아야, 인증번호를 받을 수 있습니다.</p> --> |
|
39 |
- <input type="text" placeholder="이름" class="form-control sm mb10"/> |
|
40 |
- <div class="input-group mb10"> |
|
41 |
- <input type="tel" placeholder="이메일 주소" class="form-control sm "/> |
|
42 |
- <button class="btn sm black">인증번호 받기</button> |
|
37 |
+ <div class="form-check"> |
|
38 |
+ <input type="radio" id="find-email" name="find-method" value="email" v-model="selectedMethod" /> |
|
39 |
+ <label for="find-email">본인 확인 이메일로 인증</label> |
|
40 |
+ <!-- 이메일 인증 영역 --> |
|
41 |
+ <div v-if="selectedMethod === 'email'" class="auth-form email-auth"> |
|
42 |
+ <!-- <p class="warning">회원정보에 등록한 휴대전화 번호와 입력된 휴대전화번호가 같아야, 인증번호를 받을 수 있습니다.</p> --> |
|
43 |
+ <input type="text" placeholder="아이디" class="form-control sm mb10" v-model="form.loginId" |
|
44 |
+ v-if="type === 'pw'" /> |
|
45 |
+ <input type="text" placeholder="이름" class="form-control sm mb10" v-model="form.memberName" /> |
|
46 |
+ <div class="input-group mb10"> |
|
47 |
+ <input type="tel" placeholder="이메일 주소" class="form-control sm " v-model="form.email" /> |
|
48 |
+ <button class="btn sm black" @click="findProc">인증번호 받기</button> |
|
49 |
+ </div> |
|
50 |
+ <input type="text" placeholder="인증번호 입력" class="form-control sm" |
|
51 |
+ style="background-color: #ebebeb;" v-model="isValidCode" /> |
|
43 | 52 |
</div> |
44 |
- <input type="text" placeholder="인증번호 입력" class="form-control sm" style="background-color: #ebebeb;"/> |
|
45 | 53 |
</div> |
46 | 54 |
</div> |
47 |
- </div> |
|
48 |
- <div class="find-methods" v-else-if="step === 2"> |
|
49 |
- <div v-if="type === 'id'"> |
|
50 |
- <div class="input-group"> |
|
51 |
- <label for="id">아이디</label> |
|
52 |
- <input type="text" id="id" class="form-control sm" disabled/> |
|
55 |
+ <div class="find-methods" v-else-if="step === 2"> |
|
56 |
+ <div v-if="type === 'id'"> |
|
57 |
+ <div class="input-group"> |
|
58 |
+ <label for="id">아이디</label> |
|
59 |
+ <input type="text" id="id" class="form-control sm" disabled v-model="loginId" /> |
|
60 |
+ </div> |
|
61 |
+ </div> |
|
62 |
+ <div v-else-if="type === 'pw'"> |
|
63 |
+ <div class="input-group"> |
|
64 |
+ <label for="pw" class="newpw">새 비밀번호</label> |
|
65 |
+ <input type="password" id="pw" placeholder="8-16자의 영문/ 숫자 조합으로 입력해주세요." |
|
66 |
+ class="form-control sm mb10" v-model="password" /> |
|
67 |
+ </div> |
|
68 |
+ <div class="input-group"> |
|
69 |
+ <label for="pwCk" class="newpw">새 비밀번호 확인</label> |
|
70 |
+ <input type="password" id="pwCk" placeholder="다시 입력해주세요." class="form-control sm mb10" |
|
71 |
+ v-model="passwordCheck" /> |
|
72 |
+ </div> |
|
53 | 73 |
</div> |
54 | 74 |
</div> |
55 |
- <div v-else-if="type === 'pw'"> |
|
56 |
- <div class="input-group"> |
|
57 |
- <label for="pw" class="newpw">새 비밀번호</label> |
|
58 |
- <input type="password" id="pw" placeholder="8-16자의 영문/ 숫자 조합으로 입력해주세요." class="form-control sm mb10"/> |
|
59 |
- </div> |
|
60 |
- <div class="input-group"> |
|
61 |
- <label for="pwCk" class="newpw">새 비밀번호 확인</label> |
|
62 |
- <input type="password" id="pwCk" placeholder="다시 입력해주세요." class="form-control sm mb10"/> |
|
63 |
- </div> |
|
75 |
+ <div class="btn-zone"> |
|
76 |
+ <button class="btn lg netx-btn" @click="checkCode" v-if="isChecking">다음</button> |
|
77 |
+ <button class="btn lg netx-btn" @click="checkResult" v-if="!isChecking">확인</button> |
|
64 | 78 |
</div> |
65 |
- </div> |
|
66 |
- <div class="btn-zone"> |
|
67 |
- <button class="btn lg netx-btn" @click="stepGo(2)">다음</button> |
|
68 |
- </div> |
|
69 | 79 |
|
80 |
+ </div> |
|
70 | 81 |
</div> |
71 |
- </div> |
|
72 | 82 |
</template> |
73 | 83 |
|
74 | 84 |
<script> |
85 |
+import { findIdProc, findLoginIdProc, findPasswordProc, updatePasswordProc } from '../../../resources/api/auth'; |
|
75 | 86 |
|
76 | 87 |
export default { |
77 | 88 |
props: ['type'], |
... | ... | @@ -80,35 +91,223 @@ |
80 | 91 |
return { |
81 | 92 |
step: 1, // 단계 관리 (1: 방법 선택, 2: 인증 입력 등) |
82 | 93 |
selectedMethod: '', // 선택된 인증 방법 |
94 |
+ form: { |
|
95 |
+ memberName: '', // 이름 |
|
96 |
+ email: '', // 이메일 |
|
97 |
+ phoneNumber: '', // 폰 번호 |
|
98 |
+ loginId: '', // 비번 찾기용 |
|
99 |
+ type: '', // 'email' 또는 'phone' |
|
100 |
+ }, |
|
101 |
+ isValid: false, |
|
102 |
+ isValidCode: '', |
|
103 |
+ loginId: '', |
|
104 |
+ password: null, |
|
105 |
+ passwordCheck: null, |
|
106 |
+ isChecking: true, |
|
83 | 107 |
}; |
84 | 108 |
}, |
85 | 109 |
methods: { |
86 | 110 |
stepGo() { |
87 | 111 |
if (this.step === 1 && !this.selectedMethod) { |
88 |
- this.$alert({ message: '인증 방법을 선택해주세요.',icon:require('../../../resources/img/component/common/ico_invalid_error_20.svg') }); |
|
112 |
+ this.$alert({ message: '인증 방법을 선택해주세요.', icon: require('../../../resources/img/component/common/ico_invalid_error_20.svg') }); |
|
89 | 113 |
return; |
90 |
- }else{ |
|
114 |
+ } else { |
|
91 | 115 |
this.step = 2; // 다음 단계로 이동 |
92 |
- } |
|
116 |
+ if (this.type === 'id') { |
|
117 |
+ this.findLoginIdProc(); |
|
118 |
+ } |
|
119 |
+ } |
|
93 | 120 |
}, |
94 |
- certification() { |
|
95 |
- // 인증번호 받기 로직 구현 |
|
96 |
- this.$alert( |
|
97 |
- { message: '인증번호가 발송되었습니다.', |
|
98 |
- icon:require('../../../resources/img/content/ico_certification.svg') , |
|
99 |
- subMessage: '인증번호가 오지 않으면 입력하신 정보가 회원정보와 일치하는지 확인해주세요.' |
|
100 |
- } |
|
101 |
- ); |
|
102 |
- } |
|
121 |
+ |
|
122 |
+ // 아이디, 비밀번호 찾기 구분 |
|
123 |
+ findProc() { |
|
124 |
+ if(this.type === 'id') { |
|
125 |
+ this.findIdProc(); |
|
126 |
+ } else if (this.type === 'pw') { |
|
127 |
+ this.findPasswordProc(); |
|
128 |
+ } |
|
129 |
+ }, |
|
130 |
+ |
|
131 |
+ // 아이디 찾기 |
|
132 |
+ async findIdProc() { |
|
133 |
+ const vm = this; |
|
134 |
+ vm.isValid = false; |
|
135 |
+ |
|
136 |
+ // 이메일을 선택했을 때 |
|
137 |
+ if (vm.selectedMethod === 'email') { |
|
138 |
+ if (!vm.form.memberName || !vm.form.email) { |
|
139 |
+ vm.$alert({ message: '이름과 이메일을 입력해주세요.' }); |
|
140 |
+ return; |
|
141 |
+ } |
|
142 |
+ |
|
143 |
+ vm.form.type = 'email'; |
|
144 |
+ } else if (vm.selectedMethod === 'phone') { |
|
145 |
+ if (!vm.form.memberName || !vm.form.phoneNumber) { |
|
146 |
+ vm.$alert({ message: '이름과 전화번호를 입력해주세요.' }); |
|
147 |
+ return; |
|
148 |
+ } |
|
149 |
+ |
|
150 |
+ vm.form.type = 'phone'; |
|
151 |
+ } |
|
152 |
+ try { |
|
153 |
+ const res = await findIdProc(vm.form); |
|
154 |
+ if (res.data.result === 1) { |
|
155 |
+ vm.$alert( |
|
156 |
+ { |
|
157 |
+ message: '인증번호가 발송되었습니다.', |
|
158 |
+ icon: require('../../../resources/img/content/ico_certification.svg'), |
|
159 |
+ subMessage: '인증번호가 오지 않으면 입력하신 정보가 회원정보와 일치하는지 확인해주세요.' |
|
160 |
+ } |
|
161 |
+ ); |
|
162 |
+ vm.isValid = true; |
|
163 |
+ } else { |
|
164 |
+ vm.$alert( |
|
165 |
+ { |
|
166 |
+ message: '해당 이름과 회원 정보가 없습니다.', |
|
167 |
+ icon: require('../../../resources/img/content/ico_certification.svg'), |
|
168 |
+ subMessage: '입력하신 정보가 회원정보와 일치하는지 다시 확인해주세요.' |
|
169 |
+ } |
|
170 |
+ ); |
|
171 |
+ } |
|
172 |
+ } catch (e) { |
|
173 |
+ vm.$alert({ message: '오류가 발생했습니다.' }); |
|
174 |
+ } |
|
175 |
+ |
|
176 |
+ }, |
|
177 |
+ // 아이디 가져오기 |
|
178 |
+ async findLoginIdProc() { |
|
179 |
+ const vm = this; |
|
180 |
+ try { |
|
181 |
+ const res = await findLoginIdProc(vm.form); |
|
182 |
+ if (res.data.result) { |
|
183 |
+ vm.loginId = res.data.result; |
|
184 |
+ } |
|
185 |
+ } catch (e) { |
|
186 |
+ vm.$alert({ message: '오류가 발생했습니다.' }); |
|
187 |
+ } |
|
188 |
+ |
|
189 |
+ }, |
|
190 |
+ |
|
191 |
+ // 비밀번호 찾기 |
|
192 |
+ async findPasswordProc() { |
|
193 |
+ const vm = this; |
|
194 |
+ vm.isValid = false; |
|
195 |
+ |
|
196 |
+ // 이메일을 선택했을 때 |
|
197 |
+ if (vm.selectedMethod === 'email') { |
|
198 |
+ if (!vm.form.loginId || !vm.form.memberName || !vm.form.email) { |
|
199 |
+ vm.$alert({ message: '아이디와 이름과 이메일을 입력해주세요.' }); |
|
200 |
+ return; |
|
201 |
+ } |
|
202 |
+ |
|
203 |
+ vm.form.type = 'email'; |
|
204 |
+ } else if (vm.selectedMethod === 'phone') { |
|
205 |
+ if (!vm.form.loginId || !vm.form.memberName || !vm.form.phoneNumber) { |
|
206 |
+ vm.$alert({ message: '아이디와 이름과 전화번호를 입력해주세요.' }); |
|
207 |
+ return; |
|
208 |
+ } |
|
209 |
+ |
|
210 |
+ vm.form.type = 'phone'; |
|
211 |
+ } |
|
212 |
+ try { |
|
213 |
+ const res = await findPasswordProc(vm.form); |
|
214 |
+ if (res.data.result === 1) { |
|
215 |
+ vm.$alert( |
|
216 |
+ { |
|
217 |
+ message: '인증번호가 발송되었습니다.', |
|
218 |
+ icon: require('../../../resources/img/content/ico_certification.svg'), |
|
219 |
+ subMessage: '인증번호가 오지 않으면 입력하신 정보가 회원정보와 일치하는지 확인해주세요.' |
|
220 |
+ } |
|
221 |
+ ); |
|
222 |
+ vm.isValid = true; |
|
223 |
+ } else { |
|
224 |
+ vm.$alert( |
|
225 |
+ { |
|
226 |
+ message: '해당 이름과 회원 정보가 없습니다.', |
|
227 |
+ icon: require('../../../resources/img/content/ico_certification.svg'), |
|
228 |
+ subMessage: '입력하신 정보가 회원정보와 일치하는지 다시 확인해주세요.' |
|
229 |
+ } |
|
230 |
+ ); |
|
231 |
+ } |
|
232 |
+ } catch (e) { |
|
233 |
+ vm.$alert({ message: '오류가 발생했습니다.' }); |
|
234 |
+ } |
|
235 |
+ |
|
236 |
+ }, |
|
237 |
+ |
|
238 |
+ // 비밀번호 변경 |
|
239 |
+ async updatePasswordProc() { |
|
240 |
+ const vm = this; |
|
241 |
+ |
|
242 |
+ // 비밀번호 검증 |
|
243 |
+ const pwRegex = /^[a-zA-Z0-9]{8,16}$/; |
|
244 |
+ if (!vm.password || !pwRegex.test(vm.password)) { |
|
245 |
+ vm.$alert({ message: '비밀번호는 영문+숫자 조합의 8~16자여야 합니다.' }); |
|
246 |
+ return; |
|
247 |
+ } |
|
248 |
+ |
|
249 |
+ // 비밀번호 확인 |
|
250 |
+ if (vm.password !== vm.passwordCheck) { |
|
251 |
+ vm.$alert({ message: '비밀번호를 다시 입력해주세요.' }); |
|
252 |
+ return; |
|
253 |
+ } |
|
254 |
+ |
|
255 |
+ const passwordData = { |
|
256 |
+ loginId: vm.form.loginId, |
|
257 |
+ password: vm.password, |
|
258 |
+ } |
|
259 |
+ |
|
260 |
+ try { |
|
261 |
+ const res = await updatePasswordProc(passwordData); |
|
262 |
+ if (res.data.result === 1) { |
|
263 |
+ vm.$alert( |
|
264 |
+ { |
|
265 |
+ message: '비밀번호가 변경되었습니다.', |
|
266 |
+ } |
|
267 |
+ ); |
|
268 |
+ vm.$router.push({ path: "/login.page" }); |
|
269 |
+ } |
|
270 |
+ } catch (e) { |
|
271 |
+ vm.$alert({ message: '오류가 발생했습니다.' }); |
|
272 |
+ } |
|
273 |
+ |
|
274 |
+ }, |
|
275 |
+ |
|
276 |
+ |
|
277 |
+ // 인증번호 확인 - 폰 문자 메세지는 비용이 드는 것이기에 임의의 인증번호 6자리만 입력하면 되도록 |
|
278 |
+ async checkCode() { |
|
279 |
+ const vm = this; |
|
280 |
+ |
|
281 |
+ if (vm.isValid) { |
|
282 |
+ if (!vm.isValidCode || vm.isValidCode.length != 6) { |
|
283 |
+ vm.$alert({ message: '인증번호를 입력해주세요.' }); |
|
284 |
+ return; |
|
285 |
+ } |
|
286 |
+ vm.isChecking = false; |
|
287 |
+ vm.stepGo(2); |
|
288 |
+ } else { |
|
289 |
+ vm.$alert({ message: '인증번호 받기를 진행해주세요.' }); |
|
290 |
+ } |
|
291 |
+ }, |
|
292 |
+ |
|
293 |
+ // 아이디 비밀번호 인증 후의 로직 |
|
294 |
+ checkResult() { |
|
295 |
+ if (this.type === 'id') { |
|
296 |
+ this.$router.push({ path: "/login.page" }); |
|
297 |
+ |
|
298 |
+ } else if (this.type === 'pw') { |
|
299 |
+ this.updatePasswordProc(); |
|
300 |
+ } |
|
301 |
+ }, |
|
103 | 302 |
|
104 | 303 |
}, |
105 | 304 |
watch: {}, |
106 | 305 |
computed: {}, |
107 | 306 |
components: {}, |
108 |
- created() {}, |
|
307 |
+ created() { }, |
|
109 | 308 |
mounted() { |
110 | 309 |
}, |
111 |
- beforeUnmount() {}, |
|
310 |
+ beforeUnmount() { }, |
|
112 | 311 |
}; |
113 | 312 |
|
114 | 313 |
</script>(파일 끝에 줄바꿈 문자 없음) |
--- client/views/pages/common/Join.vue
+++ client/views/pages/common/Join.vue
... | ... | @@ -139,9 +139,9 @@ |
139 | 139 |
} |
140 | 140 |
|
141 | 141 |
// 비밀번호 검증 |
142 |
- const pwRegex = /^[a-zA-Z0-9]{3,16}$/; |
|
142 |
+ const pwRegex = /^[a-zA-Z0-9]{8,16}$/; |
|
143 | 143 |
if (!vm.password || !pwRegex.test(vm.password)) { |
144 |
- vm.$alert({ message: '비밀번호는 영문+숫자 조합의 3~16자여야 합니다.' }); |
|
144 |
+ vm.$alert({ message: '비밀번호는 영문+숫자 조합의 8~16자여야 합니다.' }); |
|
145 | 145 |
return; |
146 | 146 |
} |
147 | 147 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?