Forráskód Böngészése

【会员系统】新增重置密码(输入新密码)UI & UX

wanjun 4 hónapja
szülő
commit
99f4135204

+ 1 - 0
PDF Office/PDF Master/MemberCenter/Assets/en.lproj/MemberCenterLocalizable.strings

@@ -49,3 +49,4 @@
 "Reset Passwords" = "Reset Passwords";
 "Next" = "Next";
 "Back" = "Back";
+"Finsh" = "Finsh";

+ 1 - 1
PDF Office/PDF Master/MemberCenter/Model/KMMemberCenterManager.swift

@@ -95,7 +95,7 @@ class KMMemberCenterManager: NSObject {
      @param email 邮箱
      @param complete 回调
      */
-    func resetPassword(email: String, complete: @escaping KMMemberCenterComplete) {
+    func emailVerification(email: String, complete: @escaping KMMemberCenterComplete) {
         let urlString = configuration.activityBaseURL() + "/member-system-sso/auth/validEmail"
         let params: [String: Any] = ["email": email]
         KMRequestServer.requestServer.request(urlString: urlString, method: .post, params: params) { requestSerializer in

+ 189 - 0
PDF Office/PDF Master/MemberCenter/View/KMEnterNewPasswordView.swift

@@ -0,0 +1,189 @@
+//
+//  KMEnterNewPasswordView.swift
+//  PDF Reader Pro
+//
+//  Created by wanjun on 2024/10/29.
+//
+
+import Cocoa
+import Combine
+
+class KMEnterNewPasswordView: KMBaseXibView {
+
+    @IBOutlet weak var resetPasswordsLabel: NSTextField!
+    @IBOutlet weak var passwordBox: NSBox!
+    @IBOutlet weak var passwordView: NSView!
+    @IBOutlet weak var passwordTextField: NSTextField!
+    @IBOutlet weak var passwordTextField1: NSSecureTextField!
+    @IBOutlet weak var visibleButton: NSButton!
+    @IBOutlet weak var passwordErrorLabel: NSTextField!
+    @IBOutlet weak var finshBox: NSBox!
+    @IBOutlet weak var finshButton: NSButton!
+        
+    private var viewModel = KMSignUpViewModel()
+    private var cancellables = Set<AnyCancellable>()
+    
+    convenience init(model: KMSignUpViewModel, superView: NSView) {
+        self.init(frame: superView.bounds)
+        viewModel = model
+        
+        bindViewModel()
+        languageLocalized()
+        initializeUI()
+    }
+    
+    public override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+    }
+    
+    public required init?(coder decoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    override func updateUI() {
+        super.updateUI()
+        
+        bindViewModel()
+        languageLocalized()
+        initializeUI()
+    }
+    
+    // MARK: Private Method
+    
+    private func languageLocalized() -> Void {
+        resetPasswordsLabel.stringValue = NSLocalizedString("Reset Passwords", tableName: "MemberCenterLocalizable", comment: "")
+        finshButton.title = NSLocalizedString("Finsh", tableName: "MemberCenterLocalizable", comment: "")
+        passwordErrorLabel.stringValue = String(format: "*%@", NSLocalizedString("Please enter right Verification code", tableName: "MemberCenterLocalizable", comment: ""))
+        passwordTextField.placeholderString = NSLocalizedString("Password", tableName: "MemberCenterLocalizable", comment: "")
+        passwordTextField1.placeholderString = NSLocalizedString("Password", tableName: "MemberCenterLocalizable", comment: "")
+    }
+    
+    private func initializeUI() -> Void {
+        passwordTextField.delegate = self
+        passwordTextField1.delegate = self
+        
+        passwordTextField.stringValue = viewModel.password
+        passwordTextField1.stringValue = viewModel.password
+        passwordErrorLabel.isHidden = !viewModel.passwordError()
+
+        resetPasswordsLabel.textColor = NSColor(named: "000000")
+        resetPasswordsLabel.font = NSFont.SFMediumFontWithSize(20)
+        passwordBox.borderColor = NSColor(named: "DADBDE") ?? NSColor.gray
+        passwordErrorLabel.textColor = NSColor(named: "FA1E5D")
+        passwordErrorLabel.font = NSFont.SFProTextRegularFont(9)
+        finshBox.fillColor = NSColor(named: "273C62") ?? NSColor.blue
+        finshButton.setTitleColor(color: NSColor(named: "FFFFFF") ?? NSColor.white, font: NSFont.SFProTextRegularFont(16))
+    }
+
+    private func visibleStateChange() -> Void {
+        if viewModel.isVisible {
+            visibleButton.image = NSImage(named: "passwordUnVisible")
+            passwordTextField.isHidden = false
+            passwordTextField1.isHidden = true
+            passwordTextField.stringValue = viewModel.password
+        } else {
+            visibleButton.image = NSImage(named: "passwordVisible")
+            passwordTextField.isHidden = true
+            passwordTextField1.isHidden = false
+            passwordTextField1.stringValue = viewModel.password
+        }
+    }
+    
+    private func skipSignUpView() -> Void {
+        guard let parentView = self.superview else { return }
+        if parentView is NSBox {
+            let model = KMSignUpViewModel()
+            model.email = viewModel.email
+            model.password = viewModel.password
+            model.signUpState = .password
+            let signUpView = KMSignUpView(model: model, superView: parentView)
+            NSAnimationContext.runAnimationGroup { context in
+                context.duration = 0.3
+                self.animator().alphaValue = 0
+            } completionHandler: {
+                self.removeFromSuperview()
+                signUpView.alphaValue = 0
+                (parentView as! NSBox).contentView = signUpView
+                NSAnimationContext.runAnimationGroup({ context in
+                    context.duration = 0.3
+                    signUpView.animator().alphaValue = 1
+                }, completionHandler: nil)
+            }
+        } else {
+            guard let parentView = self.superview else { return }
+            let model = KMSignUpViewModel()
+            model.email = viewModel.email
+            model.password = viewModel.password
+            model.signUpState = .password
+            let signUpView = KMSignUpView(model: model, superView: parentView)
+            NSAnimationContext.runAnimationGroup { context in
+                context.duration = 0.3
+                self.animator().alphaValue = 0
+            } completionHandler: {
+                self.removeFromSuperview()
+                signUpView.alphaValue = 0
+                parentView.addSubview(signUpView)
+                NSAnimationContext.runAnimationGroup({ context in
+                    context.duration = 0.3
+                    signUpView.animator().alphaValue = 1
+                }, completionHandler: nil)
+            }
+        }
+    }
+    
+    // MARK: Bind Method
+    
+    func bindViewModel() -> Void {
+        viewModel.$isVisible
+            .receive(on: RunLoop.main)
+            .sink { [weak self] newValue in
+                self?.visibleStateChange()
+            }
+            .store(in: &cancellables)
+        viewModel.$passwordErrorMessage
+            .receive(on: RunLoop.main)
+            .sink { [weak self] newValue in
+                self?.passwordErrorLabel.stringValue = newValue
+                self?.passwordErrorLabel.isHidden = false
+            }
+            .store(in: &cancellables)
+    }
+
+    // MARK: Action Method
+    
+    @IBAction func visibleAction(_ sender: NSButton) {
+        viewModel.isVisible.toggle()
+    }
+    
+    @IBAction func finishAction(_ sender: NSButton) {
+        viewModel.passwordErrorMessage = ""
+        viewModel.resetPassword() { [weak self] success, msg   in
+            guard let self = self else { return }
+            if success {
+                
+            } else {
+                
+            }
+        }
+    }
+}
+
+extension KMEnterNewPasswordView: NSTextFieldDelegate {
+    func controlTextDidEndEditing(_ obj: Notification) {
+        let textField = obj.object as? NSTextField
+        if textField == passwordTextField {
+            viewModel.password = textField!.stringValue
+        } else if textField == passwordTextField1 {
+            viewModel.password = textField!.stringValue
+        }
+    }
+    
+    func controlTextDidChange(_ obj: Notification) {
+        let textField = obj.object as? NSTextField
+        if textField == passwordTextField {
+            viewModel.password = textField!.stringValue
+        } else if textField == passwordTextField1 {
+            viewModel.password = textField!.stringValue
+        }
+    }
+}

+ 184 - 0
PDF Office/PDF Master/MemberCenter/View/KMEnterNewPasswordView.xib

@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMEnterNewPasswordView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="finshBox" destination="8oD-pe-ETb" id="SjP-50-Lxn"/>
+                <outlet property="finshButton" destination="frm-E5-sBJ" id="KJD-Rr-WUS"/>
+                <outlet property="passwordBox" destination="bNK-ST-ALL" id="8fb-2v-2No"/>
+                <outlet property="passwordErrorLabel" destination="qlQ-Xr-lw9" id="eGq-Q6-LEm"/>
+                <outlet property="passwordTextField" destination="I9E-f1-hFQ" id="moA-kW-ywQ"/>
+                <outlet property="passwordTextField1" destination="HGf-ua-bPm" id="eWD-aX-qmV"/>
+                <outlet property="passwordView" destination="WIx-HY-fqK" id="mgu-rT-cPI"/>
+                <outlet property="resetPasswordsLabel" destination="aJo-ll-hmw" id="exH-6j-QbV"/>
+                <outlet property="visibleButton" destination="7s3-Lw-j8Q" id="5zn-Jn-aus"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="WPO-mj-zK3">
+            <rect key="frame" x="0.0" y="0.0" width="361" height="443"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ZRz-aH-GEE">
+                    <rect key="frame" x="46" y="156" width="279" height="132"/>
+                    <view key="contentView" id="Bfc-fj-lKa">
+                        <rect key="frame" x="0.0" y="0.0" width="279" height="132"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="qdj-L6-DZD">
+                                <rect key="frame" x="0.0" y="108" width="279" height="24"/>
+                                <subviews>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aJo-ll-hmw">
+                                        <rect key="frame" x="-2" y="4" width="37" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="LI7-Tb-Bkb">
+                                            <font key="font" usesAppearanceFont="YES"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="24" id="4WN-E9-TE1"/>
+                                    <constraint firstItem="aJo-ll-hmw" firstAttribute="leading" secondItem="qdj-L6-DZD" secondAttribute="leading" id="KMA-nX-iQE"/>
+                                    <constraint firstItem="aJo-ll-hmw" firstAttribute="centerY" secondItem="qdj-L6-DZD" secondAttribute="centerY" id="YTZ-kl-y2d"/>
+                                </constraints>
+                            </customView>
+                            <box boxType="custom" borderWidth="0.0" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="8oD-pe-ETb">
+                                <rect key="frame" x="0.0" y="0.0" width="279" height="32"/>
+                                <view key="contentView" id="Iy2-fb-zOV">
+                                    <rect key="frame" x="0.0" y="0.0" width="279" height="32"/>
+                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                    <subviews>
+                                        <button translatesAutoresizingMaskIntoConstraints="NO" id="frm-E5-sBJ">
+                                            <rect key="frame" x="0.0" y="0.0" width="279" height="32"/>
+                                            <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="5SB-ZM-9E8">
+                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                <font key="font" metaFont="system"/>
+                                            </buttonCell>
+                                            <connections>
+                                                <action selector="finishAction:" target="-2" id="q13-Cx-Lck"/>
+                                            </connections>
+                                        </button>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstAttribute="bottom" secondItem="frm-E5-sBJ" secondAttribute="bottom" id="5Ne-ee-P4x"/>
+                                        <constraint firstItem="frm-E5-sBJ" firstAttribute="top" secondItem="Iy2-fb-zOV" secondAttribute="top" id="QzR-Qc-5Rb"/>
+                                        <constraint firstAttribute="trailing" secondItem="frm-E5-sBJ" secondAttribute="trailing" id="rVx-NY-cGw"/>
+                                        <constraint firstItem="frm-E5-sBJ" firstAttribute="leading" secondItem="Iy2-fb-zOV" secondAttribute="leading" id="uwp-0B-lYw"/>
+                                    </constraints>
+                                </view>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="32" id="5Y6-dk-h8W"/>
+                                </constraints>
+                            </box>
+                            <box boxType="custom" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="bNK-ST-ALL">
+                                <rect key="frame" x="0.0" y="56" width="279" height="28"/>
+                                <view key="contentView" id="bPs-xE-mfj">
+                                    <rect key="frame" x="1" y="1" width="277" height="26"/>
+                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                    <subviews>
+                                        <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WIx-HY-fqK">
+                                            <rect key="frame" x="0.0" y="0.0" width="277" height="26"/>
+                                            <subviews>
+                                                <secureTextField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HGf-ua-bPm">
+                                                    <rect key="frame" x="8" y="5" width="243" height="16"/>
+                                                    <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" drawsBackground="YES" usesSingleLineMode="YES" id="fg3-dM-O24">
+                                                        <font key="font" metaFont="system"/>
+                                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                        <allowedInputSourceLocales>
+                                                            <string>NSAllRomanInputSourcesLocaleIdentifier</string>
+                                                        </allowedInputSourceLocales>
+                                                    </secureTextFieldCell>
+                                                </secureTextField>
+                                                <textField hidden="YES" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="I9E-f1-hFQ">
+                                                    <rect key="frame" x="6" y="5" width="247" height="16"/>
+                                                    <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" id="Yxo-Qm-Gcx">
+                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                                <button translatesAutoresizingMaskIntoConstraints="NO" id="7s3-Lw-j8Q">
+                                                    <rect key="frame" x="255" y="5" width="16" height="16"/>
+                                                    <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="oA3-4T-y2s">
+                                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                        <font key="font" metaFont="system"/>
+                                                    </buttonCell>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="16" id="4HR-9u-dMk"/>
+                                                        <constraint firstAttribute="height" constant="16" id="M3b-T0-RbO"/>
+                                                    </constraints>
+                                                    <connections>
+                                                        <action selector="visibleAction:" target="-2" id="uwH-eO-8uL"/>
+                                                    </connections>
+                                                </button>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstAttribute="trailing" secondItem="7s3-Lw-j8Q" secondAttribute="trailing" constant="6" id="8s7-zM-dFU"/>
+                                                <constraint firstItem="I9E-f1-hFQ" firstAttribute="leading" secondItem="WIx-HY-fqK" secondAttribute="leading" constant="8" id="AOn-iI-5YZ"/>
+                                                <constraint firstItem="7s3-Lw-j8Q" firstAttribute="leading" secondItem="I9E-f1-hFQ" secondAttribute="trailing" constant="4" id="AkH-9a-Gpz"/>
+                                                <constraint firstItem="7s3-Lw-j8Q" firstAttribute="leading" secondItem="HGf-ua-bPm" secondAttribute="trailing" constant="4" id="CwT-Wf-qie"/>
+                                                <constraint firstItem="7s3-Lw-j8Q" firstAttribute="centerY" secondItem="WIx-HY-fqK" secondAttribute="centerY" id="FZY-Gu-rFv"/>
+                                                <constraint firstItem="I9E-f1-hFQ" firstAttribute="centerY" secondItem="WIx-HY-fqK" secondAttribute="centerY" id="HHl-VW-0R4"/>
+                                                <constraint firstItem="HGf-ua-bPm" firstAttribute="centerY" secondItem="WIx-HY-fqK" secondAttribute="centerY" id="hQM-Vq-aEg"/>
+                                                <constraint firstItem="HGf-ua-bPm" firstAttribute="leading" secondItem="WIx-HY-fqK" secondAttribute="leading" constant="8" id="ikg-C4-iWJ"/>
+                                            </constraints>
+                                        </customView>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstAttribute="trailing" secondItem="WIx-HY-fqK" secondAttribute="trailing" id="3C2-Op-lrt"/>
+                                        <constraint firstAttribute="bottom" secondItem="WIx-HY-fqK" secondAttribute="bottom" id="7oW-U0-ET3"/>
+                                        <constraint firstItem="WIx-HY-fqK" firstAttribute="leading" secondItem="bPs-xE-mfj" secondAttribute="leading" id="IHh-j5-MVY"/>
+                                        <constraint firstItem="WIx-HY-fqK" firstAttribute="top" secondItem="bPs-xE-mfj" secondAttribute="top" id="sQQ-N6-kkv"/>
+                                    </constraints>
+                                </view>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="28" id="GiJ-BV-Mfd"/>
+                                </constraints>
+                            </box>
+                            <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qlQ-Xr-lw9">
+                                <rect key="frame" x="-2" y="40" width="283" height="16"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="EhP-4f-hOw">
+                                    <font key="font" metaFont="system"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                        </subviews>
+                        <constraints>
+                            <constraint firstAttribute="trailing" secondItem="8oD-pe-ETb" secondAttribute="trailing" id="70r-yP-z2W"/>
+                            <constraint firstItem="bNK-ST-ALL" firstAttribute="top" secondItem="qdj-L6-DZD" secondAttribute="bottom" constant="24" id="Bb4-FV-GBq"/>
+                            <constraint firstItem="qlQ-Xr-lw9" firstAttribute="top" secondItem="bNK-ST-ALL" secondAttribute="bottom" id="C0J-oF-I7R"/>
+                            <constraint firstItem="qdj-L6-DZD" firstAttribute="leading" secondItem="Bfc-fj-lKa" secondAttribute="leading" id="HrC-zc-YCf"/>
+                            <constraint firstItem="qlQ-Xr-lw9" firstAttribute="leading" secondItem="Bfc-fj-lKa" secondAttribute="leading" id="VIc-0W-i21"/>
+                            <constraint firstItem="bNK-ST-ALL" firstAttribute="leading" secondItem="Bfc-fj-lKa" secondAttribute="leading" id="f0R-aG-PrX"/>
+                            <constraint firstAttribute="trailing" secondItem="qlQ-Xr-lw9" secondAttribute="trailing" id="f2I-gS-9lc"/>
+                            <constraint firstItem="qdj-L6-DZD" firstAttribute="top" secondItem="Bfc-fj-lKa" secondAttribute="top" id="kHT-oF-ZQS"/>
+                            <constraint firstAttribute="trailing" secondItem="qdj-L6-DZD" secondAttribute="trailing" id="nRQ-8L-jW3"/>
+                            <constraint firstItem="8oD-pe-ETb" firstAttribute="leading" secondItem="Bfc-fj-lKa" secondAttribute="leading" id="nWF-70-1QW"/>
+                            <constraint firstAttribute="bottom" secondItem="8oD-pe-ETb" secondAttribute="bottom" id="oJy-0x-hzK"/>
+                            <constraint firstAttribute="trailing" secondItem="bNK-ST-ALL" secondAttribute="trailing" id="ozE-Dd-Crt"/>
+                        </constraints>
+                    </view>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="132" id="aue-yR-55M"/>
+                        <constraint firstAttribute="width" constant="279" id="h7X-Hs-iiQ"/>
+                    </constraints>
+                </box>
+            </subviews>
+            <constraints>
+                <constraint firstItem="ZRz-aH-GEE" firstAttribute="leading" secondItem="WPO-mj-zK3" secondAttribute="leading" constant="46" id="5fn-1p-8bn"/>
+                <constraint firstItem="ZRz-aH-GEE" firstAttribute="centerY" secondItem="WPO-mj-zK3" secondAttribute="centerY" id="ICb-sb-KoK"/>
+                <constraint firstAttribute="trailing" secondItem="ZRz-aH-GEE" secondAttribute="trailing" constant="36" id="ums-Af-y1o"/>
+            </constraints>
+            <point key="canvasLocation" x="-57.5" y="114.5"/>
+        </customView>
+    </objects>
+</document>

+ 1 - 1
PDF Office/PDF Master/MemberCenter/View/KMEnterVerificationCodeView.swift

@@ -187,7 +187,7 @@ class KMEnterVerificationCodeView: KMBaseXibView {
     
     @IBAction func nextButtonAction(_ sender: NSButton) {
         viewModel.passwordErrorMessage = ""
-        viewModel.enterVerificationCodeNextAction() { [weak self] success  in
+        viewModel.enterVerificationCodeNextAction() { [weak self] success, msg   in
             guard let self = self else { return }
             if success {
                 self.skipEnterNewPasswordView()

+ 1 - 1
PDF Office/PDF Master/MemberCenter/View/KMForgotPasswordView.swift

@@ -171,7 +171,7 @@ class KMForgotPasswordView: KMBaseXibView {
     
     @IBAction func nextButtonAction(_ sender: NSButton) {
         viewModel.emailErrorMessage = ""
-        viewModel.forgotPasswordNextAction() { [weak self] success  in
+        viewModel.forgotPasswordNextAction() { [weak self] success, msg in
             guard let self = self else { return }
             if success {
                 self.skipEnterVerificationCodeView()

+ 43 - 8
PDF Office/PDF Master/MemberCenter/ViewModel/KMSignUpViewModel.swift

@@ -13,7 +13,7 @@ import Combine
     case password               // 密码
 }
 
-typealias ForgotPasswordComplete = (_ success: Bool) -> Void
+typealias ForgotPasswordComplete = (_ success: Bool,_ msg: String) -> Void
 
 class KMSignUpViewModel: ObservableObject {
     /**
@@ -161,9 +161,17 @@ class KMSignUpViewModel: ObservableObject {
             passwordErrorMessage = NSLocalizedString("*Please enter right Verification code", tableName: "MemberCenterLocalizable", comment: "")
             return
         }
+        if !isValidEmail() {
+            emailErrorMessage = NSLocalizedString("Please enter the correct email format", tableName: "MemberCenterLocalizable", comment: "")
+            return
+        }
         
         var code = password
         if signUpState == .verificationCode {
+            if verificationCode.count <= 0 {
+                emailErrorMessage = NSLocalizedString("*Please enter right Verification code", tableName: "MemberCenterLocalizable", comment: "")
+                return
+            }
             code = verificationCode
         }
         KMMemberCenterManager.manager.emailLogin(email: email, code: code) { [weak self] error, wrapper  in
@@ -202,18 +210,18 @@ class KMSignUpViewModel: ObservableObject {
             return
         }
         
-        KMMemberCenterManager.manager.resetPassword(email: email) { [weak self] error, wrapper  in
+        KMMemberCenterManager.manager.emailVerification(email: email) { [weak self] error, wrapper  in
             guard let self = self else { return }
             let resultDict = wrapper! as KMMemberCenterResult
-            let msg = resultDict.msg
+            let msg = resultDict.msg! as String
             if error {
                 print("错误信息:%@", msg as Any)
             } else {
                 let result: Bool = resultDict.result!
                 if result {
-                    complete(true)
+                    complete(true, msg)
                 } else {
-                    complete(false)
+                    complete(false, msg)
                 }
             }
         }
@@ -226,15 +234,15 @@ class KMSignUpViewModel: ObservableObject {
     func enterVerificationCodeNextAction(complete: @escaping ForgotPasswordComplete) -> Void {
         if verificationCode.count <= 0 {
             emailErrorMessage = NSLocalizedString("*Please enter right Verification code", tableName: "MemberCenterLocalizable", comment: "")
-            complete(false)
+            complete(false, "")
             return
         }
         if !isValidVerificationCode() {
             emailErrorMessage = NSLocalizedString("*Please enter right Verification code", tableName: "MemberCenterLocalizable", comment: "")
-            complete(false)
+            complete(false, "")
             return
         }
-        complete(true)
+        complete(true, "")
     }
     
     /**
@@ -265,4 +273,31 @@ class KMSignUpViewModel: ObservableObject {
             }
         }
     }
+    
+    /**
+     @abstract 获取邮箱验证码
+     @param
+     */
+    func resetPassword(complete: @escaping ForgotPasswordComplete) -> Void {
+        KMMemberCenterManager.manager.resetPassword(email: email, verifyCode: verificationCode, password: password) { [weak self] error, wrapper  in
+            guard let self = self else { return }
+            let resultDict = wrapper! as KMMemberCenterResult
+            let msg = resultDict.msg! as String
+            let result: Bool = resultDict.result ?? false
+            if error {
+                if !result {
+                    print("错误信息:%@", msg as Any)
+                    complete(false, msg)
+                }
+            } else {
+                if !result {
+                    print("错误信息:%@", msg as Any)
+                    complete(false, msg)
+                } else {
+                    print("验证邮箱成功")
+                    complete(false, msg)
+                }
+            }
+        }
+    }
 }

+ 16 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -1131,6 +1131,12 @@
 		9FC346592CD0C7ED00F35823 /* KMEnterVerificationCodeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FC346582CD0C7ED00F35823 /* KMEnterVerificationCodeView.xib */; };
 		9FC3465A2CD0C7ED00F35823 /* KMEnterVerificationCodeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FC346582CD0C7ED00F35823 /* KMEnterVerificationCodeView.xib */; };
 		9FC3465B2CD0C7ED00F35823 /* KMEnterVerificationCodeView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FC346582CD0C7ED00F35823 /* KMEnterVerificationCodeView.xib */; };
+		9FC3465D2CD1004400F35823 /* KMEnterNewPasswordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC3465C2CD1004400F35823 /* KMEnterNewPasswordView.swift */; };
+		9FC3465E2CD1004400F35823 /* KMEnterNewPasswordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC3465C2CD1004400F35823 /* KMEnterNewPasswordView.swift */; };
+		9FC3465F2CD1004400F35823 /* KMEnterNewPasswordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FC3465C2CD1004400F35823 /* KMEnterNewPasswordView.swift */; };
+		9FC346612CD1005100F35823 /* KMEnterNewPasswordView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FC346602CD1005100F35823 /* KMEnterNewPasswordView.xib */; };
+		9FC346622CD1005100F35823 /* KMEnterNewPasswordView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FC346602CD1005100F35823 /* KMEnterNewPasswordView.xib */; };
+		9FC346632CD1005100F35823 /* KMEnterNewPasswordView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FC346602CD1005100F35823 /* KMEnterNewPasswordView.xib */; };
 		9FC444FA2AA61EDE00D7187C /* ZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC444F82AA5F7D600D7187C /* ZipArchive.framework */; };
 		9FC444FB2AA61EDE00D7187C /* ZipArchive.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9FC444F82AA5F7D600D7187C /* ZipArchive.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
 		9FCFEC682AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FCFEC672AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift */; };
@@ -6133,6 +6139,8 @@
 		9FC3464C2CCFA9D600F35823 /* KMForgotPasswordView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMForgotPasswordView.xib; sourceTree = "<group>"; };
 		9FC346542CD0C4FB00F35823 /* KMEnterVerificationCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMEnterVerificationCodeView.swift; sourceTree = "<group>"; };
 		9FC346582CD0C7ED00F35823 /* KMEnterVerificationCodeView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMEnterVerificationCodeView.xib; sourceTree = "<group>"; };
+		9FC3465C2CD1004400F35823 /* KMEnterNewPasswordView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMEnterNewPasswordView.swift; sourceTree = "<group>"; };
+		9FC346602CD1005100F35823 /* KMEnterNewPasswordView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMEnterNewPasswordView.xib; sourceTree = "<group>"; };
 		9FC444F82AA5F7D600D7187C /* ZipArchive.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ZipArchive.framework; sourceTree = "<group>"; };
 		9FCFEC672AC2EAD500EAD2CB /* CPDFListViewColorMenuItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CPDFListViewColorMenuItemView.swift; sourceTree = "<group>"; };
 		9FCFEC6B2AC3D96800EAD2CB /* CPDFListViewAnimatedBorderlessWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CPDFListViewAnimatedBorderlessWindow.swift; sourceTree = "<group>"; };
@@ -9029,6 +9037,8 @@
 				9FC3464C2CCFA9D600F35823 /* KMForgotPasswordView.xib */,
 				9FC346542CD0C4FB00F35823 /* KMEnterVerificationCodeView.swift */,
 				9FC346582CD0C7ED00F35823 /* KMEnterVerificationCodeView.xib */,
+				9FC3465C2CD1004400F35823 /* KMEnterNewPasswordView.swift */,
+				9FC346602CD1005100F35823 /* KMEnterNewPasswordView.xib */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -15049,6 +15059,7 @@
 				9F8810882B564E9700F69815 /* KMAnnotationButtonWidgetOptionsViewController.xib in Resources */,
 				AD3AAD4D2B0B7B9300DE5FE7 /* KMCompareTextView.xib in Resources */,
 				9FB220FA2B186C9800A5B208 /* KMAnnotationGeneralViewController.xib in Resources */,
+				9FC346612CD1005100F35823 /* KMEnterNewPasswordView.xib in Resources */,
 				BB49ED11293F462E00C82CA2 /* KMConvertImageWindowController.xib in Resources */,
 				AD1D481C2AFB6B96007AC1F0 /* KMMergeWindowController.xib in Resources */,
 				BB5DA54D2BCFF4B300849E86 /* KMPageEditPopViewController.xib in Resources */,
@@ -15623,6 +15634,7 @@
 				BBAFDA7E2B4CDE1D00278BC3 /* KMPDFCropWindowController.xib in Resources */,
 				9FF371D82C69B92F005F9CC5 /* CAreaMeasureInfoWindowController.xib in Resources */,
 				ADE86A972B0226BB00414DFA /* KMRemovePasswordView.xib in Resources */,
+				9FC346622CD1005100F35823 /* KMEnterNewPasswordView.xib in Resources */,
 				BBEFD0212AF9E5BC003FABD8 /* KMBatchOperateAddHeaderFooterViewController.xib in Resources */,
 				9F03900A2B426F3300302D1D /* KMPageDisplayPropertiesViewController.xib in Resources */,
 				ADF1569829A62D31001D1018 /* KMLoginLeftImageView.xib in Resources */,
@@ -16689,6 +16701,7 @@
 				BB8810632B4F74DD00AFA63E /* KMRepeatTrialAlertController.xib in Resources */,
 				BB49ED13293F462E00C82CA2 /* KMConvertImageWindowController.xib in Resources */,
 				ADE86A7D2B0221E100414DFA /* KMSecurityWindowController.xib in Resources */,
+				9FC346632CD1005100F35823 /* KMEnterNewPasswordView.xib in Resources */,
 				AD53AF952BF1BCA300DCFFFC /* KMLoadingView.xib in Resources */,
 				9F00CCBB2A2F1E0F00AC462E /* dsa_priv.pem in Resources */,
 				BBF62C6E2B033B5B007B7E86 /* KMPDFEditExtractWindow.xib in Resources */,
@@ -17985,6 +17998,7 @@
 				BBBB6CD22AD14A5F0035AA66 /* CPDFChoiceWidgetAnnotation+PDFListView.swift in Sources */,
 				BB4A94A42B04DA0C00940F8B /* KMGOCRManagerNew.swift in Sources */,
 				9F1FE3DE293EE51F00E952CA /* KMMainDocument.swift in Sources */,
+				9FC3465D2CD1004400F35823 /* KMEnterNewPasswordView.swift in Sources */,
 				9F0201962A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift in Sources */,
 				AD85D1A42AF09864000F4D28 /* KMHomeQuickToolsWindowController.swift in Sources */,
 				BBF2455D2AE78FF900037D08 /* KMBatchWindow.swift in Sources */,
@@ -18975,6 +18989,7 @@
 				9F1FE4FA29406E4700E952CA /* CTTabStripView.m in Sources */,
 				AD055E722B8732E00035F824 /* SKDictionaryFormatter.m in Sources */,
 				BB78EAAB2B561F9700121691 /* KMFullScreenWindow.swift in Sources */,
+				9FC3465E2CD1004400F35823 /* KMEnterNewPasswordView.swift in Sources */,
 				BB31DA632AFA3088006D63CB /* KMPreferenceController.swift in Sources */,
 				AD199DF02B23121000D56FEE /* KMPrintPamphletView.swift in Sources */,
 				9F0CB48829683DC400007028 /* KMPropertiesPanelPresetColorSubVC.swift in Sources */,
@@ -19832,6 +19847,7 @@
 				AD055E622B85E04C0035F824 /* KMTextWithIconCell.swift in Sources */,
 				AD055E802B88294F0035F824 /* SKBookmarkSheetController.m in Sources */,
 				ADDF835B2B391A5C00A81A4E /* CDSignatureCertificateStateViewController.swift in Sources */,
+				9FC3465F2CD1004400F35823 /* KMEnterNewPasswordView.swift in Sources */,
 				6536FDE92C9C49A6004A0FB9 /* KMNoteFooterCellView.swift in Sources */,
 				ADE86AB82B0343E600414DFA /* KMWatermarkView.swift in Sources */,
 				BB897277294DC04F0045787C /* KMWatermartAdjectivePageRangeView.swift in Sources */,