Compare commits

...

3 Commits

Author SHA1 Message Date
5977f9325f Allow subdomains starting by _
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-20 19:18:17 +01:00
63d48d4de9 Add instance name in survey link
This'll permit to ask user's email if it uses a local instance
2021-01-19 22:55:03 +01:00
28eba4ebf0 Add spinner on forgotten-password and login page 2021-01-19 22:54:44 +01:00
4 changed files with 20 additions and 4 deletions

View File

@ -102,7 +102,7 @@
<a
id="voxpeople"
:href="'https://framaforms.org/quel-est-votre-avis-sur-happydns-1610366701?u=' + (user_isLogged?user_getSession.id:0) + '&amp;p=' + $router.history.current.name + '&amp;l=' + $i18n.locale"
:href="'https://framaforms.org/quel-est-votre-avis-sur-happydns-1610366701?u=' + (user_isLogged?user_getSession.id:0) + '&amp;i=' + instancename + '&amp;p=' + $router.history.current.name + '&amp;l=' + $i18n.locale"
target="_blank"
:title="$t('common.survey')"
>
@ -143,6 +143,9 @@ export default {
},
computed: {
instancename () {
return window.location.hostname
},
...mapGetters('user', ['user_getSession', 'user_getSettings', 'user_isLogged'])
},

View File

@ -48,7 +48,7 @@ export default {
domains.forEach(function (domain) {
newDomainState &= domain.length >= 1 && domain.length <= 63
newDomainState &= domain[0] !== '-' && domain[domain.length - 1] !== '-'
newDomainState &= /^(\*|[a-zA-Z0-9]([a-zA-Z0-9-]?[a-zA-Z0-9])*)$/.test(domain)
newDomainState &= /^(\*|_?[a-zA-Z0-9]([a-zA-Z0-9-]?[a-zA-Z0-9])*)$/.test(domain)
})
ret = newDomainState > 0
}

View File

@ -102,7 +102,8 @@
</b-col>
</b-form-row>
<b-form-row class="mt-3">
<b-button class="offset-sm-4 col-sm-4" type="submit" variant="primary">
<b-button class="offset-sm-4 col-sm-4" :disabled="formSent" type="submit" variant="primary">
<b-spinner v-if="formSent" label="Spinning" small />
{{ $t('password.redefine') }}
</b-button>
</b-form-row>
@ -122,6 +123,7 @@ export default {
return {
email: '',
emailState: null,
formSent: false,
error: null,
signupForm: {
password: '',
@ -165,6 +167,7 @@ export default {
this.emailState = valid
if (valid) {
this.formSent = true
axios
.patch('/api/users', {
kind: 'recovery',
@ -172,6 +175,7 @@ export default {
})
.then(
(response) => {
this.formSent = false
this.$root.$bvToast.toast(
this.$t('email.instruction.check-inbox'), {
title: this.$t('email.sent-recovery'),
@ -183,6 +187,7 @@ export default {
this.$router.push('/login')
},
(error) => {
this.formSent = false
this.$bvToast.toast(
error.response.data.errmsg, {
title: this.$t('errors.recovery'),
@ -199,6 +204,7 @@ export default {
const valid = this.$refs.formRecover.checkValidity()
if (valid && this.user) {
this.formSent = true
axios
.post('/api/users/' + encodeURIComponent(this.user) + '/recovery', {
key: this.$route.query.k,
@ -206,6 +212,7 @@ export default {
})
.then(
(response) => {
this.formSent = false
this.$root.$bvToast.toast(
this.$t('password.success'), {
title: this.$t('password.redefined'),
@ -217,6 +224,7 @@ export default {
this.$router.push('/login')
},
(error) => {
this.formSent = false
this.$bvToast.toast(
error.response.data.errmsg, {
title: this.$t('errors.recovery'),

View File

@ -86,7 +86,8 @@
/>
</b-form-group>
<div class="d-flex justify-content-around">
<b-button type="submit" variant="primary">
<b-button :disabled="formSent" type="submit" variant="primary">
<b-spinner v-if="formSent" label="Spinning" small />
{{ $t('common.go') }}
</b-button>
<b-button to="/forgotten-password" variant="outline-dark">
@ -107,6 +108,7 @@ export default {
data: function () {
return {
formSent: false,
loginForm: {}
}
},
@ -127,12 +129,15 @@ export default {
this.loginForm.emailState = valid ? 'valid' : 'invalid'
this.loginForm.passwordState = valid ? 'valid' : 'invalid'
if (valid) {
this.formSent = true
this.$store.dispatch('user/login', this.loginForm)
.then(
(response) => {
this.formSent = false
this.$router.push('/')
},
(error) => {
this.formSent = false
this.$bvToast.toast(
error.response.data.errmsg, {
title: this.$t('errors.login'),