@authing/react-ui-components 3.0.2-beta.5 → 3.1.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/LICENSE +21 -0
  3. package/config/env.js +26 -24
  4. package/config/paths.js +3 -3
  5. package/config/webpack.config.js +29 -7
  6. package/lib/index.d.ts +211 -1252
  7. package/lib/index.min.css +1 -2
  8. package/lib/index.min.js +1 -1
  9. package/lib/index.min.js.LICENSE.txt +0 -32
  10. package/package.json +14 -20
  11. package/scripts/build.js +83 -79
  12. package/scripts/start.js +73 -69
  13. package/scripts/test.js +23 -19
  14. package/{components → src/common}/AuthingDropdown/index.tsx +1 -1
  15. package/{components → src/common}/AuthingDropdown/style.less +0 -0
  16. package/{components → src/common}/AuthingTabs/index.tsx +1 -1
  17. package/{components → src/common}/AuthingTabs/style.less +0 -0
  18. package/{components → src/common}/CopyAbleText/index.tsx +1 -1
  19. package/{components → src/common}/CopyAbleText/style.less +0 -0
  20. package/{components → src/common}/VerifyCodeInput/index.tsx +0 -0
  21. package/{components → src/common}/VerifyCodeInput/style.less +0 -0
  22. package/{components → src/components}/AuthingGuard/AppMFALayout/index.tsx +2 -2
  23. package/{components → src/components}/AuthingGuard/AppMFALayout/style.less +0 -0
  24. package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/index.tsx +1 -1
  25. package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/style.less +0 -0
  26. package/{components → src/components}/AuthingGuard/Forms/ADLoginForm/index.tsx +2 -2
  27. package/{components → src/components}/AuthingGuard/Forms/Agreements/index.tsx +1 -1
  28. package/{components → src/components}/AuthingGuard/Forms/Agreements/style.less +0 -0
  29. package/{components → src/components}/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +3 -3
  30. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +4 -2
  31. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +2 -2
  32. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +1 -1
  33. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  34. package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/index.tsx +2 -2
  35. package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  36. package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/index.tsx +4 -9
  37. package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  38. package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/index.tsx +1 -1
  39. package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/style.less +0 -0
  40. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +2 -2
  41. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +1 -1
  42. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +1 -1
  43. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -0
  44. package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/index.tsx +2 -2
  45. package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -0
  46. package/{components → src/components}/AuthingGuard/Forms/PasswordLoginForm/index.tsx +3 -3
  47. package/{components → src/components}/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +2 -2
  48. package/{components → src/components}/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +2 -2
  49. package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +4 -2
  50. package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -0
  51. package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/index.tsx +1 -1
  52. package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  53. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +1 -1
  54. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +2 -2
  55. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +2 -2
  56. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +2 -2
  57. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +1 -1
  58. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/index.tsx +1 -1
  59. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/style.less +0 -0
  60. package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -0
  61. package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/index.tsx +2 -2
  62. package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/style.less +0 -0
  63. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +2 -2
  64. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +2 -2
  65. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +1 -1
  66. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -0
  67. package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +7 -7
  68. package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -0
  69. package/{components → src/components}/AuthingGuard/Forms/UploadImage/index.tsx +1 -1
  70. package/{components → src/components}/AuthingGuard/Forms/index.ts +0 -0
  71. package/{components → src/components}/AuthingGuard/GuardLayout/index.tsx +17 -3
  72. package/{components → src/components}/AuthingGuard/GuardLayout/style.less +0 -0
  73. package/{components → src/components}/AuthingGuard/Header/index.tsx +6 -3
  74. package/{components → src/components}/AuthingGuard/Header/style.less +23 -11
  75. package/{components → src/components}/AuthingGuard/IconFont/iconfont.js +0 -0
  76. package/{components → src/components}/AuthingGuard/IconFont/index.tsx +1 -1
  77. package/{components → src/components}/AuthingGuard/IconFont/style.less +0 -0
  78. package/{components → src/components}/AuthingGuard/IconFont/svg.js +0 -0
  79. package/{components → src/components}/AuthingGuard/LoginLayout/index.tsx +69 -25
  80. package/{components → src/components}/AuthingGuard/LoginLayout/style.less +0 -0
  81. package/{components → src/components}/AuthingGuard/MfaLayout/Steps.ts +0 -0
  82. package/{components → src/components}/AuthingGuard/MfaLayout/index.tsx +1 -1
  83. package/{components → src/components}/AuthingGuard/MfaLayout/style.less +0 -0
  84. package/{components → src/components}/AuthingGuard/RegisterLayout/index.tsx +2 -2
  85. package/{components → src/components}/AuthingGuard/RegisterLayout/style.less +0 -0
  86. package/{components → src/components}/AuthingGuard/ResetPwdLayout/index.tsx +1 -1
  87. package/{components → src/components}/AuthingGuard/ToggleLang/index.tsx +2 -2
  88. package/{components → src/components}/AuthingGuard/api/appConfig.ts +22 -14
  89. package/{components/_utils → src/components/AuthingGuard/api}/http.ts +33 -30
  90. package/{components → src/components}/AuthingGuard/api/index.ts +0 -0
  91. package/{components → src/components}/AuthingGuard/api/sso.ts +1 -1
  92. package/{components → src/components}/AuthingGuard/api/userPoolConfig.ts +3 -2
  93. package/{components → src/components}/AuthingGuard/constants.ts +2 -2
  94. package/{components → src/components}/AuthingGuard/hooks/index.tsx +0 -0
  95. package/{components → src/components}/AuthingGuard/hooks/useScreenSize.tsx +0 -0
  96. package/{components → src/components}/AuthingGuard/index.tsx +11 -3
  97. package/{components/_utils → src/components/AuthingGuard}/locales/en/common.json +26 -70
  98. package/{components/_utils → src/components/AuthingGuard}/locales/en/index.ts +0 -0
  99. package/{components/_utils → src/components/AuthingGuard}/locales/en/login.json +19 -21
  100. package/{components/_utils → src/components/AuthingGuard}/locales/en/map.json +0 -0
  101. package/{components/_utils → src/components/AuthingGuard}/locales/en/user.json +3 -4
  102. package/{components/_utils → src/components/AuthingGuard}/locales/index.ts +2 -2
  103. package/{components/_utils → src/components/AuthingGuard}/locales/zh/common.json +9 -53
  104. package/{components/_utils → src/components/AuthingGuard}/locales/zh/index.ts +0 -0
  105. package/{components/_utils → src/components/AuthingGuard}/locales/zh/login.json +4 -6
  106. package/{components/_utils → src/components/AuthingGuard}/locales/zh/map.json +0 -0
  107. package/{components/_utils → src/components/AuthingGuard}/locales/zh/user.json +1 -3
  108. package/{components → src/components}/AuthingGuard/style.less +5 -0
  109. package/{components → src/components}/AuthingGuard/types/Forms.ts +2 -1
  110. package/{components → src/components}/AuthingGuard/types/GuardConfig.ts +5 -1
  111. package/{components → src/components}/AuthingGuard/types/GuardState.ts +1 -1
  112. package/{components → src/components}/AuthingGuard/types/Locales.ts +0 -0
  113. package/{components → src/components}/AuthingGuard/types/index.ts +0 -0
  114. package/src/components/index.ts +7 -0
  115. package/{components → src}/context/base.tsx +0 -0
  116. package/{components → src}/context/global/context.tsx +0 -0
  117. package/{components → src}/context/global/reducer.tsx +2 -2
  118. package/src/index.tsx +142 -0
  119. package/{logo.svg → src/logo.svg} +0 -0
  120. package/{react-app-env.d.ts → src/react-app-env.d.ts} +0 -0
  121. package/{reportWebVitals.ts → src/reportWebVitals.ts} +0 -0
  122. package/{setupTests.ts → src/setupTests.ts} +0 -0
  123. package/{components/_utils → src/utils}/clipboard.ts +1 -1
  124. package/{components/_utils → src/utils}/index.ts +3 -149
  125. package/{components/_utils → src/utils}/popupCenter.ts +0 -0
  126. package/tsconfig.json +2 -8
  127. package/build/asset-manifest.json +0 -26
  128. package/build/favicon.ico +0 -0
  129. package/build/index.html +0 -1
  130. package/build/logo192.png +0 -0
  131. package/build/logo512.png +0 -0
  132. package/build/manifest.json +0 -25
  133. package/build/robots.txt +0 -3
  134. package/build/static/css/2.51c07e65.chunk.css +0 -3
  135. package/build/static/css/2.51c07e65.chunk.css.map +0 -1
  136. package/build/static/css/main.779f221a.chunk.css +0 -2
  137. package/build/static/css/main.779f221a.chunk.css.map +0 -1
  138. package/build/static/js/2.bbae9fdb.chunk.js +0 -3
  139. package/build/static/js/2.bbae9fdb.chunk.js.LICENSE.txt +0 -102
  140. package/build/static/js/2.bbae9fdb.chunk.js.map +0 -1
  141. package/build/static/js/3.fd17f196.chunk.js +0 -2
  142. package/build/static/js/3.fd17f196.chunk.js.map +0 -1
  143. package/build/static/js/main.5f341531.chunk.js +0 -2
  144. package/build/static/js/main.5f341531.chunk.js.map +0 -1
  145. package/build/static/js/runtime-main.ef138021.js +0 -2
  146. package/build/static/js/runtime-main.ef138021.js.map +0 -1
  147. package/build/static/media/loading.4a67a5f3.svg +0 -29
  148. package/components/BindTotp/core/bindSuccess.tsx +0 -72
  149. package/components/BindTotp/core/securityCode.tsx +0 -108
  150. package/components/BindTotp/index.tsx +0 -134
  151. package/components/BindTotp/interface.ts +0 -30
  152. package/components/BindTotp/styles.less +0 -57
  153. package/components/ChangeLanguage/index.tsx +0 -35
  154. package/components/ChangePassword/core/firstLoginReset.tsx +0 -111
  155. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  156. package/components/ChangePassword/index.tsx +0 -72
  157. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  158. package/components/CompleteInfo/index.tsx +0 -45
  159. package/components/CompleteInfo/interface.ts +0 -40
  160. package/components/CompleteInfo/styles.less +0 -7
  161. package/components/DownloadAuthenticator/index.tsx +0 -97
  162. package/components/DownloadAuthenticator/interface.ts +0 -22
  163. package/components/DownloadAuthenticator/styles.less +0 -52
  164. package/components/Error/index.tsx +0 -21
  165. package/components/Error/interface.ts +0 -9
  166. package/components/Error/styles.less +0 -12
  167. package/components/ForgetPassword/core/resetPassword.tsx +0 -162
  168. package/components/ForgetPassword/index.tsx +0 -78
  169. package/components/ForgetPassword/interface.ts +0 -32
  170. package/components/Guard/Guard.tsx +0 -295
  171. package/components/Guard/authClient.ts +0 -44
  172. package/components/Guard/config.ts +0 -19
  173. package/components/Guard/event.ts +0 -52
  174. package/components/Guard/index.tsx +0 -4
  175. package/components/Guard/module.ts +0 -20
  176. package/components/Guard/stateMachine.ts +0 -152
  177. package/components/Guard/styles.less +0 -461
  178. package/components/IconFont/iconfont.js +0 -74
  179. package/components/IconFont/index.tsx +0 -16
  180. package/components/IconFont/style.less +0 -6
  181. package/components/IconFont/svg.js +0 -2
  182. package/components/ImagePro/index.tsx +0 -53
  183. package/components/ImagePro/styles.less +0 -40
  184. package/components/InputNumber/index.tsx +0 -33
  185. package/components/Login/codemap.ts +0 -49
  186. package/components/Login/core/withAD.tsx +0 -9
  187. package/components/Login/core/withAppQrcode.tsx +0 -49
  188. package/components/Login/core/withLDAP.tsx +0 -146
  189. package/components/Login/core/withPassword/FormItemAccount.tsx +0 -42
  190. package/components/Login/core/withPassword/GraphicVerifyCode.tsx +0 -30
  191. package/components/Login/core/withPassword/InputAccount.tsx +0 -64
  192. package/components/Login/core/withPassword/index.tsx +0 -173
  193. package/components/Login/core/withPhonecode.tsx +0 -122
  194. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  195. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  196. package/components/Login/index.tsx +0 -374
  197. package/components/Login/props.ts +0 -74
  198. package/components/Login/socialLogin/index.tsx +0 -407
  199. package/components/Login/socialLogin/style.less +0 -69
  200. package/components/Login/styles.less +0 -53
  201. package/components/MFA/VerifyCodeInput/VerifyCodeFormItem.tsx +0 -41
  202. package/components/MFA/VerifyCodeInput/index.tsx +0 -145
  203. package/components/MFA/VerifyCodeInput/style.less +0 -35
  204. package/components/MFA/codemap.ts +0 -24
  205. package/components/MFA/core/email.tsx +0 -203
  206. package/components/MFA/core/face.tsx +0 -297
  207. package/components/MFA/core/face_deps.tsx +0 -37
  208. package/components/MFA/core/sms.tsx +0 -203
  209. package/components/MFA/core/totp.tsx +0 -122
  210. package/components/MFA/index.tsx +0 -143
  211. package/components/MFA/mfaMethods/index.tsx +0 -88
  212. package/components/MFA/mfaMethods/style.less +0 -39
  213. package/components/MFA/props.ts +0 -51
  214. package/components/MFA/styles.less +0 -100
  215. package/components/NeedHelpView/core/describeQuestions.tsx +0 -245
  216. package/components/NeedHelpView/index.tsx +0 -47
  217. package/components/RecoveryCode/core/useCode.tsx +0 -71
  218. package/components/RecoveryCode/index.tsx +0 -27
  219. package/components/RecoveryCode/interface.ts +0 -31
  220. package/components/RecoveryCode/style.less +0 -13
  221. package/components/Register/codemap.ts +0 -12
  222. package/components/Register/components/Agreements/index.tsx +0 -81
  223. package/components/Register/components/Agreements/style.less +0 -44
  224. package/components/Register/core/WithEmail.tsx +0 -242
  225. package/components/Register/core/WithPhone.tsx +0 -184
  226. package/components/Register/index.tsx +0 -139
  227. package/components/Register/props.ts +0 -50
  228. package/components/SendCode/SendCodeBtn.tsx +0 -96
  229. package/components/SendCode/index.tsx +0 -94
  230. package/components/SendCode/style.less +0 -31
  231. package/components/ShieldSpin/index.tsx +0 -27
  232. package/components/ShieldSpin/loading.svg +0 -29
  233. package/components/SubmitButton/index.tsx +0 -50
  234. package/components/SubmitSuccess/index.tsx +0 -66
  235. package/components/SubmitSuccess/interface.ts +0 -17
  236. package/components/Type/index.ts +0 -52
  237. package/components/ValidatorRules/ValidatorFormItem.tsx +0 -139
  238. package/components/ValidatorRules/index.ts +0 -20
  239. package/components/_utils/GuardErrorCode.ts +0 -9
  240. package/components/_utils/config.ts +0 -116
  241. package/components/_utils/guradHttp.ts +0 -101
  242. package/components/_utils/hooks/index.ts +0 -64
  243. package/components/assets/images/error.png +0 -0
  244. package/components/context/module/context.tsx +0 -23
  245. package/components/index.ts +0 -12
  246. package/examples.tsx +0 -87
  247. package/index.js +0 -1
  248. package/lib/static/media/loading.4a67a5f3.svg +0 -29
  249. package/scripts/publish.js +0 -57
