Skip to content

Commit

Permalink
[#73] 이메일 인증 API 연동 완료
Browse files Browse the repository at this point in the history
  • Loading branch information
00yhsp committed Feb 7, 2024
1 parent 3956519 commit 9c64f09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Spon-us/Model/Onboarding/EmailViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class EmailViewModel: ObservableObject {
case let .success(response):
do {
let emailResponse = try response.map(EmailModel.self)
self.email = emailResponse
self.email = emailResponse
} catch {
print("Error parsing response: \(error)")
}
Expand Down
9 changes: 5 additions & 4 deletions Spon-us/View/Onboarding/RegisterIDView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct RegisterIDView: View {

@State private var userID = ""
@State private var authCode = ""
@State private var correctAuthCode = ""
@State private var sentAuthCode = false
@State private var authCodeExpired = false
@State private var authCodeSubmitted = false
Expand All @@ -33,7 +34,7 @@ struct RegisterIDView: View {

let emailRegexPattern = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,6}$/

let dummyAuthCode = "123456"
let dummyAuthCode = ""

private func startTimer() {
if !isTimerRunning {
Expand Down Expand Up @@ -121,7 +122,7 @@ struct RegisterIDView: View {
sentAuthCode = false
stopTimer()
isAuthCodeTextFieldFocused = false
if (authCode == dummyAuthCode && authCodeSubmitted) {
if ((authCode == emailViewModel.email?.content) && authCodeSubmitted) {
isAuthenticated = true
showingCompletedPopup = true
}
Expand All @@ -134,7 +135,7 @@ struct RegisterIDView: View {

}
}
}.border(isAuthCodeTextFieldFocused ? .sponusPrimary : ((authCode != dummyAuthCode && authCodeSubmitted) ? .sponusRed : .sponusGrey100))
}.border(isAuthCodeTextFieldFocused ? .sponusPrimary : (((authCode != emailViewModel.email?.content) && authCodeSubmitted) ? .sponusRed : .sponusGrey100))
.padding(.top, 16)
if isTimerRunning {
if timeRemaining == 0 {
Expand All @@ -158,7 +159,7 @@ struct RegisterIDView: View {
}.padding(.top, 12)
}
}
else if (authCodeSubmitted && (authCode != dummyAuthCode)) {
else if (authCodeSubmitted && (authCode != emailViewModel.email?.content)) {
HStack(spacing: 0) {
Image(.icWarning).resizable().frame(width: 16, height: 16).padding(.trailing, 4)
Text("인증번호를 다시 입력해주세요").font(.system(size: 12)).foregroundStyle(.sponusRed)
Expand Down

0 comments on commit 9c64f09

Please sign in to comment.