MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / showChangeServerPassword

Function showChangeServerPassword

web/pgadmin/static/js/Dialogs/index.jsx:182–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

180}
181
182export function showChangeServerPassword() {
183 let title = arguments[0],
184 nodeData = arguments[1],
185 nodeObj = arguments[2],
186 itemNodeData = arguments[3],
187 isPgPassFileUsed = arguments[4];
188
189 const panelId = BROWSER_PANELS.SEARCH_OBJECTS;
190 const onClose = ()=>{pgAdmin.Browser.docker.default_workspace.close(panelId);};
191 pgAdmin.Browser.docker.default_workspace.openDialog({
192 id: panelId,
193 title: title,
194 content: (
195 <ChangePasswordContent
196 onClose={onClose}
197 onSave={(isNew, data)=>{
198 return new Promise((resolve, reject)=>{
199 const api = getApiInstance();
200 let _url = nodeObj.generate_url(itemNodeData, 'change_password', nodeData, true);
201
202 api.post(_url, data)
203 .then(({data: respData})=>{
204 pgAdmin.Browser.notifier.success(respData.info);
205 // Notify user to update pgpass file
206 if(isPgPassFileUsed) {
207 pgAdmin.Browser.notifier.alert(
208 gettext('Change Password'),
209 gettext('Please make sure to disconnect the server'
210 + ' and update the new password in the pgpass file'
211 + ' before performing any other operation')
212 );
213 }
214
215 resolve(respData.data);
216 onClose();
217 })
218 .catch((error)=>{
219 reject(error instanceof Error ? error : Error(gettext('Something went wrong')));
220 });
221 });
222 }}
223 userName={nodeData.user.name}
224 isPgpassFileUsed={isPgPassFileUsed}
225 />
226 )
227 }, pgAdmin.Browser.stdW.md, pgAdmin.Browser.stdH.md);
228}
229
230export function showChangeUserPassword(url) {
231 const title = gettext('Change pgAdmin User Password');

Callers 1

server.jsFile · 0.90

Calls 7

getApiInstanceFunction · 0.85
gettextFunction · 0.85
openDialogMethod · 0.80
generate_urlMethod · 0.80
successMethod · 0.80
alertMethod · 0.80
onCloseFunction · 0.70

Tested by

no test coverage detected