Newer
Older
<template>
<div>
<div class="container">
</div>
<b-overlay
id="overlay-background"
:show="loading"
:variant="'white'"
:opacity="0.7"
:blur="'2px'"
rounded="sm"
no-wrap
>
</b-overlay>
<div class="form">
<h5 class="title">{{ $t('reinitPassword.title') }}</h5>
<ValidationObserver ref="form" v-slot="{ handleSubmit }">
<form>
<div class="form-row">
<ValidationProvider
ref="password"
:rules="{ required: true, regex: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d$&+,:;=?@#|'<>.^*()%!-]{8,}$/ }"
v-slot="{ classes, errors }"
vid="confirmation"
>
<div class="control" :class="classes">
<label class="required">
</label>
<div class="input-group flex-nowrap">
<input
v-model="password1"
class="form-control"
:type="showPassword ? 'text' : 'password'"
>
<span
v-if="!showPassword"
class="input-group-text"
>
<b-icon
icon="eye-fill"
@click="showPassword = !showPassword"
/>
</span>
<span
v-else
class="input-group-text"
>
<b-icon
icon="eye-slash-fill"
@click="showPassword = !showPassword"
/>
</span>
</div>
<span class="form-errors">{{ errors[0] }}</span>
</div>
</ValidationProvider>
</div>
<div class="form-row">
<ValidationProvider ref="password" rules="required|confirmed:confirmation" v-slot="{ classes, errors }">
<div class="control" :class="classes">
<label class="required">
</label>
<div class="input-group flex-nowrap">
<input
v-model="password2"
class="form-control"
:type="showPassword ? 'text' : 'password'"
>
<span
v-if="!showPassword"
class="input-group-text"
>
<b-icon
icon="eye-fill"
@click="showPassword = !showPassword"
/>
</span>
<span
v-else
class="input-group-text"
>
<b-icon
icon="eye-slash-fill"
@click="showPassword = !showPassword"
/>
</span>
</div>
<span class="form-errors">{{ errors[0] }}</span>
</div>
</ValidationProvider>
</div>
<div class="infos">
<ul>
<li>{{ $t('reinitPassword.passwordHelp')[0] }}</li>
<li>{{ $t('reinitPassword.passwordHelp')[1] }}</li>
<li>{{ $t('reinitPassword.passwordHelp')[2] }}</li>
<li>{{ $t('reinitPassword.passwordHelp')[3] }}</li>
</ul>
</div>
<button
type="button"
class="btn btn-primary"
@click.prevent="handleSubmit(sendNewPassword)"
>
</button>
<button
type="button"
class="btn btn-outline-secondary"
@click="$router.push({ name: 'SignIn' })"
>
</button>
</form>
</ValidationObserver>
</div>
<div class="messages">
<div v-if="error">
<p class="form-errors">{{ error }}</p>
</div>
<div v-if="success">
<p class="form-success">{{ success }}</p>
</div>
</div>
</div>
<small class="footer">
<p>{{ $t('footer') }} <a href="https://www.neogeo.fr/" target="_blank" rel="noopener">Neogeo-Technologies</a></p>
</small>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex';
import {
ValidationObserver,
ValidationProvider,
extend,
configure,
} from 'vee-validate';
import { required, confirmed, regex } from 'vee-validate/dist/rules';
extend('required', {
...required,
});
extend('confirmed', {
...confirmed,
});
configure({
classes: {
valid: 'is-valid',
invalid: 'is-invalid',
},
});
extend('regex', {
...regex,
});
export default {
name: 'ReinitPassword',
components: {
ValidationObserver,
ValidationProvider
},
data() {
return {
loading: false,
password1: null,
password2: null,
showPassword: false
}
},
computed: {
...mapState('forgotten-pwd', [
'error',
'success'
]),
logoPath() {
return require(process.env.VUE_APP_LOGO);
}
},
watch: {
'$i18n.locale': function(newValue, oldValue) {
if (newValue !== oldValue) {
this.$refs.form.validate();
}
},
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
},
methods: {
...mapActions('forgotten-pwd', [
'CONFIRM_NEW_PASSWORD'
]),
sendNewPassword() {
this.loading = true;
this.CONFIRM_NEW_PASSWORD({
token: this.$route.query.token,
password: this.password1
}).then(() => {
this.loading = false;
})
}
}
};
</script>
<style lang="less" scoped>
.container {
margin: auto;
width: 480px;
height: fit-content;
.form {
.form-row {
margin: 0 0 40px 0;
display: block;
}
button.btn {
float: right;
position: relative;
margin-left: 7px;
margin-right: 0;
margin-top: 1rem;
}
button.btn-primary {
border: 2px solid #9BD0FF;
border-radius: 8px;
}
button.btn-outline-secondary {
background-color: #F7F8FA;
border: 2px solid #A9B2B9;
border-radius: 8px;
color: #2F3234;
}
button.btn-outline-secondary:hover {
color: white;
background-color: #4b4b4b;
}
}
.infos {
font-size: 0.75em;
text-align: justify;
ul {
padding-left: 1rem;
}
}
.messages {
display: inline-block;
position: relative;
top: 1.5em;
}
}
.form-errors {
color: #EB0600 !important;
max-width: 40em;
}
.form-success {
color: #11ac45 !important;
}
.footer {
position: absolute;
bottom: 0;
font-size: small;
}
.footer a {
text-decoration: none;
}
</style>