|
38 | 38 | q-tooltip.text-body2(slot="trigger") Obliger l'utilisateur à changer son mot de passe |
39 | 39 | q-btn(@click="resetPasswordModal = true" color="red-8" icon="mdi-account-key" :disabled="props.identity.state != IdentityState.SYNCED" padding='5px 10px' dense) |
40 | 40 | q-tooltip.text-body2(slot="trigger") Définir le mot de passe |
41 | | - q-btn(@click="sendInit" color="primary" icon="mdi-email-arrow-right" :disabled="props.identity.state != IdentityState.SYNCED" padding='5px 10px' dense) |
| 41 | + q-btn(@click="sendInit()" color="primary" icon="mdi-email-arrow-right" :disabled="props.identity.state != IdentityState.SYNCED" padding='5px 10px' dense) |
42 | 42 | q-tooltip.text-body2(slot="trigger") Envoyer le mail d'invitation |
43 | 43 |
|
44 | 44 | q-separator(size='3px' vertical) |
@@ -413,30 +413,67 @@ async function sync() { |
413 | 413 | } |
414 | 414 |
|
415 | 415 | async function sendInit() { |
416 | | - //envoi le mail |
417 | | -
|
418 | | - const { |
419 | | - data: result, |
420 | | - pending, |
421 | | - error, |
422 | | - refresh, |
423 | | - } = await useHttp(`/management/passwd/init`, { |
424 | | - method: 'POST', |
425 | | - body: { uid: props.identity.inetOrgPerson.uid }, |
426 | | - }) |
427 | | - if (error.value) { |
428 | | - handleError({ |
429 | | - error: error.value, |
430 | | - message: "Erreur lors de l'envoi du mail", |
431 | | - }) |
432 | | - } else { |
433 | | - $q.notify({ |
434 | | - message: 'Le mail a été envoyé', |
| 416 | + $q.dialog({ |
| 417 | + title: 'Confirmation', |
| 418 | + message: `Voulez-vous envoyer le mail d'invitation à <${props.identity.inetOrgPerson.uid}> ?`, |
| 419 | + persistent: true, |
| 420 | + ok: { |
| 421 | + push: true, |
435 | 422 | color: 'positive', |
436 | | - position: 'top-right', |
437 | | - icon: 'mdi-check-circle-outline', |
438 | | - }) |
439 | | - } |
| 423 | + label: 'Envoyer', |
| 424 | + }, |
| 425 | + cancel: { |
| 426 | + push: true, |
| 427 | + color: 'negative', |
| 428 | + label: 'Annuler', |
| 429 | + }, |
| 430 | + }).onOk(async () => { |
| 431 | + const requestOptions = { method: 'POST', body: JSON.stringify({ uid: props.identity.inetOrgPerson.uid }) } |
| 432 | + try { |
| 433 | + const data = await $http.post('/management/passwd/init', requestOptions) |
| 434 | + $q.notify({ |
| 435 | + message: `Le mail d'invitation a été envoyé à <${props.identity.inetOrgPerson.uid}> : `, |
| 436 | + color: 'positive', |
| 437 | + position: 'top-right', |
| 438 | + icon: 'mdi-check-circle-outline', |
| 439 | + }) |
| 440 | + props?.refreshTarget(props.identity) |
| 441 | + } catch (error) { |
| 442 | + $q.notify({ |
| 443 | + message: "Impossible d'envoyer le mail d'invitation : " + error.response._data.message, |
| 444 | + color: 'negative', |
| 445 | + position: 'top-right', |
| 446 | + icon: 'mdi-alert-circle-outline', |
| 447 | + }) |
| 448 | + } |
| 449 | + }) |
| 450 | + //envoi le mail |
| 451 | + // console.log('send init', props.identity.inetOrgPerson.uid) |
| 452 | + // const requestOptions = { method: 'POST', body: JSON.stringify({ uid: props.identity.inetOrgPerson.uid }) } |
| 453 | + // const { |
| 454 | + // data: result, |
| 455 | + // pending, |
| 456 | + // error, |
| 457 | + // refresh, |
| 458 | + // } = await useHttp(`/management/passwd/init`, { |
| 459 | + // method: 'POST', |
| 460 | + // cache: 'no-cache', |
| 461 | + // body: JSON.stringify({ uid: props.identity.inetOrgPerson.uid }), |
| 462 | + // }) |
| 463 | + // props?.refreshTarget(props.identity) |
| 464 | + // if (error.value) { |
| 465 | + // handleError({ |
| 466 | + // error: error.value, |
| 467 | + // message: "Erreur lors de l'envoi du mail", |
| 468 | + // }) |
| 469 | + // } else { |
| 470 | + // $q.notify({ |
| 471 | + // message: 'Le mail a été envoyé', |
| 472 | + // color: 'positive', |
| 473 | + // position: 'top-right', |
| 474 | + // icon: 'mdi-check-circle-outline', |
| 475 | + // }) |
| 476 | + // } |
440 | 477 | } |
441 | 478 |
|
442 | 479 | function back() { |
|
0 commit comments