PageSourceSearch

https://app.usehabits.com/_next/static/chunks/pages/shared/forgot-password-reset-b7b65575ddd95508.js

js usehabits.com collected 2026-10-01 15:50:00 UTC 11,938 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2457],{18868:(e,s,t)=>{"use strict";t.d(s,{A:()=>p});var r=t(14232),a=t(21379),o=t(59198),l=t(50679),i=t(47139),n=t(61812),d=t(30248),c=t(62896),m=t(37876);let p=e=>{let{password:s,setPassword:t,label:p="Password",isRegistration:u=!1,errorMessage:x="",disabled:f=!1,onStrengthChange:h=()=>{},inputId:g,autoComplete:w="current-password",className:b=""}=e,{0:v,1:N}=(0,r.useState)(!1),{0:j,1:y}=(0,r.useState)(!1),P=(0,r.useId)(),{resolvedTheme:O}=(0,a.D)(),C="dark"===O,R=g||P,S=`${R}-error`,k=`${R}-strength`,A=/[a-z]/.test(s),E=/[A-Z]/.test(s),$=/[0-9]/.test(s),F=/[!@#$%^&*(),.?":{}|<>]/.test(s),_=s.length>=8,I=[A,E,$,F,_].filter(Boolean).length,D="WEAK";5===I?D="STRONG":I>=3&&(D="MEDIUM");let U=s.length>=4,B=[["1 Lowercase character",A],["1 Uppercase character",E],["1 Special character",F],["1 Number",$],["8 Character minimum",_]];return(0,r.useEffect)(()=>{u&&h("STRONG"===D)},[D,h,u]),(0,m.jsxs)("div",{className:(0,c.cn)("relative mt-4 flex w-full flex-col gap-1 sm:mt-5 sm:gap-2",b),children:[(0,m.jsxs)("div",{className:"relative flex w-full flex-col",children:[(0,m.jsx)(d.JU,{htmlFor:R,className:d.ZP,style:{color:j?"var(--label-focused-text)":"var(--label-text)"},children:p}),(0,m.jsxs)("div",{className:"relative w-full",children:[(0,m.jsx)(n.p,{id:R,type:v?"text":"password",placeholder:p,className:(0,c.cn)("peer mt-1 h-[40px] w-full rounded-xl px-3 py-2 pr-12 text-sm transition-all duration-200 ease-in-out sm:h-[48px] sm:px-4 sm:py-3 sm:text-base"),style:{background:j?C?"var(--surface-radial-dark)":"#FFFFFF":"#6A6A6A26",color:"var(--color-text)",border:x?"1px solid #EF4444":C?"1px solid #6A6A6A":"1px solid var(--color-input-bg)",boxShadow:j?"0px 0px 20px rgba(0, 0, 0, 0.05)":"none",backdropFilter:j?"blur(14px)":"none"},value:s,disabled:f,onFocus:()=>y(!0),onBlur:()=>y(!1),onChange:e=>t(e.target.value),"aria-invalid":!!x,"aria-describedby":[U&&u?k:null,x?S:null].filter(Boolean).join(" ")||void 0,autoComplete:w}),!f&&(0,m.jsx)("button",{type:"button",className:"focus-visible:ring-habitsgreen absolute top-1/2 right-2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-md hover:text-green-500 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none sm:right-3",style:{color:"var(--input-placeholder)"},onClick:()=>N(!v),"aria-label":`${v?"Hide":"Show"} ${p}`,children:v?(0,m.jsx)(o.yMb,{size:18,className:"cursor-pointer sm:h-5 sm:w-5","aria-hidden":"true"}):(0,m.jsx)(o.rs7,{size:18,className:"cursor-pointer sm:h-5 sm:w-5","aria-hidden":"true"})})]})]}),u&&U&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"mt-2 flex w-full items-center px-2 sm:px-4",children:[(0,m.jsx)("div",{className:"flex flex-1 gap-1 sm:gap-2","aria-hidden":"true",children:[,,,,,].fill(0).map((e,s)=>(0,m.jsx)("div",{className:"h-[4px] flex-1 rounded-full transition-all sm:h-[6px]",style:{backgroundColor:I>s?I<=2?"var(--strength-bar-weak)":I<=3?"var(--strength-bar-medium)":"var(--strength-bar-strong)":"var(--strength-bar-bg)"}},s))}),(0,m.jsxs)("span",{id:k,className:"ml-2 flex items-center gap-1 rounded-lg border px-1.5 py-0.5 text-[10px] font-bold uppercase sm:px-2 sm:py-1 sm:text-xs","aria-live":"polite",style:{backgroundColor:"var(--badge-bg)",borderColor:`var(--badge-${D.toLowerCase()}-border)`,color:`var(--badge-${D.toLowerCase()}-text)`},children:["WEAK"===D&&(0,m.jsx)(i.ItP,{className:"text-xs sm:text-sm","aria-hidden":"true"}),"MEDIUM"===D&&(0,m.jsx)(o.jDV,{className:"text-xs sm:text-sm","aria-hidden":"true"}),"STRONG"===D&&(0,m.jsx)(l.A7C,{className:"text-xs sm:text-sm","aria-hidden":"true"}),(0,m.jsx)("span",{className:"sr-only",children:"Password strength: "}),D]})]}),(0,m.jsx)("ul",{className:"password-criteria-list mt-2 text-xs sm:text-sm",children:B.map((e,s)=>{let[t,r]=e;return(0,m.jsxs)("li",{className:"flex min-w-0 items-start",children:[r?(0,m.jsx)(l.A7C,{className:"mt-0.5 mr-1.5 flex-shrink-0 sm:mr-2",style:{color:"var(--password-criteria-list-check-icon-active)"},"aria-hidden":"true"}):(0,m.jsx)(l.EaG,{className:"mt-0.5 mr-1.5 flex-shrink-0 sm:mr-2",style:{color:"var(--password-criteria-list-check-icon-inactive)"},"aria-hidden":"true"}),(0,m.jsxs)("span",{children:[(0,m.jsx)("span",{className:"sr-only",children:r?"Met: ":"Not met: "}),t]})]},s)})})]}),x&&(0,m.jsx)("p",{id:S,className:"mt-1 pl-2 text-xs sm:mt-2 sm:pl-4 sm:text-sm",style:{color:"var(--error-color)"},role:"alert",children:x})]})}},55352:(e,s,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/shared/forgot-password-reset",function(){return t(82358)}])},61812:(e,s,t)=>{"use strict";t.d(s,{p:()=>c});var r=t(66284),a=t(59860),o=t(14232),l=t(62896),i=t(37876);let n=["className","type"];function d(e,s){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);s&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),t.push.apply(t,r)}return t}let c=o.forwardRef((e,s)=>{let{className:t,type:o}=e,c=(0,a.A)(e,n);return(0,i.jsx)("input",function(e){for(var s=1;s<arguments.length;s++){var t=null!=arguments[s]?arguments[s]:{};
1s%2?d(Object(t),!0).forEach(function(s){(0,r.A)(e,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):d(Object(t)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(t,s))})}return e}({type:o,className:(0,l.cn)("border-input bg-background ring-offset-background file:text-foreground placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",t),ref:s},c))});c.displayName="Input"},82358:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>w});var r=t(14232),a=t(89099),o=t(54587),l=t.n(o),i=t(21379),n=t(18868),d=t(95517),c=t(31442),m=t(84213),p=t(59688),u=t(86788),x=t(39117),f=t(95499),h=t(62896),g=t(37876);let w=()=>{let e=(0,a.useRouter)(),s=e.query.email,t=e.isReady,o=e.replace,{resolvedTheme:w}=(0,i.D)(),{0:b,1:v}=(0,r.useState)(""),{0:N,1:j}=(0,r.useState)(""),{0:y,1:P}=(0,r.useState)(""),{0:O,1:C}=(0,r.useState)(""),{0:R,1:S}=(0,r.useState)(""),{0:k,1:A}=(0,r.useState)(!1),{0:E,1:$}=(0,r.useState)(!1),{0:F,1:_}=(0,r.useState)(!1),I=y===O&&""!==y;(0,r.useEffect)(()=>{if(t)if((0,u.O)(x.s6.DEBUG,`🔍 [ForgotPasswordReset] Query params - emailParam: "${s}"`),s){let e=decodeURIComponent(s),t=f.S.getSession("forgot_password_pin"),r=t?String(t):null;(0,u.O)(x.s6.DEBUG,`🔍 [ForgotPasswordReset] Decoded email: "${e}", PIN from session: "${r?"***":"NOT FOUND"}" (type: ${typeof r}, length: ${r?.length})`),e&&r?(v(e),j(r)):((0,u.O)(x.s6.WARN,`⚠️ [ForgotPasswordReset] Missing email or PIN - email: ${!!e}, pin: ${!!t}`),o("/shared/forgot-password"))}else(0,u.O)(x.s6.WARN,`⚠️ [ForgotPasswordReset] Missing email param`),o("/shared/forgot-password")},[s,t,o]);let D=async s=>{if(s?.preventDefault(),S(""),A(!1),!N){S("Invalid PIN. Please try again."),e.push(`/shared/forgot-password-pin?email=${encodeURIComponent(b)}`);return}_(!0);try{let s=String(N);(0,u.O)(x.s6.DEBUG,`🔍 [ForgotPasswordReset] Calling confirmForgotPassword with - email: "${b}", pin: "${s}" (type: ${typeof s}, length: ${s?.length}), password length: ${y?.length}`);let t=await (0,c.tQ)(b,s,y);if((0,u.O)(x.s6.DEBUG,`🔍 [ForgotPasswordReset] confirmForgotPassword result: ${JSON.stringify(t)}`),!t||!0!==t.success&&!t.$metadata)throw(0,u.O)(x.s6.ERROR,`❌ [ForgotPasswordReset] Password reset may have failed - unexpected result: ${JSON.stringify(t)}`),Error("Password reset failed. Please try again.");f.S.removeSession("forgot_password_pin"),(0,u.O)(x.s6.DEBUG,`✅ [ForgotPasswordReset] PIN cleared from session storage`),p.oR.success("Password reset successfully! Redirecting to login...",{duration:8e3}),setTimeout(()=>{e.push("/shared/login")},5e3)}catch(s){console.error("Forgot password error:",s),_(!1),f.S.removeSession("forgot_password_pin"),(0,u.O)(x.s6.DEBUG,`🧹 [ForgotPasswordReset] PIN cleared due to error`),"CodeMismatchException"===s.name?(S("Incorrect PIN entered. Please try again."),A(!0),e.push(`/shared/forgot-password-pin?email=${encodeURIComponent(b)}`)):"ExpiredCodeException"===s.name?(S("Verification code has expired. Request a new one."),A(!0),e.push(`/shared/forgot-password?email=${encodeURIComponent(b)}`)):S(s.message||"An error occurred.")}};return b&&N?(0,g.jsxs)("div",{className:"w-full self-start",children:[(0,g.jsx)(m.A,{title:"Create New Password",showBackButton:!0}),(0,g.jsx)("main",{className:"flex w-full flex-1 flex-col items-center justify-start px-4 pt-4 pb-8 lg:pt-5",children:(0,g.jsxs)("div",{className:"flex w-full max-w-[510px] flex-col items-center gap-6",children:[(0,g.jsx)("div",{className:"relative h-28 w-28",children:(0,g.jsx)(l(),{src:"/assets/images/new-password.png",alt:"",width:112,height:112,priority:!0})}),(0,g.jsxs)("div",{className:"w-full text-center",children:[(0,g.jsx)("h1",{className:"text-habitsgreen text-3xl leading-tight font-medium sm:text-4xl sm:leading-[48px]",children:"Create a new password"}),(0,g.jsx)("p",{className:"mt-3 text-base leading-7 text-[var(--paragraph-text)] sm:text-lg",children:"Your email is verified. Choose a secure password that is different from your previous one."})]}),(0,g.jsxs)("form",{className:"w-full",onSubmit:D,noValidate:!0,children:[(0,g.jsx)("input",{type:"email",name:"username",autoComplete:"username",value:b,readOnly:!0,className:"sr-only",tabIndex:-1,"aria-label":"Account email"}),(0,g.jsxs)("div",{className:(0,h.cn)("w-full rounded-[20px] border p-5 shadow-[0px_0px_40px_rgba(0,0,0,0.05)] backdrop-blur-[21px] sm:p-6","dark"===w?"border-white/10 bg-white/5 shadow-[0px_5px_39px_rgba(0,0,0,0.06)] backdrop-blur-[14.5px]":"border-white bg-white/20"),children:[(0,g.jsx)(n.A,{password:y,setPassword:P,label:"New Password",inputId:"forgot-password-new",autoComplete:"new-password",isRegistration:!0,onStrengthChange:$,disabled:F,className:"!mt-0"}),(0,g.jsx)(n.A,{password:O,setPassword:C,label:"Confirm New Password",inputId:"forgot-password-confirm",autoComplete:"new-password",disabled:F,errorMessage:O&&!I?"Passwords do not match.":""}),R?(0,g.jsx)("p",{className:"mt-3 text-center text-sm text-red-500",role:"alert",children:R}):null]}),(0,g.jsx)("div",{className:"mt-5 w-full",children:k?(0,g.jsx)(d.A,{type:"button",onClick:()=>e.push(`/shared/forgot-password-pin?email=${encodeURIComponent(b)}`),className:"h-14 w-full rounded-lg bg-[#FF6347] px-6 text-lg font-medium text-white transition hover:bg-[#ff4d2e]",children:"Try Again"}):(0,g.jsx)(d.A,{type:"submit",disabled:!(E&&I)||F,className:"h-14 w-full rounded-lg px-6 text-lg font-medium transition",children:F?(0,g.jsxs)("div",{className:"flex items-center justify-center space-x-2",children:[(0,g.jsx)("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-white border-t-transparent","aria-hidden":"true"}),(0,g.jsx)("span",{children:"Resetting Password..."})]}):"Reset Password"})})]})]})})]}):null}},84213:(e,s,t)=>{"use strict";t.d(s,{A:()=>d}),t(14232);var r=t(31486),a=t(67570),o=t(89099),l=t(39117),i=t(86788),n=t(37876);let d=e=>{let{title:s="",helpContent:t,showBackButton:d=!0,onHelpClick:c}=e,m=(0,o.useRouter)();return t&&(0,i.O)(l.s6.DEBUG,`OnboardingHeader helpContent: ${JSON.stringify(t)}`,!1),(0,n.jsxs)("div",{className:"relative mt-40 flex w-full items-center justify-between sm:mt-6 md:mt-8",children:[d&&(0,n.jsx)("div",{className:"flex items-center space-x-4",children:(0,n.jsx)(a.A,{onClick:()=>m.back()})}),s&&(0,n.jsx)("h2",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-lg font-semibold text-[var(--header-text-color)]",children:s}),(0,n.jsx)(r.A,{content:t,onHelpClick:c})]})}}},e=>{e.O(0,[713,9897,636,6593,8792],()=>e(e.s=55352)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.