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,GAASO,EAAAA,EAAAA,IAAY,CAAED,MAAAA,QAhBvBN,GAqBKD,eAAgBC,GACrBA,GAASQ,EAAAA,EAAAA,OACT,MAAMC,QAAaN,EAAAA,EAAAA,WACnBH,GAASU,EAAAA,EAAAA,IAAW,CAAED,KAAAA,QAvBtBT,GA4BKD,eAAgBC,GACrBA,GAASW,EAAAA,EAAAA,OACT,MAAMC,QAAiBT,EAAAA,EAAAA,eACvBH,GAASa,EAAAA,EAAAA,IAAe,CAAED,SAAAA,SA3BvB,SAAS5B,IACd,OAAOe,eAAgBC,GACrB,MAAM1D,QAAa6D,EAAAA,EAAAA,WACnBH,GAASc,EAAAA,EAAAA,IAAW,CAAExE,KAAAA,MA4BnB,SAASyE,EAAkBC,GAChC,OAAOjB,eAAgBC,GACrBA,GAASC,EAAAA,EAAAA,IAAY,CAAEC,UAAU,WAC3BC,EAAAA,EAAAA,kBAAsBa,GAC5BhB,GAASiB,EAAAA,EAAAA,IAAmB,CAAED,QAAAA,MAI3B,SAASE,EAAcC,GAC5B,OAAOpB,eAAgBC,GACrBA,GAASC,EAAAA,EAAAA,IAAY,CAAEC,UAAU,WAC3BC,EAAAA,EAAAA,WAAegB,GACrBC,OAAOC,SAASxC,KAAOjC,EAAAA,OAAAA,UAAmB,YAIvC,SAAS0E,EAAkBxB,GAChC,OAAOC,eAAgBC,GACrBA,GAASC,EAAAA,EAAAA,IAAY,CAAEC,UAAU,WAC3BC,EAAAA,EAAAA,kBAAsBL,SACtBE,EAAShB,KACfgB,GAASC,EAAAA,EAAAA,IAAY,CAAEC,UAAU,Q,gDCjFrC,QALe,SAAUqB,IACrB,QAAc,WACVA","sources":["webpack://grafana/./public/app/features/profile/ChangePasswordForm.tsx","webpack://grafana/./public/app/features/profile/ChangePasswordPage.tsx","webpack://grafana/./public/app/features/profile/state/actions.ts","webpack://grafana/./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/useMount.js"],"sourcesContent":["import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { Button, Field, Form, HorizontalGroup, LinkButton } from '@grafana/ui';\nimport config from 'app/core/config';\nimport { UserDTO } from 'app/types';\n\nimport { PasswordField } from '../../core/components/PasswordField/PasswordField';\n\nimport { ChangePasswordFields } from './types';\n\nexport interface Props {\n user: UserDTO;\n isSaving: boolean;\n onChangePassword: (payload: ChangePasswordFields) => void;\n}\n\nexport const ChangePasswordForm: FC<Props> = ({ user, onChangePassword, isSaving }) => {\n const { ldapEnabled, authProxyEnabled, disableLoginForm } = config;\n const authSource = user.authLabels?.length && user.authLabels[0];\n\n if (ldapEnabled || authProxyEnabled) {\n return <p>You cannot change password when LDAP or auth proxy authentication is enabled.</p>;\n }\n if (authSource && disableLoginForm) {\n return <p>Password cannot be changed here.</p>;\n }\n\n return (\n <div\n className={css`\n max-width: 400px;\n `}\n >\n <Form onSubmit={onChangePassword}>\n {({ register, errors, getValues }) => {\n return (\n <>\n <Field label=\"Old password\" invalid={!!errors.oldPassword} error={errors?.oldPassword?.message}>\n <PasswordField\n id=\"current-password\"\n autoComplete=\"current-password\"\n {...register('oldPassword', { required: 'Old password is required' })}\n />\n </Field>\n\n <Field label=\"New password\" invalid={!!errors.newPassword} error={errors?.newPassword?.message}>\n <PasswordField\n id=\"new-password\"\n autoComplete=\"new-password\"\n {...register('newPassword', {\n required: 'New password is required',\n validate: {\n confirm: (v) => v === getValues().confirmNew || 'Passwords must match',\n old: (v) => v !== getValues().oldPassword || `New password can't be the same as the old one.`,\n },\n })}\n />\n </Field>\n\n <Field label=\"Confirm password\" invalid={!!errors.confirmNew} error={errors?.confirmNew?.message}>\n <PasswordField\n id=\"confirm-new-password\"\n autoComplete=\"new-password\"\n {...register('confirmNew', {\n required: 'New password confirmation is required',\n validate: (v) => v === getValues().newPassword || 'Passwords must match',\n })}\n />\n </Field>\n <HorizontalGroup>\n <Button variant=\"primary\" disabled={isSaving} type=\"submit\">\n Change Password\n </Button>\n <LinkButton variant=\"secondary\" href={`${config.appSubUrl}/profile`} fill=\"outline\">\n Cancel\n </LinkButton>\n </HorizontalGroup>\n </>\n );\n }}\n </Form>\n </div>\n );\n};\n","import React from 'react';\nimport { connect, ConnectedProps } from 'react-redux';\nimport { useMount } from 'react-use';\n\nimport { NavModel } from '@grafana/data';\nimport Page from 'app/core/components/Page/Page';\nimport { getNavModel } from 'app/core/selectors/navModel';\nimport { StoreState } from 'app/types';\n\nimport { ChangePasswordForm } from './ChangePasswordForm';\nimport { changePassword, loadUser } from './state/actions';\n\nexport interface OwnProps {\n navModel: NavModel;\n}\n\nfunction mapStateToProps(state: StoreState) {\n const userState = state.user;\n const { isUpdating, user } = userState;\n return {\n navModel: getNavModel(state.navIndex, `change-password`),\n isUpdating,\n user,\n };\n}\n\nconst mapDispatchToProps = {\n loadUser,\n changePassword,\n};\n\nconst connector = connect(mapStateToProps, mapDispatchToProps);\n\nexport type Props = OwnProps & ConnectedProps<typeof connector>;\n\nexport function ChangePasswordPage({ navModel, loadUser, isUpdating, user, changePassword }: Props) {\n useMount(() => loadUser());\n\n return (\n <Page navModel={navModel}>\n <Page.Contents isLoading={!Boolean(user)}>\n {user ? (\n <>\n <h3 className=\"page-heading\">Change Your Password</h3>\n <ChangePasswordForm user={user} onChangePassword={changePassword} isSaving={isUpdating} />\n </>\n ) : null}\n </Page.Contents>\n </Page>\n );\n}\n\nexport default connector(ChangePasswordPage);\n","import { config } from '@grafana/runtime';\n\nimport { ThunkResult, UserOrg } from '../../../types';\nimport { api } from '../api';\nimport { ChangePasswordFields, ProfileUpdateFields } from '../types';\n\nimport {\n initLoadOrgs,\n initLoadSessions,\n initLoadTeams,\n orgsLoaded,\n sessionsLoaded,\n setUpdating,\n teamsLoaded,\n userLoaded,\n userSessionRevoked,\n} from './reducers';\n\nexport function changePassword(payload: ChangePasswordFields): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(setUpdating({ updating: true }));\n await api.changePassword(payload);\n dispatch(setUpdating({ updating: false }));\n };\n}\n\nexport function initUserProfilePage(): ThunkResult<void> {\n return async function (dispatch) {\n await dispatch(loadUser());\n dispatch(loadTeams());\n dispatch(loadOrgs());\n dispatch(loadSessions());\n };\n}\n\nexport function loadUser(): ThunkResult<void> {\n return async function (dispatch) {\n const user = await api.loadUser();\n dispatch(userLoaded({ user }));\n };\n}\n\nfunction loadTeams(): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(initLoadTeams());\n const teams = await api.loadTeams();\n dispatch(teamsLoaded({ teams }));\n };\n}\n\nfunction loadOrgs(): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(initLoadOrgs());\n const orgs = await api.loadOrgs();\n dispatch(orgsLoaded({ orgs }));\n };\n}\n\nfunction loadSessions(): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(initLoadSessions());\n const sessions = await api.loadSessions();\n dispatch(sessionsLoaded({ sessions }));\n };\n}\n\nexport function revokeUserSession(tokenId: number): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(setUpdating({ updating: true }));\n await api.revokeUserSession(tokenId);\n dispatch(userSessionRevoked({ tokenId }));\n };\n}\n\nexport function changeUserOrg(org: UserOrg): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(setUpdating({ updating: true }));\n await api.setUserOrg(org);\n window.location.href = config.appSubUrl + '/profile';\n };\n}\n\nexport function updateUserProfile(payload: ProfileUpdateFields): ThunkResult<void> {\n return async function (dispatch) {\n dispatch(setUpdating({ updating: true }));\n await api.updateUserProfile(payload);\n await dispatch(loadUser());\n dispatch(setUpdating({ updating: false }));\n };\n}\n","import useEffectOnce from './useEffectOnce';\nvar useMount = function (fn) {\n useEffectOnce(function () {\n fn();\n });\n};\nexport default useMount;\n"],"names":["ChangePasswordForm","user","onChangePassword","isSaving","ldapEnabled","authProxyEnabled","disableLoginForm","config","authSource","authLabels","length","className","css","Form","onSubmit","register","errors","getValues","Field","label","invalid","oldPassword","error","message","PasswordField","id","autoComplete","required","newPassword","validate","confirm","v","confirmNew","old","HorizontalGroup","Button","variant","disabled","type","LinkButton","href","fill","mapDispatchToProps","loadUser","changePassword","ChangePasswordPage","navModel","isUpdating","useMount","Page","isLoading","Boolean","connect","state","userState","getNavModel","navIndex","payload","async","dispatch","setUpdating","updating","api","initUserProfilePage","initLoadTeams","teams","teamsLoaded","initLoadOrgs","orgs","orgsLoaded","initLoadSessions","sessions","sessionsLoaded","userLoaded","revokeUserSession","tokenId","userSessionRevoked","changeUserOrg","org","window","location","updateUserProfile","fn"],"sourceRoot":""}