Browse Source

【轻会员】新增注册登录密码验证逻辑 添加

lizhe 1 year ago
parent
commit
5575755e3d

+ 6 - 5
PDF Office/PDF Master/Class/KMLightMember/Controller/AccountInfo/KMAccountInfoWindowController.swift

@@ -94,15 +94,16 @@ class KMAccountInfoWindowController: NSWindowController {
         
         self.accountInfoView.logOutAction = { view in
             print("登出")
-            KMLightMemberManager.manager.logOut()
-            accountInfoMainWindow?.endSheet(view.window!)
-            view.window?.close()
             KMRequestServerManager.manager.logout { success, result in
                 if success {
-                    accountInfoController = nil
-                    accountInfoMainWindow = nil
+                    print("登出成功")
                 }
             }
+            KMLightMemberManager.manager.logOut()
+            accountInfoMainWindow?.endSheet(view.window!)
+            view.window?.close()
+            accountInfoController = nil
+            accountInfoMainWindow = nil
         }
         
         self.accountInfoView.cancellationAction = { [unowned self] view in

+ 8 - 4
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/Presenter/KMRegisterPresenter.swift

@@ -60,8 +60,8 @@ extension KMRegisterPresenter: KMRegisterPresenterProtocol {
     
     func refreshNextState() {
         let isEmailSuccess = KMRegisterPresenter.verificationEmail(self.model.email)
-        let isPasswordSuccess = self.model.password.count >= 6 && self.model.password.count <= 24
-        let isRePasswordSuccess = self.model.rePassword.count >= 6 && self.model.rePassword.count <= 24
+        let isPasswordSuccess = self.model.password.count >= 6 && self.model.password.count <= 24 && !self.model.password.contains(" ")
+        let isRePasswordSuccess = self.model.rePassword.count >= 6 && self.model.rePassword.count <= 24 && !self.model.rePassword.contains(" ")
         
         if isEmailSuccess || self.model.email.count == 0 {
             self.model.emailAlertType = .unknown
@@ -76,7 +76,9 @@ extension KMRegisterPresenter: KMRegisterPresenterProtocol {
             self.model.passwordAlertType = .EXCEPTION_MSG_PASSWORD_SIZE_MIN
         } else if self.model.password.count > 24 {
             self.model.passwordAlertType = .EXCEPTION_MSG_PASSWORD_SIZE_MAX
-        } else  {
+        } else if self.model.password.contains(" ") {
+            self.model.passwordAlertType = .EXCEPTION_MSG_PASSWORD_CONTAIN_EMRTY
+        } else {
             self.model.passwordAlertType = .unknown
         }
         
@@ -84,8 +86,10 @@ extension KMRegisterPresenter: KMRegisterPresenterProtocol {
             self.model.rePasswordAlertType = .unknown
         } else if self.model.rePassword.count < 6 && self.model.rePassword.count != 0 {
             self.model.rePasswordAlertType = .EXCEPTION_MSG_PASSWORD_SIZE_MIN
-        } else if self.model.password.count > 24 {
+        } else if self.model.rePassword.count > 24 {
             self.model.rePasswordAlertType = .EXCEPTION_MSG_PASSWORD_SIZE_MAX
+        } else if self.model.rePassword.contains(" ") {
+            self.model.rePasswordAlertType = .EXCEPTION_MSG_PASSWORD_CONTAIN_EMRTY
         } else {
             self.model.rePasswordAlertType = .unknown
         }

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMLightNoNetworkView.xib

@@ -5,7 +5,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMLightNoNetworkView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMLightNoNetworkView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="subtitleLabel" destination="uX9-qS-yeu" id="VD3-VH-B2K"/>
                 <outlet property="titleLabel" destination="fMD-gC-2Kk" id="AVZ-R6-AOM"/>

+ 4 - 4
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMLoginInputPasswordView.xib

@@ -5,7 +5,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMLoginInputPasswordView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMLoginInputPasswordView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="alertView" destination="ff5-IQ-deE" id="WgJ-Fd-6aV"/>
                 <outlet property="describeLable" destination="v1H-K3-lim" id="ikz-9Z-zWf"/>
@@ -54,7 +54,7 @@
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="fBp-l6-nG8">
                                     <rect key="frame" x="0.0" y="4" width="262" height="32"/>
                                     <subviews>
-                                        <textField verticalHuggingPriority="750" contentType="password" translatesAutoresizingMaskIntoConstraints="NO" id="6Vy-iH-Gtq" customClass="FocusAwareTextField" customModule="PDF_Office" customModuleProvider="target">
+                                        <textField verticalHuggingPriority="750" contentType="password" translatesAutoresizingMaskIntoConstraints="NO" id="6Vy-iH-Gtq" customClass="FocusAwareTextField" customModule="PDF_Master" customModuleProvider="target">
                                             <rect key="frame" x="8" y="5" width="222" height="22"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="22" id="opq-pU-Cxs"/>
@@ -68,7 +68,7 @@
                                                 </allowedInputSourceLocales>
                                             </textFieldCell>
                                         </textField>
-                                        <secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jtV-xD-84b" customClass="FocusAwareSecureTextField" customModule="PDF_Office" customModuleProvider="target">
+                                        <secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jtV-xD-84b" customClass="FocusAwareSecureTextField" customModule="PDF_Master" customModuleProvider="target">
                                             <rect key="frame" x="8" y="6" width="222" height="20"/>
                                             <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="border" usesSingleLineMode="YES" id="UlY-us-n8s">
                                                 <font key="font" metaFont="system"/>
@@ -204,7 +204,7 @@ DQ
                         <constraint firstItem="cWe-4o-FbE" firstAttribute="top" secondItem="Fiq-Tb-FhO" secondAttribute="bottom" constant="8" id="eM0-r7-erm"/>
                     </constraints>
                 </customView>
-                <customView translatesAutoresizingMaskIntoConstraints="NO" id="ff5-IQ-deE" customClass="KMLightMemberAlertView" customModule="PDF_Office" customModuleProvider="target">
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="ff5-IQ-deE" customClass="KMLightMemberAlertView" customModule="PDF_Master" customModuleProvider="target">
                     <rect key="frame" x="0.0" y="0.0" width="326" height="48"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="48" id="jHg-Mk-TWh"/>

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMRegisterView.swift

@@ -244,7 +244,7 @@ extension KMRegisterView: NSTextFieldDelegate {
         if (textField == self.passwordSecureTextField ||
             textField == self.passwordTextField) {
             self.presenter.changePassword(string: textField!.stringValue)
-            self.passwordAlertLabel.stringValue = ""
+//            self.passwordAlertLabel.stringValue = ""
         }
     }
 }

+ 5 - 5
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMResetPasswordView.xib

@@ -5,7 +5,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMResetPasswordView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMResetPasswordView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="doneButton" destination="V94-fh-pV8" id="cRN-LT-Hzr"/>
                 <outlet property="passwordAlertLabel" destination="S3I-lh-2pB" id="qRx-yK-3dm"/>
@@ -52,7 +52,7 @@
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="QVr-yK-c7l">
                                     <rect key="frame" x="0.0" y="22" width="262" height="32"/>
                                     <subviews>
-                                        <textField verticalHuggingPriority="750" contentType="password" translatesAutoresizingMaskIntoConstraints="NO" id="9aV-vU-Yrm" customClass="FocusAwareTextField" customModule="PDF_Office" customModuleProvider="target">
+                                        <textField verticalHuggingPriority="750" contentType="password" translatesAutoresizingMaskIntoConstraints="NO" id="9aV-vU-Yrm" customClass="FocusAwareTextField" customModule="PDF_Master" customModuleProvider="target">
                                             <rect key="frame" x="8" y="5" width="222" height="22"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="22" id="jn6-yk-MJN"/>
@@ -66,7 +66,7 @@
                                                 </allowedInputSourceLocales>
                                             </textFieldCell>
                                         </textField>
-                                        <secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HjQ-Ir-c1K" customClass="FocusAwareSecureTextField" customModule="PDF_Office" customModuleProvider="target">
+                                        <secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HjQ-Ir-c1K" customClass="FocusAwareSecureTextField" customModule="PDF_Master" customModuleProvider="target">
                                             <rect key="frame" x="8" y="6" width="222" height="20"/>
                                             <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="border" usesSingleLineMode="YES" id="KXj-xa-VvR">
                                                 <font key="font" metaFont="system"/>
@@ -128,7 +128,7 @@
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="CYd-rp-4G4">
                                     <rect key="frame" x="0.0" y="22" width="262" height="32"/>
                                     <subviews>
-                                        <textField verticalHuggingPriority="750" contentType="password" translatesAutoresizingMaskIntoConstraints="NO" id="hqd-kg-bPA" customClass="FocusAwareTextField" customModule="PDF_Office" customModuleProvider="target">
+                                        <textField verticalHuggingPriority="750" contentType="password" translatesAutoresizingMaskIntoConstraints="NO" id="hqd-kg-bPA" customClass="FocusAwareTextField" customModule="PDF_Master" customModuleProvider="target">
                                             <rect key="frame" x="8" y="5" width="222" height="22"/>
                                             <constraints>
                                                 <constraint firstAttribute="height" constant="22" id="spi-7i-Sgi"/>
@@ -142,7 +142,7 @@
                                                 </allowedInputSourceLocales>
                                             </textFieldCell>
                                         </textField>
-                                        <secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TvB-NY-BFX" customClass="FocusAwareSecureTextField" customModule="PDF_Office" customModuleProvider="target">
+                                        <secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TvB-NY-BFX" customClass="FocusAwareSecureTextField" customModule="PDF_Master" customModuleProvider="target">
                                             <rect key="frame" x="8" y="6" width="222" height="20"/>
                                             <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="border" usesSingleLineMode="YES" id="q1a-hJ-YJy">
                                                 <font key="font" metaFont="system"/>

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/Controller/VerificationCode/View/KMLightMemberAlertView.swift

@@ -60,7 +60,7 @@ class KMLightMemberAlertView: KMBaseXibView {
 
         // 创建一个新的计时器,延迟 2 秒
         timer = DispatchSource.makeTimerSource()
-        timer?.schedule(deadline: .now() + 2, leeway: .milliseconds(10))
+        timer?.schedule(deadline: .now() + 3, leeway: .milliseconds(10))
         timer?.setEventHandler(handler: { [unowned self] in
             // 2 秒后执行的代码
             methodToExecuteAfterDelay()

+ 1 - 1
PDF Office/PDF Master/Class/KMLightMember/Manager/KMRequestServerManager.swift

@@ -60,7 +60,7 @@ enum KMRequestServerErrorCodeType: Int, CaseIterable {
         case .EMAIL_REGISTER_ERROR:
             result = "Register error"
         case .EXCEPTION_MSG_PASSWORD_ERROR:
-            result = "The password is incorrect, please re-enter it."
+            result = "Wrong password. You can check whether the letter is uppercase or lowercase."
         case .EXCEPTION_MSG_CODE_ACTION_ERROR:
             result = "Incorrect code"
         case .EXCEPTION_MSG_CODE_SEND_ERROR: