GenAuth DocsDocuments
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Concepts
User Guide
Development Integration
AgentAuth
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Old version
  • Single Page Web Application

  • Mobile and Client Applications

    • Android

    • C#

    • Flutter

    • iOS

      • Quick Start
      • Hosted Pages
      • Components

        • Tutorial

          • 入门示例
          • 基础登录示例
          • 复杂登录示例
          • 完善登录界面
          • 基础注册示例
          • 复杂注册示例
          • 登录注册转场
          • 手机号码重置密码
          • 邮箱地址重置密码
          • 动态重置密码
        • Basic Components

        • Social Components

      • APIs

      • Social Login

      • Typical Scenarios

      • Private Deployment
    • React Native
  • Standard Web Application

  • Framework Integration

  • Others

  1. Development Integration
  2. /
  3. Mobile and Client Applications
  4. /
  5. iOS
  6. /
  7. Components
  8. /
  9. Tutorial

  10. /
  11. 动态重置密码

¶ 动态重置密码

Update time: 2025-07-23 07:34:21
Edit

阅读此教程之前,确保已经完成了 开发准备、手机号码重置密码、邮箱地址重置密码

为了方便用户使用,我们设计一个稍微复杂一点的重置密码流程。我们将根据用户的输入动态决定采用哪种方式重置密码。即:

  • 如果用户输入了电话号码,则跳转到手机号码重置密码界面
  • 如果用户输入了邮箱地址,则跳转到邮箱地址重置密码界面

¶ 界面设计

新增一个导航入口页面,放置 AccountTextField、ResetPasswordButton,如下图:

将前面两个教程的 ViewController 拷贝过来,如下图:

¶ 设置 Segue

设置 ViewController 之间的 Segue 为 Show

设置入口页面到手机号码重置密码页面 Segue 的 Identifier 为 phone

同理,再设置入口页面到邮箱地址重置密码页面 Segue 的 Identifier 为 email

¶ 设置回调

import Guard
if let button: ResetPasswordButton = Util.findView(view, viewClass: ResetPasswordButton.self) {
    button.setAuthCompletion { code, message, userInfo in
        if (code == 200) {
            
        }
    }
}

¶ 完成

重置密码的流程和界面就开发完了,可以根据用户的输入跳转到不同的页面,入口页面的帐号信息也会被带入到二级页面。

这是一个业务功能相对复杂的例子,通过 Guard 超组件,我们完成了快速构建。

Previous article: 邮箱地址重置密码 Next article: App Logo
  • 界面设计
  • 设置 Segue
  • 设置回调
  • 完成

User identity management

Integrated third-party login
Customized authentication process

Enterprise internal management

Single sign-on
Multi-factor authentication
Permission management

Developer

Development Documentation
GitHub (opens new window)

Company

official@genauth.ai
16th Floor, Building B, Beichen Century Center, Chaoyang District, Beijing (Total)
Room 406, 4th Floor, Block B, No. 200, Tianfu Fifth Street, High-tech Zone, Chengdu (Branch)

© Beijing Steamory Technology Co., Ltd.