@@ -11,8 +11,11 @@ div.flex
1111 label ="Activation"
1212 v-model ="props.identity.dataStatus"
1313 :true-value ="1"
14- :false-value ="0"
14+ :indeterminate-value ="-2"
15+ :false-value ="-3"
1516 )
17+ q-btn.q-mx-xs ( @click ="forceChangePassword()" color ="orange-8" icon ="mdi-lock-reset" :disabled ="props.identity.state != IdentityState.SYNCED" )
18+ q-tooltip.text-body2 ( slot ="trigger" ) Obliger l'utilisateur à changer son mot de passe
1619 q-btn.q-mx-xs ( @click ="resetPasswordModal = true" color ="red-8" icon ="mdi-account-key" :disabled ="props.identity.state != IdentityState.SYNCED" )
1720 q-tooltip.text-body2 ( slot ="trigger" ) Définir le mot de passe
1821 q-btn.q-mx-xs ( @click ="sendInit" color ="primary" icon ="mdi-email-arrow-right" :disabled ="props.identity.state != IdentityState.SYNCED" )
@@ -48,7 +51,7 @@ import { useIdentityStates } from '~/composables'
4851import { useErrorHandling } from ' #imports'
4952import InputNewPassword from " ~/components/inputNewPassword.vue" ;
5053const resetPasswordModal= ref (false )
51-
54+ const forcePasswordModal = ref ( false )
5255
5356const newpassword= ref (' ' )
5457type IdentityResponse = operations [' IdentitiesController_search' ][' responses' ][' 200' ][' content' ][' application/json' ]
@@ -119,6 +122,43 @@ function showActivate(){
119122 return false
120123 }
121124}
125+ async function forceChangePassword(){
126+ $q .dialog ({
127+ title: ' Confirmation' ,
128+ message: " Voulez vous forcer le changement de mot de passe ? " ,
129+ persistent: true ,
130+ ok: {
131+ push: true ,
132+ color: ' positive' ,
133+ label: ' Forcer' ,
134+ },
135+ cancel: {
136+ push: true ,
137+ color: ' negative' ,
138+ label: ' Annuler' ,
139+ },
140+ }).onOk (async () => {
141+ const requestOptions= {method: ' POST' ,
142+ body:JSON .stringify ({id:props .identity ._id })}
143+ try {
144+ const data= await $http .post (' /management/identities/needtochangepassword' , requestOptions )
145+ $q .notify ({
146+ message: ' LE changement de mot de passe est forcé : ' ,
147+ color: ' positive' ,
148+ position: ' top-right' ,
149+ icon: ' mdi-check-circle-outline' ,
150+ })
151+ }catch (error ){
152+ $q .notify ({
153+ message: ' Impossible de forcer le changement de mot de passe : ' + error .response ._data .message ,
154+ color: ' negative' ,
155+ position: ' top-right' ,
156+ icon: ' mdi-alert-circle-outline' ,
157+ })
158+ }
159+
160+ })
161+ }
122162async function activate(){
123163
124164
0 commit comments