Improve Registration / Login UI

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-10-10 14:20:09 +02:00
parent e56854f13b
commit 8d88aa1450
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
5 changed files with 157 additions and 138 deletions

View File

@ -1,70 +1,60 @@
<template> <template>
<div> <section class="container">
<section class="hero"> <div class="columns is-mobile is-centered">
<div class="hero-body"> <div class="column is-half-desktop">
<h1 class="title"> <h1 class="title">
{{ $t('Register an account on Mobilizon!') }} {{ $t('Register an account on Mobilizon!') }}
</h1> </h1>
</div> <form v-if="!validationSent">
</section> <b-field
<section> :label="$t('Username')"
<div class="container"> :type="errors.preferred_username ? 'is-danger' : null"
<div class="columns is-mobile"> :message="errors.preferred_username"
<div class="column"> >
<form v-if="!validationSent"> <b-field>
<b-field <b-input
:label="$t('Username')" aria-required="true"
:type="errors.preferred_username ? 'is-danger' : null" required
:message="errors.preferred_username" expanded
> v-model="person.preferredUsername"
<b-field> />
<b-input <p class="control">
aria-required="true" <span class="button is-static">@{{ host }}</span>
required </p>
expanded </b-field>
v-model="person.preferredUsername" </b-field>
/>
<p class="control">
<span class="button is-static">@{{ host }}</span>
</p>
</b-field>
</b-field>
<b-field :label="$t('Displayed name')"> <b-field :label="$t('Displayed name')">
<b-input v-model="person.name"/> <b-input v-model="person.name"/>
</b-field> </b-field>
<b-field :label="$t('Description')"> <b-field :label="$t('Description')">
<b-input type="textarea" v-model="person.summary"/> <b-input type="textarea" v-model="person.summary"/>
</b-field> </b-field>
<b-field grouped> <p class="control has-text-centered">
<div class="control"> <b-button type="is-primary" size="is-large" @click="submit()">
<button type="button" class="button is-primary" @click="submit()"> {{ $t('Create my profile') }}
{{ $t('Create my profile') }} </b-button>
</button> </p>
</div> </form>
</b-field>
</form>
<div v-if="validationSent && !userAlreadyActivated"> <div v-if="validationSent && !userAlreadyActivated">
<b-message title="Success" type="is-success"> <b-message title="Success" type="is-success" closable="false">
<h2 class="title"> <h2 class="title">
{{ $t('Your account is nearly ready, {username}', { username: person.preferredUsername }) }} {{ $t('Your account is nearly ready, {username}', { username: person.preferredUsername }) }}
</h2> </h2>
<p> <p>
{{ $t('A validation email was sent to {email}', { email }) }} {{ $t('A validation email was sent to {email}', { email }) }}
</p> </p>
<p> <p>
{{ $t('Before you can login, you need to click on the link inside it to validate your account') }} {{ $t('Before you can login, you need to click on the link inside it to validate your account') }}
</p> </p>
</b-message> </b-message>
</div>
</div>
</div> </div>
</div> </div>
</section> </div>
</div> </section>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -88,7 +78,7 @@ export default class Register extends Vue {
validationSent: boolean = false; validationSent: boolean = false;
sendingValidation: boolean = false; sendingValidation: boolean = false;
async mounted() { async created() {
// Make sure no one goes to this page if we don't want to // Make sure no one goes to this page if we don't want to
if (!this.email) { if (!this.email) {
await this.$router.replace({ name: RouteName.PAGE_NOT_FOUND }); await this.$router.replace({ name: RouteName.PAGE_NOT_FOUND });
@ -134,7 +124,7 @@ export default class Register extends Vue {
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.avatar-enter-active { .avatar-enter-active {
transition: opacity 1s ease; transition: opacity 1s ease;
} }
@ -147,4 +137,8 @@ export default class Register extends Vue {
.avatar-leave { .avatar-leave {
display: none; display: none;
} }
.container .columns {
margin: 1rem auto 3rem;
}
</style> </style>

View File

@ -1,18 +1,15 @@
<template> <template>
<div class="container"> <div class="container">
<section class="hero">
<h1 class="title">
{{ $t('Welcome back!') }}
</h1>
</section>
<b-message v-if="errorCode === LoginErrorCode.NEED_TO_LOGIN" title="Info" type="is-info"> <b-message v-if="errorCode === LoginErrorCode.NEED_TO_LOGIN" title="Info" type="is-info">
{{ $t('You need to login.') }} {{ $t('You need to login.') }}
</b-message> </b-message>
<section v-if="!currentUser.isLoggedIn"> <section v-if="!currentUser.isLoggedIn">
<div class="columns is-mobile is-centered"> <div class="columns is-mobile is-centered">
<div class="column is-half"> <div class="column is-half-desktop">
<h1 class="title">
{{ $t('Welcome back!') }}
</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="loginAction"> <form @submit="loginAction">
<b-field :label="$t('Email')"> <b-field :label="$t('Email')">
@ -29,27 +26,27 @@
/> />
</b-field> </b-field>
<div class="control has-text-centered"> <p class="control has-text-centered">
<button class="button is-primary is-large"> <button class="button is-primary is-large">
{{ $t('Login') }} {{ $t('Login') }}
</button> </button>
</div> </p>
<div class="control"> <p class="control">
<router-link <router-link
class="button is-text" 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 ?') }} {{ $t('Forgot your password ?') }}
</router-link> </router-link>
</div> </p>
<div class="control" v-if="config && config.registrationsOpen"> <p class="control" v-if="config && config.registrationsOpen">
<router-link <router-link
class="button is-text" class="button is-text"
:to="{ name: RouteName.REGISTER, params: { default_email: credentials.email, default_password: credentials.password }}" :to="{ name: RouteName.REGISTER, params: { default_email: credentials.email, default_password: credentials.password }}"
> >
{{ $t('Register') }} {{ $t('Register') }}
</router-link> </router-link>
</div> </p>
</form> </form>
</div> </div>
</div> </div>
@ -166,3 +163,9 @@ export default class Login extends Vue {
} }
} }
</script> </script>
<style lang="scss" scoped>
.container .columns {
margin: 1rem auto 3rem;
}
</style>

View File

@ -11,7 +11,7 @@
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<div class="content"> <div class="content">
<h3 class="title">{{ $t('Features') }}</h3> <h2 class="title">{{ $t('Features') }}</h2>
<ul> <ul>
<li>{{ $t('Create your communities and your events') }}</li> <li>{{ $t('Create your communities and your events') }}</li>
<li>{{ $t('Other stuff…') }}</li> <li>{{ $t('Other stuff…') }}</li>
@ -22,7 +22,7 @@
</router-link> </router-link>
<hr> <hr>
<div class="content"> <div class="content">
<h3 class="title">{{ $t('About this instance') }}</h3> <h2 class="title">{{ $t('About this instance') }}</h2>
<p> <p>
{{ $t("Your local administrator resumed it's policy:") }} {{ $t("Your local administrator resumed it's policy:") }}
</p> </p>
@ -67,30 +67,28 @@
/> />
</b-field> </b-field>
<b-field grouped> <p class="control has-text-centered">
<div class="control"> <button class="button is-primary is-large">
<button class="button is-primary"> {{ $t('Register') }}
{{ $t('Register') }} </button>
</button> </p>
</div> <p class="control">
<div class="control"> <router-link
<router-link class="button is-text"
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 ?") }}
{{ $t("Didn't receive the instructions ?") }} </router-link>
</router-link> </p>
</div> <p class="control">
<div class="control"> <router-link
<router-link class="button is-text"
class="button is-text" :to="{ name: RouteName.LOGIN, params: { email: credentials.email, password: credentials.password }}"
:to="{ name: RouteName.LOGIN, params: { email: credentials.email, password: credentials.password }}" :disabled="sendingValidation"
:disabled="sendingValidation" >
> {{ $t('Login') }}
{{ $t('Login') }} </router-link>
</router-link> </p>
</div>
</b-field>
</form> </form>
<div v-if="errors.length > 0"> <div v-if="errors.length > 0">
@ -167,7 +165,11 @@ export default class Register extends Vue {
display: none; display: none;
} }
h3.title { .container .columns {
margin: 1rem auto 3rem;
}
h2.title {
background: $secondary; background: $secondary;
display: inline; display: inline;
} }

View File

@ -1,24 +1,28 @@
<template> <template>
<section class="container"> <section class="container">
<div class="column"> <div class="columns is-mobile is-centered">
<h1 class="title"> <div class="column is-half-desktop">
{{ $t('Resend confirmation email') }} <h1 class="title">
</h1> {{ $t('Resend confirmation email') }}
<form v-if="!validationSent" @submit="resendConfirmationAction"> </h1>
<b-field label="Email"> <form v-if="!validationSent" @submit="resendConfirmationAction">
<b-input aria-required="true" required type="email" v-model="credentials.email"/> <b-field label="Email">
</b-field> <b-input aria-required="true" required type="email" v-model="credentials.email"/>
<button class="button is-primary"> </b-field>
{{ $t('Send confirmation email again') }} <p class="control has-text-centered">
</button> <b-button type="is-primary">
</form> {{ $t('Send me the confirmation email once again') }}
<div v-else> </b-button>
<b-message type="is-success" :closable="false" title="Success"> </p>
{{ $t('If an account with this email exists, we just sent another confirmation email to {email}', {email: credentials.email}) }} </form>
</b-message> <div v-else>
<b-message type="is-info"> <b-message type="is-success" :closable="false" title="Success">
{{ $t("Please check your spam folder if you didn't receive the email.") }} {{ $t('If an account with this email exists, we just sent another confirmation email to {email}', {email: credentials.email}) }}
</b-message> </b-message>
<b-message type="is-info">
{{ $t("Please check your spam folder if you didn't receive the email.") }}
</b-message>
</div>
</div> </div>
</div> </div>
</section> </section>
@ -73,3 +77,9 @@ export default class ResendConfirmation extends Vue {
} }
} }
</script> </script>
<style lang="scss" scoped>
.container .columns {
margin: 1rem auto 3rem;
}
</style>

