当前位置: 首页 > news >正文

调用云服务认证体系

一、介绍
基于鸿蒙Next实现应用的认证注册流程。
二、场景需求

用户注册模块:

邮箱/手机号验证:

密码设置:

个人信息填写:

用户登录模块:

邮箱/手机号与密码登录:
用户输入注册时的邮箱/手机号和密码。
第三方登录选项:
提供使用社交账号(如微信、Facebook、Google等)直接登录的选项。

忘记密码模块:

找回密码流程:
用户输入注册时的邮箱/手机号,系统发送重置链接或验证码。
用户通过链接或验证码进入重置密码界面。

多因素认证(可选):

用户在登录后可选择启用多因素认证(如短信验证码、邮箱验证、Authenticator应用等)。

错误处理与反馈:

系统需提供清晰的错误信息(如“邮箱已被注册”、“密码格式不正确”等)。
注册成功后显示欢迎信息并引导用户进行后续操作(如设置个人资料)。

潜在价值:提供安全、简便的注册与认证流程,提高用户体验。通过验证机制确保数据安全,减少虚假账户,同时保护用户隐私。
提升用户的快速注册与登录效率,增强用户留存和活跃度。
这种认证注册流程可以确保用户体验流畅,同时满足安全性与隐私保护的需求。

三、业务步骤
第一步:在页面初始化的时候判定账号是否注册
第二步:账号注册登录,直接显示可操作页面
第三步:账号未注册登录,进入注册登录环节
第四步:注册认证账号完成

四、效果展示

#HarmonyOS NEXT 体验官#调用云服务认证体系-鸿蒙开发者社区

五:代码展示:

import { promptAction, router } from '@kit.ArkUI';
import cloud from '@hw-agconnect/cloud';
import { PointsList } from '../PointsList';
import schema from '../idiom-schema.json';
import { Logger } from '@hw-agconnect/hmcore';
import { TAG } from '@ohos/hypium/src/main/Constant';import { CommonConstants, FooterTabType } from '../common/CommonConstants';
import { HomePage } from '../pages/HomePage'
import { IdiomPage } from '../pages/IdiomPage'
import { PointsListPage } from '../pages/PointsListPage'
import { MinePage } from '../pages/MinePage'AppStorage.setOrCreate('isLogin', true)
AppStorage.setOrCreate('Phone', 'admin')
AppStorage.setOrCreate('Password', '123456')@Entry
@Component
struct Index {@State currentIndex: number = 0;@State fontColor: string = '#182431'@State selectedFontColor: string = '#007DFF'private controller: TabsController = new TabsController()@Provide pointsList: PointsList[] = [] //排上榜单数据@BuildertabBuilder(tabList: FooterTabType[], index: number) {Column() {Image(this.currentIndex === index ? tabList[index].icon_select : tabList[index].icon_normal).width(28).height(28).objectFit(ImageFit.Contain)Text(tabList[index].title).fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor).fontSize(12).fontWeight(500).lineHeight(20)}.width('100%')}onPageShow(): void {if (router.getParams() as number != null && router.getParams() as number != undefined) {this.currentIndex = router.getParams() as number} else {this.currentIndex = 0}this.isSilentLogin() // 是否登录}isSilentLogin() {cloud.auth().getCurrentUser().then(user => {if (user) {//业务逻辑AppStorage.set('isLogin', false)return}AppStorage.set('isLogin', true)});}build() {Stack() {Tabs({ barPosition: BarPosition.End, controller: this.controller }) {TabContent() {Column() {HomePage()}.height('100%').width('100%').backgroundColor(0xeeeeee)}.tabBar(this.tabBuilder(CommonConstants.FOOTER_TAB_TITLE, 0))TabContent() {Column() {IdiomPage()}.height('100%').width('100%').backgroundColor(0xeeeeee)}.tabBar(this.tabBuilder(CommonConstants.FOOTER_TAB_TITLE, 1))TabContent() {Column() {PointsListPage()}.height('100%').width('100%').backgroundColor(0xeeeeee)}.tabBar(this.tabBuilder(CommonConstants.FOOTER_TAB_TITLE, 2))TabContent() {Column() {MinePage()}.height('100%').width('100%').backgroundColor(0xeeeeee)}.tabBar(this.tabBuilder(CommonConstants.FOOTER_TAB_TITLE, 3))}.scrollable(false).expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]).height("100%").width("100%").onChange((idx: number) => {this.currentIndex = idx})}.height('100%').width('100%')}
}


http://www.mrgr.cn/news/20060.html

相关文章:

  • 手机玩机常识-----小米手机助手操作与下载 那些你不知道的联机解决常识
  • JS中正则表达式捕获组与反向引用详解
  • 网卡mac地址怎么查看?方法来了,超级简单!
  • wordpress免费下载
  • Ubuntu之源码编译安装nginx
  • android面试:解释一下 Android 中的 Intent
  • 免费无广的多端同步标签 | 极空间私有化部署高颜值浏览器新标签页『mTab』
  • Redis篇 - 深入了解查询缓存与缓存带来的问题
  • nnunetv2(一)配置文件和nnUNetv2_convert_MSD_dataset命令
  • VSCode常用快捷键
  • springboot社区医院管理系统
  • 经典数据结构-栈计算逆波兰表达式
  • android开机动画bootanimation.zip的制作
  • spring boot 项目 跟 JavaScript 简单 websocket 使用
  • C 语言指针与数组的深度解析
  • 万物皆对象 - 一文详解JS面向对象编程的核心方法
  • “创造神迹” -> “打造利器”:AI 从实验室走向市场的五大障碍
  • Similarity Distance-Based Label Assignment for Tiny Object Detection
  • DevExpress WPF中文教程:如何解决排序、过滤遇到的常见问题?(一)
  • Python编程 - 深入面向对象