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MAAO2E,CAAa,EAAG,KAAMF,CAAA,CAAU,KACvE,OAAC,IAAI,CAAC,MAAOC,EAAY,SAAAF,CAAA,CAAQ,IAFzBA,CAGV,CAEJ,EAEa9B,EAAaG,IACjB,CACL,KAAM,CACJ,SAAO,OAAI,CACT,YAAaA,EAAM,QAAQ,CAAC,CAC9B,CAAC,EACD,SAAO,OAAI,CACT,MAAOA,EAAM,OAAO,QAAQ,IAC9B,CAAC,EACD,WAAS,OAAI,CACX,MAAOA,EAAM,OAAO,UAAU,IAChC,CAAC,EACD,SAAO,OAAI,CACT,MAAOA,EAAM,OAAO,MAAM,IAC5B,CAAC,CACH,CACF,E","sources":["webpack://grafana/./public/app/core/components/ForgottenPassword/ChangePassword.tsx","webpack://grafana/./public/app/core/components/Login/LoginCtrl.tsx","webpack://grafana/./public/app/core/components/Login/LoginForm.tsx","webpack://grafana/./public/app/core/components/Login/LoginLayout.tsx","webpack://grafana/./public/app/core/components/PasswordField/PasswordField.tsx","webpack://grafana/./public/app/core/components/ValidationLabels/ValidationLabels.tsx"],"sourcesContent":["import { SyntheticEvent, useState } from 'react';\nimport { useForm } from 'react-hook-form';\n\nimport { selectors } from '@grafana/e2e-selectors';\nimport { config } from '@grafana/runtime';\nimport { Tooltip, Field, Button, Alert, useStyles2, Stack } from '@grafana/ui';\nimport { Trans } from 'app/core/internationalization';\n\nimport { getStyles } from '../Login/LoginForm';\nimport { PasswordField } from '../PasswordField/PasswordField';\nimport {\n ValidationLabels,\n strongPasswordValidations,\n strongPasswordValidationRegister,\n} from '../ValidationLabels/ValidationLabels';\n\ninterface Props {\n onSubmit: (pw: string) => void;\n onSkip?: (event?: SyntheticEvent) => void;\n showDefaultPasswordWarning?: boolean;\n}\n\ninterface PasswordDTO {\n newPassword: string;\n confirmNew: string;\n}\n\nexport const ChangePassword = ({ onSubmit, onSkip, showDefaultPasswordWarning }: Props) => {\n const styles = useStyles2(getStyles);\n const [displayValidationLabels, setDisplayValidationLabels] = useState(false);\n const [pristine, setPristine] = useState(true);\n\n const {\n handleSubmit,\n register,\n getValues,\n formState: { errors },\n watch,\n } = useForm({\n defaultValues: {\n newPassword: '',\n confirmNew: '',\n },\n });\n\n const newPassword = watch('newPassword');\n const submit = (passwords: PasswordDTO) => {\n onSubmit(passwords.newPassword);\n };\n return (\n
\n {showDefaultPasswordWarning && (\n \n )}\n \n setDisplayValidationLabels(true)}\n {...register('newPassword', {\n required: 'New Password is required',\n onBlur: () => setPristine(false),\n validate: { strongPasswordValidationRegister },\n })}\n id=\"new-password\"\n autoFocus\n autoComplete=\"new-password\"\n />\n \n {displayValidationLabels && (\n \n )}\n \n v === getValues().newPassword || 'Passwords must match!',\n })}\n id=\"confirm-new-password\"\n autoComplete=\"new-password\"\n />\n \n \n \n\n {!config.auth.basicAuthStrongPasswordPolicy && onSkip && (\n \n \n Skip\n \n \n )}\n \n \n );\n};\n","import { PureComponent } from 'react';\n\nimport { FetchError, getBackendSrv, isFetchError, locationService } from '@grafana/runtime';\nimport config from 'app/core/config';\nimport { t } from 'app/core/internationalization';\n\nimport { LoginDTO, AuthNRedirectDTO } from './types';\n\nconst isOauthEnabled = () => {\n return !!config.oauth && Object.keys(config.oauth).length > 0;\n};\n\nconst showPasswordlessConfirmation = () => {\n const queryValues = locationService.getSearch();\n return !!queryValues.get('code');\n};\n\nexport interface FormModel {\n user: string;\n password: string;\n email: string;\n}\n\nexport interface PasswordlessFormModel {\n email: string;\n}\n\nexport interface PasswordlessConfirmationFormModel {\n code: string;\n confirmationCode: string;\n username?: string;\n name?: string;\n}\n\ninterface Props {\n resetCode?: string;\n\n children: (props: {\n isLoggingIn: boolean;\n changePassword: (pw: string) => void;\n isChangingPassword: boolean;\n skipPasswordChange: Function;\n login: (data: FormModel) => void;\n passwordlessStart: (data: PasswordlessFormModel) => void;\n passwordlessConfirm: (data: PasswordlessConfirmationFormModel) => void;\n showPasswordlessConfirmation: boolean;\n disableLoginForm: boolean;\n disableUserSignUp: boolean;\n isOauthEnabled: boolean;\n loginHint: string;\n passwordHint: string;\n showDefaultPasswordWarning: boolean;\n loginErrorMessage: string | undefined;\n }) => JSX.Element;\n}\n\ninterface State {\n isLoggingIn: boolean;\n isChangingPassword: boolean;\n showDefaultPasswordWarning: boolean;\n loginErrorMessage?: string;\n}\n\nexport class LoginCtrl extends PureComponent {\n result: LoginDTO | undefined;\n\n constructor(props: Props) {\n super(props);\n this.state = {\n isLoggingIn: false,\n isChangingPassword: false,\n showDefaultPasswordWarning: false,\n // oAuth unauthorized sets the redirect error message in the bootdata, hence we need to check the key here\n loginErrorMessage: getBootDataErrMessage(config.loginError),\n };\n }\n\n changePassword = (password: string) => {\n const pw = {\n newPassword: password,\n confirmNew: password,\n oldPassword: 'admin',\n };\n\n if (this.props.resetCode) {\n const resetModel = {\n code: this.props.resetCode,\n newPassword: password,\n confirmPassword: password,\n };\n\n getBackendSrv()\n .post('/api/user/password/reset', resetModel)\n .then(() => {\n this.toGrafana();\n });\n } else {\n getBackendSrv()\n .put('/api/user/password', pw)\n .then(() => {\n this.toGrafana();\n })\n .catch((err) => console.error(err));\n }\n };\n\n login = (formModel: FormModel) => {\n this.setState({\n loginErrorMessage: undefined,\n isLoggingIn: true,\n });\n\n getBackendSrv()\n .post('/login', formModel, { showErrorAlert: false })\n .then((result) => {\n this.result = result;\n if (formModel.password !== 'admin' || config.ldapEnabled || config.authProxyEnabled) {\n this.toGrafana();\n return;\n } else {\n this.changeView(formModel.password === 'admin');\n }\n })\n .catch((err) => {\n const fetchErrorMessage = isFetchError(err) ? getErrorMessage(err) : undefined;\n this.setState({\n isLoggingIn: false,\n loginErrorMessage: fetchErrorMessage || t('login.error.unknown', 'Unknown error occurred'),\n });\n });\n };\n\n passwordlessStart = (formModel: PasswordlessFormModel) => {\n this.setState({\n loginErrorMessage: undefined,\n isLoggingIn: true,\n });\n\n getBackendSrv()\n .post('/api/login/passwordless/start', formModel, { showErrorAlert: false })\n .then((result) => {\n window.location.assign(result.URL);\n return;\n })\n .catch((err) => {\n const fetchErrorMessage = isFetchError(err) ? getErrorMessage(err) : undefined;\n this.setState({\n isLoggingIn: false,\n loginErrorMessage: fetchErrorMessage || t('login.error.unknown', 'Unknown error occurred'),\n });\n });\n };\n\n passwordlessConfirm = (formModel: PasswordlessConfirmationFormModel) => {\n this.setState({\n loginErrorMessage: undefined,\n isLoggingIn: true,\n });\n\n getBackendSrv()\n .post('/api/login/passwordless/authenticate', formModel, { showErrorAlert: false })\n .then((result) => {\n this.result = result;\n this.toGrafana();\n return;\n })\n .catch((err) => {\n const fetchErrorMessage = isFetchError(err) ? getErrorMessage(err) : undefined;\n this.setState({\n isLoggingIn: false,\n loginErrorMessage: fetchErrorMessage || t('login.error.unknown', 'Unknown error occurred'),\n });\n });\n };\n\n changeView = (showDefaultPasswordWarning: boolean) => {\n this.setState({\n isChangingPassword: true,\n showDefaultPasswordWarning,\n });\n };\n\n toGrafana = () => {\n if (config.featureToggles.useSessionStorageForRedirection) {\n window.location.assign(config.appSubUrl + '/');\n return;\n }\n\n if (this.result?.redirectUrl) {\n if (config.appSubUrl !== '' && !this.result.redirectUrl.startsWith(config.appSubUrl)) {\n window.location.assign(config.appSubUrl + this.result.redirectUrl);\n } else {\n window.location.assign(this.result.redirectUrl);\n }\n } else {\n window.location.assign(config.appSubUrl + '/');\n }\n };\n\n render() {\n const { children } = this.props;\n const { isLoggingIn, isChangingPassword, showDefaultPasswordWarning, loginErrorMessage } = this.state;\n const { login, toGrafana, changePassword, passwordlessStart, passwordlessConfirm } = this;\n const { loginHint, passwordHint, disableLoginForm, disableUserSignUp } = config;\n\n return (\n <>\n {children({\n isOauthEnabled: isOauthEnabled(),\n loginHint,\n passwordHint,\n disableLoginForm,\n disableUserSignUp,\n login,\n passwordlessStart,\n passwordlessConfirm,\n showPasswordlessConfirmation: showPasswordlessConfirmation(),\n isLoggingIn,\n changePassword,\n skipPasswordChange: toGrafana,\n isChangingPassword,\n showDefaultPasswordWarning,\n loginErrorMessage,\n })}\n \n );\n }\n}\n\nexport default LoginCtrl;\n\nfunction getErrorMessage(err: FetchError): string | undefined {\n switch (err.data?.messageId) {\n case 'password-auth.empty':\n case 'password-auth.failed':\n case 'password-auth.invalid':\n return t('login.error.invalid-user-or-password', 'Invalid username or password');\n case 'login-attempt.blocked':\n return t(\n 'login.error.blocked',\n 'You have exceeded the number of login attempts for this user. Please try again later.'\n );\n default:\n return err.data?.message;\n }\n}\n\nfunction getBootDataErrMessage(str?: string) {\n switch (str) {\n case 'oauth.login.error':\n return t('oauth.login.error', 'Login provider denied login request');\n default:\n return str;\n }\n}\n","import { css } from '@emotion/css';\nimport { ReactElement, useId } from 'react';\nimport { useForm } from 'react-hook-form';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { Button, Input, Field, useStyles2 } from '@grafana/ui';\nimport { t } from 'app/core/internationalization';\n\nimport { PasswordField } from '../PasswordField/PasswordField';\n\nimport { FormModel } from './LoginCtrl';\n\ninterface Props {\n children: ReactElement;\n onSubmit: (data: FormModel) => void;\n isLoggingIn: boolean;\n passwordHint: string;\n loginHint: string;\n}\n\nexport const LoginForm = ({ children, onSubmit, isLoggingIn, passwordHint, loginHint }: Props) => {\n const styles = useStyles2(getStyles);\n const usernameId = useId();\n const passwordId = useId();\n const {\n handleSubmit,\n register,\n formState: { errors },\n } = useForm({ mode: 'onChange' });\n\n return (\n
\n
\n \n \n \n \n \n \n \n {isLoggingIn ? t('login.form.submit-loading-label', 'Logging in...') : t('login.form.submit-label', 'Log in')}\n \n {children}\n \n
\n );\n};\n\nexport const getStyles = (theme: GrafanaTheme2) => {\n return {\n wrapper: css({\n width: '100%',\n paddingBottom: theme.spacing(2),\n }),\n\n submitButton: css({\n justifyContent: 'center',\n width: '100%',\n }),\n\n skipButton: css({\n alignSelf: 'flex-start',\n }),\n };\n};\n","import { cx, css, keyframes } from '@emotion/css';\nimport { useEffect, useState } from 'react';\nimport * as React from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2 } from '@grafana/ui';\nimport { Trans } from 'app/core/internationalization';\n\nimport { Branding } from '../Branding/Branding';\nimport { BrandingSettings } from '../Branding/types';\nimport { Footer } from '../Footer/Footer';\n\ninterface InnerBoxProps {\n enterAnimation?: boolean;\n}\nexport const InnerBox = ({ children, enterAnimation = true }: React.PropsWithChildren) => {\n const loginStyles = useStyles2(getLoginStyles);\n return
{children}
;\n};\n\nexport interface LoginLayoutProps {\n /** Custom branding settings that can be used e.g. for previewing the Login page changes */\n branding?: BrandingSettings;\n isChangingPassword?: boolean;\n}\n\nexport const LoginLayout = ({ children, branding, isChangingPassword }: React.PropsWithChildren) => {\n const loginStyles = useStyles2(getLoginStyles);\n const [startAnim, setStartAnim] = useState(false);\n const subTitle = branding?.loginSubtitle ?? Branding.GetLoginSubTitle();\n const loginTitle = branding?.loginTitle ?? Branding.LoginTitle;\n const loginBoxBackground = branding?.loginBoxBackground || Branding.LoginBoxBackground();\n const loginLogo = branding?.loginLogo;\n const hideEdition = branding?.hideEdition ?? Branding.HideEdition;\n\n useEffect(() => setStartAnim(true), []);\n\n return (\n \n
\n
\n
\n \n
\n {isChangingPassword ? (\n

\n Update your password\n

\n ) : (\n <>\n

{loginTitle}

\n {subTitle &&

{subTitle}

}\n \n )}\n
\n
\n
{children}
\n
\n
\n {branding?.hideFooter ? <> :