Fix lint issues

And disable eslint when building in prod mode

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-11-30 10:24:11 +01:00
parent da42522073
commit 2d541f2e32
161 changed files with 3869 additions and 1236 deletions

View File

@@ -1,6 +1,8 @@
<template>
<section class="section container">
<h1 class="title" v-if="loading">{{ $t("Your email is being changed") }}</h1>
<h1 class="title" v-if="loading">
{{ $t("Your email is being changed") }}
</h1>
<div v-else>
<div v-if="failed">
<b-message :title="$t('Error while changing email')" type="is-danger">

View File

@@ -15,9 +15,12 @@
type="is-danger"
:aria-close-label="$t('Close')"
>{{
$t("Error while login with {provider}. Retry or login another way.", {
provider: $route.query.provider,
})
$t(
"Error while login with {provider}. Retry or login another way.",
{
provider: $route.query.provider,
}
)
}}</b-message
>
<b-message
@@ -25,12 +28,20 @@
type="is-danger"
:aria-close-label="$t('Close')"
>{{
$t("Error while login with {provider}. This login provider doesn't exist.", {
provider: $route.query.provider,
})
$t(
"Error while login with {provider}. This login provider doesn't exist.",
{
provider: $route.query.provider,
}
)
}}</b-message
>
<b-message :title="$t('Error')" type="is-danger" v-for="error in errors" :key="error">
<b-message
:title="$t('Error')"
type="is-danger"
v-for="error in errors"
:key="error"
>
{{ error }}
</b-message>
<form @submit="loginAction">
@@ -56,24 +67,35 @@
</b-field>
<p class="control has-text-centered" v-if="!submitted">
<button class="button is-primary is-large">{{ $t("Login") }}</button>
<button class="button is-primary is-large">
{{ $t("Login") }}
</button>
</p>
<b-loading :is-full-page="false" v-model="submitted" />
<div class="control" v-if="config && config.auth.oauthProviders.length > 0">
<div
class="control"
v-if="config && config.auth.oauthProviders.length > 0"
>
<auth-providers :oauthProviders="config.auth.oauthProviders" />
</div>
<p class="control">
<router-link
class="button is-text"
:to="{ name: RouteName.SEND_PASSWORD_RESET, params: { email: credentials.email } }"
:to="{
name: RouteName.SEND_PASSWORD_RESET,
params: { email: credentials.email },
}"
>{{ $t("Forgot your password ?") }}</router-link
>
</p>
<router-link
class="button is-text"
:to="{ name: RouteName.RESEND_CONFIRMATION, params: { email: credentials.email } }"
:to="{
name: RouteName.RESEND_CONFIRMATION,
params: { email: credentials.email },
}"
>{{ $t("Didn't receive the instructions?") }}</router-link
>
<p class="control" v-if="config && config.registrationsOpen">
@@ -101,10 +123,20 @@ import { Route } from "vue-router";
import { ICurrentUser } from "@/types/current-user.model";
import { LoginError, LoginErrorCode } from "@/types/enums";
import { LOGIN } from "../../graphql/auth";
import { validateEmailField, validateRequiredField } from "../../utils/validators";
import { initializeCurrentActor, NoIdentitiesException, saveUserData } from "../../utils/auth";
import {
validateEmailField,
validateRequiredField,
} from "../../utils/validators";
import {
initializeCurrentActor,
NoIdentitiesException,
saveUserData,
} from "../../utils/auth";
import { ILogin } from "../../types/login.model";
import { CURRENT_USER_CLIENT, UPDATE_CURRENT_USER_CLIENT } from "../../graphql/user";
import {
CURRENT_USER_CLIENT,
UPDATE_CURRENT_USER_CLIENT,
} from "../../graphql/user";
import RouteName from "../../router/name";
import { CONFIG } from "../../graphql/config";
import { IConfig } from "../../types/config.model";

View File

@@ -2,9 +2,13 @@
<section class="section container columns is-mobile is-centered">
<div class="card column is-half-desktop">
<h1>{{ $t("Password reset") }}</h1>
<b-message title="Error" type="is-danger" v-for="error in errors" :key="error">{{
error
}}</b-message>
<b-message
title="Error"
type="is-danger"
v-for="error in errors"
:key="error"
>{{ error }}</b-message
>
<form @submit="resetAction">
<b-field :label="$t('Password')">
<b-input

View File