@@ -1,2 +0,0 @@
1
- !function(e){function t(t){for(var n,i,a=t[0],c=t[1],l=t[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);p.length;)p.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,a=1;a<r.length;a++){var c=r[a];0!==o[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"fd17f196"}[e]+".chunk.js"}(e);var c=new Error;u=function(t){a.onerror=a.onload=null,clearTimeout(l);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),u=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,r[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this["webpackJsonp@authing/react-ui-components"]=this["webpackJsonp@authing/react-ui-components"]||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var f=c;r()}([]);
2
- //# sourceMappingURL=runtime-main.ef138021.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["webpack/bootstrap"],"names":["webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","modules","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","1","exports","module","l","e","promises","installedChunkData","promise","Promise","resolve","reject","onScriptComplete","script","document","createElement","charset","timeout","nc","setAttribute","src","p","jsonpScriptSrc","error","Error","event","onerror","onload","clearTimeout","chunk","errorType","type","realSrc","target","message","name","request","undefined","setTimeout","head","appendChild","all","m","c","d","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","oe","err","console","jsonpArray","this","oldJsonpFunction","slice"],"mappings":"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","file":"static/js/runtime-main.ef138021.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tfunction webpackJsonpCallback(data) {\n \t\tvar chunkIds = data[0];\n \t\tvar moreModules = data[1];\n \t\tvar executeModules = data[2];\n\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(Object.prototype.hasOwnProperty.call(installedChunks, chunkId) && installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(data);\n\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n\n \t\t// add entry modules from loaded chunk to deferred list\n \t\tdeferredModules.push.apply(deferredModules, executeModules || []);\n\n \t\t// run deferred modules when all chunks ready\n \t\treturn checkDeferredModules();\n \t};\n \tfunction checkDeferredModules() {\n \t\tvar result;\n \t\tfor(var i = 0; i < deferredModules.length; i++) {\n \t\t\tvar deferredModule = deferredModules[i];\n \t\t\tvar fulfilled = true;\n \t\t\tfor(var j = 1; j < deferredModule.length; j++) {\n \t\t\t\tvar depId = deferredModule[j];\n \t\t\t\tif(installedChunks[depId] !== 0) fulfilled = false;\n \t\t\t}\n \t\t\tif(fulfilled) {\n \t\t\t\tdeferredModules.splice(i--, 1);\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = deferredModule[0]);\n \t\t\t}\n \t\t}\n\n \t\treturn result;\n \t}\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// undefined = chunk not loaded, null = chunk preloaded/prefetched\n \t// Promise = chunk loading, 0 = chunk loaded\n \tvar installedChunks = {\n \t\t1: 0\n \t};\n\n \tvar deferredModules = [];\n\n \t// script path function\n \tfunction jsonpScriptSrc(chunkId) {\n \t\treturn __webpack_require__.p + \"static/js/\" + ({}[chunkId]||chunkId) + \".\" + {\"3\":\"fd17f196\"}[chunkId] + \".chunk.js\"\n \t}\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId) {\n \t\tvar promises = [];\n\n\n \t\t// JSONP chunk loading for javascript\n\n \t\tvar installedChunkData = installedChunks[chunkId];\n \t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n \t\t\t// a Promise means \"currently loading\".\n \t\t\tif(installedChunkData) {\n \t\t\t\tpromises.push(installedChunkData[2]);\n \t\t\t} else {\n \t\t\t\t// setup Promise in chunk cache\n \t\t\t\tvar promise = new Promise(function(resolve, reject) {\n \t\t\t\t\tinstalledChunkData = installedChunks[chunkId] = [resolve, reject];\n \t\t\t\t});\n \t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n \t\t\t\t// start chunk loading\n \t\t\t\tvar script = document.createElement('script');\n \t\t\t\tvar onScriptComplete;\n\n \t\t\t\tscript.charset = 'utf-8';\n \t\t\t\tscript.timeout = 120;\n \t\t\t\tif (__webpack_require__.nc) {\n \t\t\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n \t\t\t\t}\n \t\t\t\tscript.src = jsonpScriptSrc(chunkId);\n\n \t\t\t\t// create error before stack unwound to get useful stacktrace later\n \t\t\t\tvar error = new Error();\n \t\t\t\tonScriptComplete = function (event) {\n \t\t\t\t\t// avoid mem leaks in IE.\n \t\t\t\t\tscript.onerror = script.onload = null;\n \t\t\t\t\tclearTimeout(timeout);\n \t\t\t\t\tvar chunk = installedChunks[chunkId];\n \t\t\t\t\tif(chunk !== 0) {\n \t\t\t\t\t\tif(chunk) {\n \t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n \t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n \t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n \t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n \t\t\t\t\t\t\terror.type = errorType;\n \t\t\t\t\t\t\terror.request = realSrc;\n \t\t\t\t\t\t\tchunk[1](error);\n \t\t\t\t\t\t}\n \t\t\t\t\t\tinstalledChunks[chunkId] = undefined;\n \t\t\t\t\t}\n \t\t\t\t};\n \t\t\t\tvar timeout = setTimeout(function(){\n \t\t\t\t\tonScriptComplete({ type: 'timeout', target: script });\n \t\t\t\t}, 120000);\n \t\t\t\tscript.onerror = script.onload = onScriptComplete;\n \t\t\t\tdocument.head.appendChild(script);\n \t\t\t}\n \t\t}\n \t\treturn Promise.all(promises);\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n \tvar jsonpArray = this[\"webpackJsonp@authing/react-ui-components\"] = this[\"webpackJsonp@authing/react-ui-components\"] || [];\n \tvar oldJsonpFunction = jsonpArray.push.bind(jsonpArray);\n \tjsonpArray.push = webpackJsonpCallback;\n \tjsonpArray = jsonpArray.slice();\n \tfor(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]);\n \tvar parentJsonpFunction = oldJsonpFunction;\n\n\n \t// run deferred modules from other chunks\n \tcheckDeferredModules();\n"],"sourceRoot":""}
@@ -1,29 +0,0 @@
1
- <svg width="100%" height="100%"
2
- viewBox="0 0 150 150" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
3
- <style>
4
- #path-f {
5
- fill: none;
6
- stroke: #eaebee;
7
- stroke-width: 10;
8
- stroke-dasharray: 100 220;
9
- animation: dash 40s infinite linear forwards;
10
- }
11
- #path-b {
12
- fill: none;
13
- stroke: #0080ff;
14
- stroke-width: 8;
15
- stroke-linecap: round;
16
- stroke-linejoin: round;
17
- }
18
- @keyframes dash {
19
- to {
20
- stroke-dashoffset: 12000;
21
- }
22
- }
23
- </style>
24
- <title>Loading</title>
25
- <g id="单独" transform="translate(25.000000, 16.000000)" fill-rule="nonzero" stroke-width="2" >
26
- <path d="M50,0 L0,30 C0,31 0,32 0,33 C0,69 20,100 50,116 C79,100 100,69 100,33 C100,32 99,31 99,30 L50,0 Z" id="path-b"/>
27
- <path d="M50,0 L0,30 C0,31 0,32 0,33 C0,69 20,100 50,116 C79,100 100,69 100,33 C100,32 99,31 99,30 L50,0 Z" id="path-f"/>
28
- </g>
29
- </svg>
@@ -1,72 +0,0 @@
1
- import { Form, Checkbox, Typography } from 'antd'
2
- import React, { useRef } from 'react'
3
- import { useTranslation } from 'react-i18next'
4
- import SubmitButton from '../../SubmitButton'
5
-
6
- const { Paragraph } = Typography
7
-
8
- export interface BindSuccessProps {
9
- onBind: any
10
- secret: string
11
- }
12
-
13
- export const BindSuccess: React.FC<BindSuccessProps> = ({ secret, onBind }) => {
14
- // const [isSaved, setIsSaved] = useState(false)
15
- const submitButtonRef = useRef<any>(null)
16
- const [form] = Form.useForm()
17
-
18
- const { t } = useTranslation()
19
-
20
- const bindSuccess = async () => {
21
- submitButtonRef.current?.onSpin(true)
22
- try {
23
- await form.validateFields()
24
- onBind()
25
- } catch (e: any) {
26
- submitButtonRef.current?.onError()
27
- } finally {
28
- submitButtonRef.current?.onSpin(false)
29
- }
30
- }
31
-
32
- return (
33
- <>
34
- <p className="authing-g2-mfa-title">{t('common.totpText1')}</p>
35
- <p className="authing-g2-mfa-tips">{t('common.totpText2')}</p>
36
-
37
- <div className="g2-mfa-bindTotp-copySecret">
38
- <Paragraph copyable>{secret}</Paragraph>
39
- </div>
40
-
41
- <Form
42
- form={form}
43
- onFinish={bindSuccess}
44
- style={{ width: '100%' }}
45
- onFinishFailed={() => submitButtonRef.current?.onError()}
46
- >
47
- <Form.Item
48
- className="authing-g2-input-form g2-mfa-totp-verify-input"
49
- name="remember"
50
- rules={[
51
- {
52
- validator: (_, value) => {
53
- console.log(value)
54
- if (!value) {
55
- return Promise.reject(t('common.pleaseRecordKey'))
56
- }
57
- return Promise.resolve()
58
- },
59
- },
60
- ]}
61
- valuePropName="checked"
62
- >
63
- <Checkbox className="g2-mfa-bindTotp-secretSave">
64
- {t('login.rememberedSecret')}
65
- </Checkbox>
66
- </Form.Item>
67
-
68
- <SubmitButton text={t('common.bindSuccess')} ref={submitButtonRef} />
69
- </Form>
70
- </>
71
- )
72
- }
@@ -1,108 +0,0 @@
1
- import { Form, message } from 'antd'
2
- import React, { useRef } from 'react'
3
- import { useTranslation } from 'react-i18next'
4
- import { useAsyncFn } from 'react-use'
5
-
6
- import { GuardModuleType } from '../../Guard/module'
7
- import { useGuardHttp } from '../../_utils/guradHttp'
8
- import SubmitButton from '../../SubmitButton'
9
- import { ImagePro } from '../../ImagePro'
10
- import { VerifyCodeFormItem } from '../../MFA/VerifyCodeInput/VerifyCodeFormItem'
11
- import { VerifyCodeInput } from '../../MFA/VerifyCodeInput'
12
- export interface SecurityCodeProps {
13
- mfaToken: string
14
- qrcode: string
15
- onNext: any
16
- changeModule: any
17
- }
18
-
19
- export const SecurityCode: React.FC<SecurityCodeProps> = ({
20
- mfaToken,
21
- qrcode,
22
- onNext,
23
- changeModule,
24
- }) => {
25
- const [form] = Form.useForm()
26
- const submitButtonRef = useRef<any>(null)
27
-
28
- const { t } = useTranslation()
29
-
30
- const { post } = useGuardHttp()
31
-
32
- const onJump = () => {
33
- changeModule?.(GuardModuleType.DOWNLOAD_AT)
34
- }
35
-
36
- const [, bindTotp] = useAsyncFn(async () => {
37
- submitButtonRef.current.onSpin(true)
38
-
39
- try {
40
- await form.validateFields()
41
- const saftyCode = form.getFieldValue('saftyCode')
42
-
43
- const { code, data, message: resMessage } = await post(
44
- '/api/v2/mfa/totp/associate/confirm',
45
- {
46
- authenticator_type: 'totp',
47
- totp: saftyCode.join(''),
48
- source: 'APPLICATION',
49
- },
50
- {
51
- headers: {
52
- authorization: mfaToken,
53
- },
54
- }
55
- )
56
-
57
- if (code !== 200) {
58
- submitButtonRef.current.onError()
59
- message.error(resMessage)
60
- } else {
61
- onNext(data)
62
- }
63
- } catch (e: any) {
64
- submitButtonRef.current.onError()
65
- } finally {
66
- submitButtonRef.current?.onSpin(false)
67
- }
68
- }, [mfaToken])
69
-
70
- return (
71
- <>
72
- <p className="authing-g2-mfa-title">{t('user.mfaBind')}</p>
73
- <p
74
- className="authing-g2-mfa-tips"
75
- style={{
76
- textAlign: 'left',
77
- }}
78
- >
79
- {t('common.usePhoneOpen')} Google Authenticator or Microsoft
80
- Authenticator({t('common.noValidator')}{' '}
81
- <span
82
- style={{
83
- color: '#396AFF',
84
- cursor: 'pointer',
85
- }}
86
- onClick={onJump}
87
- >
88
- {t('common.clickTodownload')}
89
- </span>
90
- ) {t('common.mfaText1')}
91
- </p>
92
- <ImagePro className="g2-mfa-bindTotp-qrcode" src={qrcode} alt="qrcode" />
93
- <Form
94
- className="g2-mfa-bindTotp-securityCode-form"
95
- form={form}
96
- onSubmitCapture={() => {}}
97
- onFinish={bindTotp}
98
- onFinishFailed={() => submitButtonRef.current.onError()}
99
- >
100
- <VerifyCodeFormItem codeLength={6} name="saftyCode">
101
- <VerifyCodeInput length={6} showDivider={true} gutter={'10px'} />
102
- </VerifyCodeFormItem>
103
- <p>{t('user.numberSafteyCode')}</p>
104
- <SubmitButton text={t('user.nextStep')} ref={submitButtonRef} />
105
- </Form>
106
- </>
107
- )
108
- }
@@ -1,134 +0,0 @@
1
- import { message } from 'antd'
2
- import { User } from 'authing-js-sdk'
3
- import React, { useEffect, useMemo, useState } from 'react'
4
- import { useAsyncFn } from 'react-use'
5
- import { ErrorCode } from '../_utils/GuardErrorCode'
6
- import { useGuardHttp } from '../_utils/guradHttp'
7
- import { useAuthClient } from '../Guard/authClient'
8
- import { GuardModuleType } from '../Guard/module'
9
- import { IconFont } from '../IconFont'
10
- import { ShieldSpin, Spin } from '../ShieldSpin'
11
- import { BindSuccess } from './core/bindSuccess'
12
- import { SecurityCode } from './core/securityCode'
13
- import { GuardBindTotpViewProps } from './interface'
14
- import { useTranslation } from 'react-i18next'
15
- import './styles.less'
16
- const window: Window = require('global/window')
17
-
18
- enum BindTotpType {
19
- SECURITY_CODE = 'securityCode',
20
- BIND_SUCCESS = 'bindSuccess',
21
- }
22
-
23
- export const GuardBindTotpView: React.FC<GuardBindTotpViewProps> = ({
24
- config: GuardLocalConfig,
25
- initData,
26
- onLogin,
27
- __changeModule,
28
- }) => {
29
- const { get, post } = useGuardHttp()
30
- const { t } = useTranslation()
31
- const [secret, setSecret] = useState('')
32
- const [qrcode, setQrcode] = useState('')
33
- const [user, setUser] = useState<User>()
34
- const [bindTotpType, setBindTotpType] = useState<BindTotpType>(
35
- BindTotpType.SECURITY_CODE
36
- )
37
-
38
- const authClient = useAuthClient()
39
-
40
- const [bindInfo, fetchBindInfo] = useAsyncFn(async () => {
41
- const query = {
42
- type: 'totp',
43
- source: 'APPLICATION',
44
- }
45
- const config = {
46
- headers: {
47
- authorization: initData.mfaToken,
48
- },
49
- }
50
-
51
- try {
52
- const { data } = await get<any>(
53
- `/api/v2/mfa/authenticator`,
54
- query,
55
- config
56
- )
57
-
58
- if (data.code === ErrorCode.LOGIN_INVALID) {
59
- message.error(data.message)
60
- __changeModule?.(GuardModuleType.LOGIN, {})
61
- return
62
- }
63
- } catch (error: any) {
64
- message.error(error?.message)
65
- }
66
-
67
- const { data } = await post<any>(
68
- '/api/v2/mfa/totp/associate',
69
- query,
70
- config
71
- )
72
-
73
- setSecret(data.recovery_code)
74
- setQrcode(data.qrcode_data_url)
75
- }, [initData.mfaToken])
76
-
77
- const onBind = () => {
78
- if (user) onLogin?.(user, authClient)
79
- }
80
-
81
- const onNext = (user: User) => {
82
- setUser(user)
83
- setBindTotpType(BindTotpType.BIND_SUCCESS)
84
- }
85
-
86
- useEffect(() => {
87
- fetchBindInfo()
88
- }, [fetchBindInfo])
89
-
90
- const renderContent = useMemo<
91
- Record<BindTotpType, (props: any) => React.ReactNode>
92
- >(
93
- () => ({
94
- [BindTotpType.SECURITY_CODE]: (props) => <SecurityCode {...props} />,
95
- [BindTotpType.BIND_SUCCESS]: (props) => <BindSuccess {...props} />,
96
- }),
97
- []
98
- )
99
-
100
- const onBack = () => {
101
- window.history.back()
102
- }
103
-
104
- return (
105
- <>
106
- {bindInfo.loading ? (
107
- <Spin />
108
- ) : (
109
- <div className="g2-view-container">
110
- <div className="g2-view-back">
111
- <span onClick={onBack}>
112
- <IconFont type="authing-back" />
113
- <span>{t('common.backToVerify')}</span>
114
- </span>
115
- </div>
116
- <div className="g2-mfa-content g2-mfa-bindTotp">
117
- {bindInfo.loading ? (
118
- <ShieldSpin />
119
- ) : (
120
- renderContent[bindTotpType]({
121
- mfaToken: initData.mfaToken,
122
- qrcode,
123
- secret,
124
- onBind,
125
- onNext,
126
- changeModule: __changeModule,
127
- })
128
- )}
129
- </div>
130
- </div>
131
- )}
132
- </>
133
- )
134
- }
@@ -1,30 +0,0 @@
1
- import { getDefaultG2Config, IG2Config, IG2Events, IG2FCProps } from '../Type'
2
- import { AuthenticationClient, User } from '..'
3
- import { GuardMFAInitData } from '../MFA/props'
4
-
5
- export interface BindTotpConfig extends IG2Config {}
6
-
7
- const defaultConfig: BindTotpConfig = {
8
- ...getDefaultG2Config(),
9
- }
10
-
11
- export const getDefaultMFAConfig = (): BindTotpConfig => ({
12
- ...getDefaultG2Config(),
13
- ...defaultConfig,
14
- })
15
-
16
- export interface BindTotpEvents extends IG2Events {
17
- onLogin?: (user: User, authClient: AuthenticationClient) => void
18
- }
19
-
20
- export interface GuardBindTotpInitData extends GuardMFAInitData {}
21
-
22
- export interface GuardBindTotpProps extends IG2FCProps, BindTotpEvents {
23
- config: Partial<BindTotpConfig>
24
- initData: GuardBindTotpInitData
25
- }
26
-
27
- export interface GuardBindTotpViewProps extends GuardBindTotpProps {
28
- config: BindTotpConfig
29
- initData: GuardBindTotpInitData
30
- }
@@ -1,57 +0,0 @@
1
- .g2-mfa-bindTotp {
2
- display: flex;
3
- flex-direction: column;
4
- align-items: center;
5
- height: 100%;
6
-
7
- .g2-mfa-bindTotp-copySecret {
8
- width: 100%;
9
- height: 48px;
10
- display: flex;
11
- justify-content: center;
12
- align-items: center;
13
- background: #f5f6f7;
14
- border-radius: 4px;
15
-
16
- .authing-ant-typography {
17
- margin: 0;
18
-
19
- svg {
20
- color: #878a95 !important;
21
- margin-left: 30px;
22
- }
23
- }
24
- }
25
- .g2-mfa-bindTotp-secretSave {
26
- margin-top: 16px;
27
- }
28
-
29
- .g2-mfa-submit-button {
30
- margin-top: 80px !important;
31
- }
32
-
33
- .g2-mfa-bindTotp-qrcode {
34
- box-shadow: 0px 0px 30px rgba(84, 89, 104, 0.15);
35
- border-radius: 4px;
36
- }
37
-
38
- .g2-mfa-bindTotp-securityCode-form {
39
- display: flex;
40
- flex-direction: column;
41
- align-items: center;
42
-
43
- .g2-mfa-submit-button {
44
- margin-top: 64px !important;
45
- }
46
-
47
- .g2-mfa-totp-verify-input {
48
- text-align: center;
49
- margin-bottom: 8px !important;
50
- margin-top: 40px !important;
51
- }
52
-
53
- p {
54
- color: #878a95;
55
- }
56
- }
57
- }
@@ -1,35 +0,0 @@
1
- import React from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { IconFont } from '../IconFont'
4
- import { changeLang } from '../_utils/locales'
5
-
6
- export const ChangeLanguage = (props: any) => {
7
- const { i18n } = useTranslation()
8
- if (props.langRange.length <= 1) {
9
- return <></>
10
- }
11
-
12
- let switchText = '简体中文'
13
- if (i18n.language === 'en-US') {
14
- switchText = 'English'
15
- }
16
- return (
17
- <div className="g2-change-language-container">
18
- <span
19
- className="g2-change-language-button"
20
- onClick={() => {
21
- if (i18n.language === 'zh-CN') {
22
- changeLang('en-US')
23
- props.onLangChange?.('en-US')
24
- } else if (i18n.language === 'en-US') {
25
- changeLang('zh-CN')
26
- props.onLangChange?.('zh-CN')
27
- }
28
- }}
29
- >
30
- <IconFont type="authing-global-line" />
31
- <span className="g2-change-language-text">{switchText}</span>
32
- </span>
33
- </div>
34
- )
35
- }
@@ -1,111 +0,0 @@
1
- import React, { useRef } from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { Form, Input, message } from 'antd'
4
-
5
- import { LockOutlined } from '@ant-design/icons'
6
-
7
- import { useAuthClient } from '../../Guard/authClient'
8
- import { getPasswordValidate } from '../../_utils'
9
- import SubmitButton from '../../SubmitButton'
10
-
11
- interface FirstLoginResetProps {
12
- onReset: any
13
- publicConfig: any
14
- initData: any
15
- }
16
- export const FirstLoginReset = (props: FirstLoginResetProps) => {
17
- const { t } = useTranslation()
18
- let [form] = Form.useForm()
19
- let client = useAuthClient()
20
- let submitButtonRef = useRef<any>(null)
21
-
22
- const onFinish = async (values: any) => {
23
- let newPassword = values.password
24
- submitButtonRef.current?.onSpin(false)
25
- try {
26
- let res = await client.resetPasswordByFirstLoginToken({
27
- token: props.initData.token,
28
- password: newPassword,
29
- })
30
- props.onReset(res)
31
- } catch (error) {
32
- message.error(error.message)
33
- submitButtonRef?.current?.onError()
34
- } finally {
35
- submitButtonRef.current?.onSpin(false)
36
- }
37
- }
38
-
39
- return (
40
- <div className="authing-g2-login-phone-code">
41
- <Form
42
- name="resetPassword"
43
- form={form}
44
- onFinish={onFinish}
45
- onFinishFailed={() => {
46
- submitButtonRef?.current?.onError()
47
- }}
48
- autoComplete="off"
49
- >
50
- <Form.Item
51
- className="authing-g2-input-form"
52
- name="password"
53
- rules={[
54
- {
55
- validator(_, value) {
56
- if (value && value.indexOf(' ') !== -1) {
57
- return Promise.reject(t('common.checkPasswordHasSpace'))
58
- }
59
- return Promise.resolve()
60
- },
61
- },
62
- ...getPasswordValidate(
63
- props.publicConfig?.passwordStrength,
64
- props.publicConfig?.customPasswordStrength
65
- ),
66
- ]}
67
- >
68
- <Input.Password
69
- className="authing-g2-input"
70
- size="large"
71
- placeholder={t('login.inputPwd')}
72
- prefix={<LockOutlined style={{ color: '#878A95' }} />}
73
- />
74
- </Form.Item>
75
- <Form.Item
76
- className="authing-g2-input-form"
77
- name="password2"
78
- rules={[
79
- {
80
- validator(_, value) {
81
- let pwd = form.getFieldValue('password')
82
- if (!value) {
83
- return Promise.reject(t('login.inputPwd'))
84
- }
85
- if (value !== pwd) {
86
- return Promise.reject(t('common.repeatPasswordDoc'))
87
- }
88
- return Promise.resolve()
89
- },
90
- },
91
- ]}
92
- >
93
- <Input.Password
94
- className="authing-g2-input"
95
- size="large"
96
- placeholder={t('login.inputPwdAgain')}
97
- prefix={<LockOutlined style={{ color: '#878A95' }} />}
98
- />
99
- </Form.Item>
100
-
101
- <Form.Item className="authing-g2-input-form submit-form">
102
- <SubmitButton
103
- className="forget-password"
104
- text={t('common.confirm')}
105
- ref={submitButtonRef}
106
- />
107
- </Form.Item>
108
- </Form>
109
- </div>
110
- )
111
- }