1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
"use strict";(self.webpackChunkkeycloakify=self.webpackChunkkeycloakify||[]).push([[8402],{"./dist/account/pages/Totp.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>Totp});__webpack_require__("./node_modules/core-js/modules/es.object.assign.js"),__webpack_require__("./node_modules/core-js/modules/es.array.map.js");var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/react/jsx-runtime.js"),_tools_clsx__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./dist/tools/clsx.js"),_account_lib_kcClsx__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./dist/account/lib/kcClsx.js"),_lib_kcSanitize__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./dist/lib/kcSanitize/index.js");function Totp(props){var _a,kcContext=props.kcContext,i18n=props.i18n,doUseDefaultCss=props.doUseDefaultCss,Template=props.Template,classes=props.classes,kcClsx=(0,_account_lib_kcClsx__WEBPACK_IMPORTED_MODULE_4__.$)({doUseDefaultCss,classes}).kcClsx,totp=kcContext.totp,mode=kcContext.mode,url=kcContext.url,messagesPerField=kcContext.messagesPerField,stateChecker=kcContext.stateChecker,msg=i18n.msg,msgStr=i18n.msgStr,advancedMsg=i18n.advancedMsg;return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)(Template,Object.assign({},{kcContext,i18n,doUseDefaultCss,classes},{active:"totp"},{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",Object.assign({className:"row"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",Object.assign({className:"col-md-10"},{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("h2",{children:msg("authenticatorTitle")})})),0===totp.otpCredentials.length&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",Object.assign({className:"subtitle col-md-2"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",Object.assign({className:"required"},{children:"*"})),msg("requiredFields")]}))]})),totp.enabled&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("table",Object.assign({className:"table table-bordered table-striped"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("thead",{children:totp.otpCredentials.length>1?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("tr",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("th",Object.assign({colSpan:4},{children:msg("configureAuthenticators")}))}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("tr",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("th",Object.assign({colSpan:3},{children:msg("configureAuthenticators")}))})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("tbody",{children:totp.otpCredentials.map((function(credential,index){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("tr",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("td",Object.assign({className:"provider"},{children:msg("mobile")})),totp.otpCredentials.length>1&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("td",Object.assign({className:"provider"},{children:credential.id})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("td",Object.assign({className:"provider"},{children:credential.userLabel||""})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("td",Object.assign({className:"action"},{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("form",Object.assign({action:url.totpUrl,method:"post",className:"form-inline"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{type:"hidden",id:"stateChecker",name:"stateChecker",value:stateChecker}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{type:"hidden",id:"submitAction",name:"submitAction",value:"Delete"}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{type:"hidden",id:"credentialId",name:"credentialId",value:credential.id}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button",Object.assign({id:"remove-mobile-"+index,className:"btn btn-default"},{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("i",{className:"pficon pficon-delete"})}))]}))}))]},index)}))})]})),!totp.enabled&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("ol",Object.assign({id:"kc-totp-settings"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:msg("totpStep1")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("ul",Object.assign({id:"kc-totp-supported-apps"},{children:null===(_a=totp.supportedApplications)||void 0===_a?void 0:_a.map((function(app){return(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("li",{children:advancedMsg(app)},app)}))}))]}),mode&&"manual"==mode?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.Fragment,{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:msg("totpManualStep2")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",Object.assign({id:"kc-totp-secret-key"},{children:totp.totpSecretEncoded}))}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("a",Object.assign({href:totp.qrUrl,id:"mode-barcode"},{children:msg("totpScanBarcode")}))})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:msg("totpManualStep3")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("ul",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",Object.assign({id:"kc-totp-type"},{children:[msg("totpType"),": ",msg("totp."+totp.policy.type)]})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",Object.assign({id:"kc-totp-algorithm"},{children:[msg("totpAlgorithm"),": ",totp.policy.getAlgorithmKey()]})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",Object.assign({id:"kc-totp-digits"},{children:[msg("totpDigits"),": ",totp.policy.digits]})),"totp"===totp.policy.type?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",Object.assign({id:"kc-totp-period"},{children:[msg("totpInterval"),": ",totp.policy.period]})):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",Object.assign({id:"kc-totp-counter"},{children:[msg("totpCounter"),": ",totp.policy.initialCounter]}))]})]})]}):(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:msg("totpStep2")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("img",{id:"kc-totp-secret-qr-code",src:"data:image/png;base64, "+totp.totpSecretQrCode,alt:"Figure: Barcode"})}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("a",Object.assign({href:totp.manualUrl,id:"mode-manual"},{children:msg("totpUnableToScan")}))})]}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("li",{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:msg("totpStep3")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("p",{children:msg("totpStep3DeviceName")})]})]})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("hr",{}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("form",Object.assign({action:url.totpUrl,className:kcClsx("kcFormClass"),id:"kc-totp-settings-form",method:"post"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{type:"hidden",id:"stateChecker",name:"stateChecker",value:stateChecker}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",Object.assign({className:kcClsx("kcFormGroupClass")},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",Object.assign({className:"col-sm-2 col-md-2"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("label",Object.assign({htmlFor:"totp",className:"control-label"},{children:msg("authenticatorCode")})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",Object.assign({className:"required"},{children:"*"}))]})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",Object.assign({className:"col-sm-10 col-md-10"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{type:"text",id:"totp",name:"totp",autoComplete:"off",className:kcClsx("kcInputClass"),"aria-invalid":messagesPerField.existsError("totp")}),messagesPerField.existsError("totp")&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{id:"input-error-otp-code",className:kcClsx("kcInputErrorMessageClass"),"aria-live":"polite",dangerouslySetInnerHTML:{__html:(0,_lib_kcSanitize__WEBPACK_IMPORTED_MODULE_5__.p)(messagesPerField.get("totp"))}})]})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{type:"hidden",id:"totpSecret",name:"totpSecret",value:totp.totpSecret}),mode&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{type:"hidden",id:"mode",value:mode})]})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",Object.assign({className:kcClsx("kcFormGroupClass")},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",Object.assign({className:"col-sm-2 col-md-2"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("label",Object.assign({htmlFor:"userLabel",className:kcClsx("kcLabelClass")},{children:msg("totpDeviceName")})),totp.otpCredentials.length>=1&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",Object.assign({className:"required"},{children:"*"}))]})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",Object.assign({className:"col-sm-10 col-md-10"},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{type:"text",id:"userLabel",name:"userLabel",autoComplete:"off",className:kcClsx("kcInputClass"),"aria-invalid":messagesPerField.existsError("userLabel")}),messagesPerField.existsError("userLabel")&&(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("span",{id:"input-error-otp-label",className:kcClsx("kcInputErrorMessageClass"),"aria-live":"polite",dangerouslySetInnerHTML:{__html:(0,_lib_kcSanitize__WEBPACK_IMPORTED_MODULE_5__.p)(messagesPerField.get("userLabel"))}})]}))]})),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("div",Object.assign({id:"kc-form-buttons",className:(0,_tools_clsx__WEBPACK_IMPORTED_MODULE_3__.W)(kcClsx("kcFormGroupClass"),"text-right")},{children:(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsxs)("div",Object.assign({className:kcClsx("kcInputWrapperClass")},{children:[(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("input",{type:"submit",className:kcClsx("kcButtonClass","kcButtonPrimaryClass","kcButtonLargeClass"),id:"saveTOTPBtn",value:msgStr("doSave")}),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_2__.jsx)("button",Object.assign({type:"submit",className:kcClsx("kcButtonClass","kcButtonDefaultClass","kcButtonLargeClass","kcButtonLargeClass"),id:"cancelTOTPBtn",name:"submitAction",value:"Cancel"},{children:msg("doCancel")}))]}))}))]}))]})]})}))}}}]); |