Skip to content

Commit

Permalink
[Fix] 비밀번호 찾기 오류 해결 (#63)
Browse files Browse the repository at this point in the history
- SignUpUser -> User로 변경
  • Loading branch information
ReeseSR committed May 10, 2022
1 parent 44aace0 commit cc6f23a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FindPasswordViewController: UIViewController {

// MARK: - Properties

let user = SignUpUser.shared
let user = User.shared
var isResetCodeEnabled: Bool = false
private var userResetCode: Int = 0
private var isEmailRight: Bool = false
Expand Down Expand Up @@ -99,6 +99,11 @@ class FindPasswordViewController: UIViewController {
nextButton.alpha = 0.3
}

// 화면 터치시 키보드 내림
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
self.view.endEditing(true)
}

private func pushToNewPasswordViewController(email: String) {
let resetCodeViewController = ResetCodeViewController.loadFromNib()
resetCodeViewController.email = email
Expand All @@ -114,22 +119,25 @@ class FindPasswordViewController: UIViewController {

extension FindPasswordViewController: UITextFieldDelegate {
func textFieldDidBeginEditing(_ textField: UITextField) {
emailWarningLabel.isHidden = true
emailTextFieldView.makeRoundedWithBorder(radius: 12, color: UIColor.systemGray2.cgColor)
}

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
guard let text = textField.text else {
return false
}
checkEmailFormat(email: text)
return true
}
// func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
// guard let text = textField.text else {
// return false
// }
// return true
// }

func textFieldDidEndEditing(_ textField: UITextField) {
guard let text = textField.text else {
return
}
checkEmailFormat(email: text)
if text != "" {
checkEmailFormat(email: text)
}

emailTextFieldView.makeRoundedWithBorder(radius: 12, color: UIColor.systemGray6.cgColor)
}

Expand All @@ -149,15 +157,14 @@ extension FindPasswordViewController {
self.user.email = email
print("data.message: \(data)")
self.emailWarningLabel.text = "\(data)"
self.showToast(message: data)
self.pushToNewPasswordViewController(email: email)
}
case .requestErr(let message):
self.emailWarningLabel.isHidden = false
if let message = message as? String {
self.emailWarningLabel.text = "\(message)"
self.pushToNewPasswordViewController(email: email)
}
self.pushToNewPasswordViewController(email: email)
case .pathErr:
print(".pathErr")
case .serverErr:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="[email protected]" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="bno-VT-IQc">
<rect key="frame" x="15" y="15" width="344" height="24"/>
<fontDescription key="fontDescription" name="AppleSDGothicNeo-Regular" family="Apple SD Gothic Neo" pointSize="16"/>
<fontDescription key="fontDescription" name="AppleSDGothicNeo-Regular" family="Apple SD Gothic Neo" pointSize="14"/>
<textInputTraits key="textInputTraits" textContentType="email"/>
</textField>
</subviews>
Expand Down

0 comments on commit cc6f23a

Please sign in to comment.