@@ -13,13 +13,20 @@ export default class ProviderValidate extends Vue {
const refreshToken = this.getValueFromMeta("auth-refresh-token");
const userId = this.getValueFromMeta("auth-user-id");
const userEmail = this.getValueFromMeta("auth-user-email");
const userRole = this.getValueFromMeta("auth-user-role") as ICurrentUserRole;
const userRole = this.getValueFromMeta(
"auth-user-role"
) as ICurrentUserRole;
if (!(userId && userEmail && userRole && accessToken && refreshToken)) {
await this.$router.push("/");
} else {
const login = {
user: { id: userId, email: userEmail, role: userRole, isLoggedIn: true },
user: {
id: userId,
email: userEmail,
role: userRole,
isLoggedIn: true,
},
accessToken,
refreshToken,
};
@@ -39,7 +46,10 @@ export default class ProviderValidate extends Vue {
const { loggedUser } = data;
if (loggedUser.defaultActor) {
await changeIdentity(this.$apollo.provider.defaultClient, loggedUser.defaultActor);
await changeIdentity(
this.$apollo.provider.defaultClient,
loggedUser.defaultActor
);
await this.$router.push({ name: RouteName.HOME });
} else {
// If the user didn't register any profile yet, let's create one for them

View File

@@ -3,13 +3,24 @@
<section class="hero">
<div class="hero-body">
<h1 class="title">
{{ $t("Register an account on {instanceName}!", { instanceName: config.name }) }}
{{
$t("Register an account on {instanceName}!", {
instanceName: config.name,
})
}}
</h1>
<i18n tag="p" path="{instanceName} is an instance of the {mobilizon} software.">
<i18n
tag="p"
path="{instanceName} is an instance of the {mobilizon} software."
>
<b slot="instanceName">{{ config.name }}</b>
<a href="https://joinmobilizon.org" target="_blank" class="out" slot="mobilizon">{{
$t("Mobilizon")
}}</a>
<a
href="https://joinmobilizon.org"
target="_blank"
class="out"
slot="mobilizon"
>{{ $t("Mobilizon") }}</a
>
</i18n>
</div>
</section>
@@ -21,10 +32,26 @@
<div class="content">
<ul>
<li>{{ $t("To create and manage your events") }}</li>
<li>{{ $t("To create and manage multiples identities from a same account") }}</li>
<li>{{ $t("To register for an event by choosing one of your identities") }}</li>
<li>
{{
$t(
"To create and manage multiples identities from a same account"
)
}}
</li>
<li>
{{
$t(
"To register for an event by choosing one of your identities"
)
}}
</li>
<li v-if="config.features.groups">
{{ $t("To create or join an group and start organizing with other people") }}
{{
$t(
"To create or join an group and start organizing with other people"
)
}}
</li>
</ul>
</div>
@@ -34,7 +61,9 @@
}}</router-link>
<hr />
<div class="content">
<subtitle>{{ $t("About {instance}", { instance: config.name }) }}</subtitle>
<subtitle>{{
$t("About {instance}", { instance: config.name })
}}</subtitle>
<div class="content" v-html="config.description"></div>
<i18n
path="Please read the {fullRules} published by {instance}'s administrators."
@@ -87,13 +116,22 @@
</b-field>
<b-checkbox required>
<i18n tag="span" path="I agree to the {instanceRules} and {termsOfService}">
<router-link class="out" slot="instanceRules" :to="{ name: RouteName.RULES }">{{
$t("instance rules")
}}</router-link>
<router-link class="out" slot="termsOfService" :to="{ name: RouteName.TERMS }">{{
$t("terms of service")
}}</router-link>
<i18n
tag="span"
path="I agree to the {instanceRules} and {termsOfService}"
>
<router-link
class="out"
slot="instanceRules"
:to="{ name: RouteName.RULES }"
>{{ $t("instance rules") }}</router-link
>
<router-link
class="out"
slot="termsOfService"
:to="{ name: RouteName.TERMS }"
>{{ $t("terms of service") }}</router-link
>
</i18n>
</b-checkbox>
@@ -111,7 +149,10 @@
<p class="control has-text-centered">
<router-link
class="button is-text"
:to="{ name: RouteName.RESEND_CONFIRMATION, params: { email: credentials.email } }"
:to="{
name: RouteName.RESEND_CONFIRMATION,
params: { email: credentials.email },
}"
>{{ $t("Didn't receive the instructions?") }}</router-link
>
</p>
@@ -120,20 +161,28 @@
class="button is-text"
:to="{
name: RouteName.LOGIN,
params: { email: credentials.email, password: credentials.password },
params: {
email: credentials.email,
password: credentials.password,
},
}"
>{{ $t("Login") }}</router-link
>
</p>
<hr />
<div class="control" v-if="config && config.auth.oauthProviders.length > 0">
<div
class="control"
v-if="config && config.auth.oauthProviders.length > 0"
>
<auth-providers :oauthProviders="config.auth.oauthProviders" />
</div>
</form>
<div v-if="errors.length > 0">
<b-message type="is-danger" v-for="error in errors" :key="error">{{ error }}</b-message>
<b-message type="is-danger" v-for="error in errors" :key="error">{{
error
}}</b-message>
</div>
</div>
</div>
@@ -211,10 +260,13 @@ export default class Register extends Vue {
});
} catch (error) {
console.error(error);
this.errors = error.graphQLErrors.reduce((acc: { [key: string]: any }, localError: any) => {
acc[localError.field] = localError.message;
return acc;
}, {});
this.errors = error.graphQLErrors.reduce(
(acc: { [key: string]: any }, localError: any) => {
acc[localError.field] = localError.message;
return acc;
},
{}
);
this.sendingForm = false;
}
}

