{"version":3,"file":"SendResetMailPage.0dfd49f78dc93c695e30.js","mappings":"syBAYA,MAAMA,EAAmBC,GAAwBC,EAAAA,GAAI;WAC1CD,EAAME,OAAOC;eACTH,EAAMI,WAAWC,KAAKC;iBACpBN,EAAMI,WAAWG,OAAOC;gBACzBR,EAAMS,QAAQH;;EAIjBI,EAAwB,KAAM,QACzC,MAAOC,EAAWC,IAAgBC,EAAAA,EAAAA,WAAS,GACrCC,GAASC,EAAAA,EAAAA,WAAUhB,GACnBiB,EAAa,GAAEC,EAAAA,GAAAA,kBASrB,OAAIN,GAEA,kCACE,0HADF,OAEE,SAAC,EAAAO,UAAD,CAAWC,OAAO,SAClB,SAAC,EAAAC,WAAD,CAAYC,QAAQ,UAAUC,KAAMN,EAApC,+BAOJ,SAAC,EAAAO,KAAD,CAAMC,SAnBUC,MAAAA,UACEC,EAAAA,EAAAA,iBAAgBC,KAAK,sCAAuCC,IAE5EhB,GAAa,IAgBf,SACG,cAAC,SAAEiB,EAAF,OAAYC,GAAb,SACC,uCACE,SAAC,EAAAC,OAAD,+BACA,SAAC,EAAAC,MAAD,CACEC,MAAM,OACNC,YAAY,yDACZC,UAAWL,EAAOM,YAClBC,MAAOP,MAAAA,GAAF,UAAEA,EAAQM,mBAAV,aAAE,EAAqBE,QAJ9B,UAME,SAAC,EAAAC,MAAD,eACEC,GAAG,aACHC,YAAY,qBACRZ,EAAS,cAAe,CAAEa,SAAU,sCAX9C,OAcE,UAAC,EAAAC,gBAAD,kBACE,SAAC,EAAAC,OAAD,iCACA,SAAC,EAAAxB,WAAD,CAAYyB,KAAK,OAAOvB,KAAMN,EAA9B,+BAhBJ,OAqBE,cAAG8B,UAAWhC,EAAd,gG,MC7DH,MAAMiC,EAAwB,IAAM,IAAN,GACnC,SAACC,EAAA,GAAD,WACE,SAAC,KAAD,WACE,SAACtC,EAAD,SAKN","sources":["webpack://grafana/./public/app/core/components/ForgottenPassword/ForgottenPassword.tsx","webpack://grafana/./public/app/core/components/ForgottenPassword/SendResetMailPage.tsx"],"sourcesContent":["import { css } from '@emotion/css';\nimport React, { FC, useState } from 'react';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { getBackendSrv } from '@grafana/runtime';\nimport { Form, Field, Input, Button, Legend, Container, useStyles, HorizontalGroup, LinkButton } from '@grafana/ui';\nimport config from 'app/core/config';\n\ninterface EmailDTO {\n  userOrEmail: string;\n}\n\nconst paragraphStyles = (theme: GrafanaTheme) => css`\n  color: ${theme.colors.formDescription};\n  font-size: ${theme.typography.size.sm};\n  font-weight: ${theme.typography.weight.regular};\n  margin-top: ${theme.spacing.sm};\n  display: block;\n`;\n\nexport const ForgottenPassword: FC = () => {\n  const [emailSent, setEmailSent] = useState(false);\n  const styles = useStyles(paragraphStyles);\n  const loginHref = `${config.appSubUrl}/login`;\n\n  const sendEmail = async (formModel: EmailDTO) => {\n    const res = await getBackendSrv().post('/api/user/password/send-reset-email', formModel);\n    if (res) {\n      setEmailSent(true);\n    }\n  };\n\n  if (emailSent) {\n    return (\n      <div>\n        <p>An email with a reset link has been sent to the email address. You should receive it shortly.</p>\n        <Container margin=\"md\" />\n        <LinkButton variant=\"primary\" href={loginHref}>\n          Back to login\n        </LinkButton>\n      </div>\n    );\n  }\n  return (\n    <Form onSubmit={sendEmail}>\n      {({ register, errors }) => (\n        <>\n          <Legend>Reset password</Legend>\n          <Field\n            label=\"User\"\n            description=\"Enter your information to get a reset link sent to you\"\n            invalid={!!errors.userOrEmail}\n            error={errors?.userOrEmail?.message}\n          >\n            <Input\n              id=\"user-input\"\n              placeholder=\"Email or username\"\n              {...register('userOrEmail', { required: 'Email or username is required' })}\n            />\n          </Field>\n          <HorizontalGroup>\n            <Button>Send reset email</Button>\n            <LinkButton fill=\"text\" href={loginHref}>\n              Back to login\n            </LinkButton>\n          </HorizontalGroup>\n\n          <p className={styles}>Did you forget your username or email? Contact your Grafana administrator.</p>\n        </>\n      )}\n    </Form>\n  );\n};\n","import React, { FC } from 'react';\n\nimport { LoginLayout, InnerBox } from '../Login/LoginLayout';\n\nimport { ForgottenPassword } from './ForgottenPassword';\n\nexport const SendResetMailPage: FC = () => (\n  <LoginLayout>\n    <InnerBox>\n      <ForgottenPassword />\n    </InnerBox>\n  </LoginLayout>\n);\n\nexport default SendResetMailPage;\n"],"names":["paragraphStyles","theme","css","colors","formDescription","typography","size","sm","weight","regular","spacing","ForgottenPassword","emailSent","setEmailSent","useState","styles","useStyles","loginHref","config","Container","margin","LinkButton","variant","href","Form","onSubmit","async","getBackendSrv","post","formModel","register","errors","Legend","Field","label","description","invalid","userOrEmail","error","message","Input","id","placeholder","required","HorizontalGroup","Button","fill","className","SendResetMailPage","LoginLayout"],"sourceRoot":""}