View File

@ -1,25 +1,29 @@
<template> <template>
<section class="container"> <section class="container">
<div class="column"> <div class="columns is-mobile is-centered">
<h1 class="title"> <div class="column is-half-desktop">
{{ $t('Password reset') }} <h1 class="title">
</h1> {{ $t('Password reset') }}
<b-message title="Error" type="is-danger" v-for="error in errors" :key="error">{{ error }}</b-message> </h1>
<form @submit="sendResetPasswordTokenAction" v-if="!validationSent"> <b-message title="Error" type="is-danger" v-for="error in errors" :key="error">{{ error }}</b-message>
<b-field label="Email"> <form @submit="sendResetPasswordTokenAction" v-if="!validationSent">
<b-input aria-required="true" required type="email" v-model="credentials.email"/> <b-field label="Email">
</b-field> <b-input aria-required="true" required type="email" v-model="credentials.email"/>
<button class="button is-primary"> </b-field>
{{ $t('Send email to reset my password') }} <p class="control has-text-centered">
</button> <b-button type="is-primary">
</form> {{ $t('Send me an email to reset my password') }}
<div v-else> </b-button>
<b-message type="is-success" :closable="false" title="Success"> </p>
{{ $t('We just sent an email to {email}', {email: credentials.email}) }} </form>
</b-message> <div v-else>
<b-message type="is-info"> <b-message type="is-success" :closable="false" title="Success">
{{ $t("Please check your spam folder if you didn't receive the email.") }} {{ $t('We just sent an email to {email}', {email: credentials.email}) }}
</b-message> </b-message>
<b-message type="is-info">
{{ $t("Please check your spam folder if you didn't receive the email.") }}
</b-message>
</div>
</div> </div>
</div> </div>
</section> </section>
@ -85,3 +89,9 @@ export default class SendPasswordReset extends Vue {
} }
} }
</script> </script>
<style lang="scss" scoped>
.container .columns {
margin: 1rem auto 3rem;
}
</style>