View File

@@ -7,15 +7,22 @@
</h1>
<form v-if="!validationSent" @submit="resendConfirmationAction">
<b-field :label="$t('Email address')">
<b-input aria-required="true" required type="email" v-model="credentials.email" />
<b-input
aria-required="true"
required
type="email"
v-model="credentials.email"
/>
</b-field>
<p class="control">
<b-button type="is-primary" native-type="submit">
{{ $t("Send the confirmation email again") }}
</b-button>
<router-link :to="{ name: RouteName.LOGIN }" class="button is-text">{{
$t("Cancel")
}}</router-link>
<router-link
:to="{ name: RouteName.LOGIN }"
class="button is-text"
>{{ $t("Cancel") }}</router-link
>
</p>
</form>
<div v-else>
@@ -28,7 +35,11 @@
}}
</b-message>
<b-message type="is-info">
{{ $t("Please check your spam folder if you didn't receive the email.") }}
{{
$t(
"Please check your spam folder if you didn't receive the email."
)
}}
</b-message>
</div>
</div>
@@ -38,7 +49,10 @@
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { validateEmailField, validateRequiredField } from "../../utils/validators";
import {
validateEmailField,
validateRequiredField,
} from "../../utils/validators";
import { RESEND_CONFIRMATION_EMAIL } from "../../graphql/auth";
import RouteName from "../../router/name";

View File

@@ -23,23 +23,38 @@
</b-message>
<form @submit="sendResetPasswordTokenAction" v-if="!validationSent">
<b-field :label="$t('Email address')">
<b-input aria-required="true" required type="email" v-model="credentials.email" />
<b-input
aria-required="true"
required
type="email"
v-model="credentials.email"
/>
</b-field>
<p class="control">
<b-button type="is-primary" native-type="submit">
{{ $t("Submit") }}
</b-button>
<router-link :to="{ name: RouteName.LOGIN }" class="button is-text">{{
$t("Cancel")
}}</router-link>
<router-link
:to="{ name: RouteName.LOGIN }"
class="button is-text"
>{{ $t("Cancel") }}</router-link
>
</p>
</form>
<div v-else>
<b-message type="is-success" :closable="false" title="Success">
{{ $t("We just sent an email to {email}", { email: credentials.email }) }}
{{
$t("We just sent an email to {email}", {
email: credentials.email,
})
}}
</b-message>
<b-message type="is-info">
{{ $t("Please check your spam folder if you didn't receive the email.") }}
{{
$t(
"Please check your spam folder if you didn't receive the email."
)
}}
</b-message>
</div>
</div>
@@ -49,7 +64,10 @@
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import { validateEmailField, validateRequiredField } from "../../utils/validators";
import {
validateEmailField,
validateRequiredField,
} from "../../utils/validators";
import { SEND_RESET_PASSWORD } from "../../graphql/auth";
import RouteName from "../../router/name";

View File

@@ -56,9 +56,12 @@ import { IConfig } from "../../types/config.model";
@Component({
components: {
NotificationsOnboarding: () => import("../../components/Settings/NotificationsOnboarding.vue"),
SettingsOnboarding: () => import("../../components/Settings/SettingsOnboarding.vue"),
ProfileOnboarding: () => import("../../components/Account/ProfileOnboarding.vue"),
NotificationsOnboarding: () =>
import("../../components/Settings/NotificationsOnboarding.vue"),
SettingsOnboarding: () =>
import("../../components/Settings/SettingsOnboarding.vue"),
ProfileOnboarding: () =>
import("../../components/Account/ProfileOnboarding.vue"),
},
apollo: {
config: TIMEZONES,

View File

@@ -1,11 +1,18 @@
<template>
<section class="section container">
<h1 class="title" v-if="loading">{{ $t("Your account is being validated") }}</h1>
<h1 class="title" v-if="loading">
{{ $t("Your account is being validated") }}
</h1>
<div v-else>
<div v-if="failed">
<b-message :title="$t('Error while validating account')" type="is-danger">
<b-message
:title="$t('Error while validating account')"
type="is-danger"
>
{{
$t("Either the account is already validated, either the validation token is incorrect.")
$t(
"Either the account is already validated, either the validation token is incorrect."
)
}}
</b-message>
</div>
@@ -60,7 +67,10 @@ export default class Validate extends Vue {
});
if (user.defaultActor) {
await changeIdentity(this.$apollo.provider.defaultClient, user.defaultActor);
await changeIdentity(
this.$apollo.provider.defaultClient,
user.defaultActor
);
await this.$router.push({ name: RouteName.HOME });
} else {
// If the user didn't register any profile yet, let's create one for them