Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine committed Oct 12, 2023
1 parent 986f8e7 commit 0ab16b6
Show file tree
Hide file tree
Showing 28 changed files with 260 additions and 41 deletions.
10 changes: 8 additions & 2 deletions resources/js/Layouts/AuthLayout.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<script setup lang="ts">
import { config } from "@/utils/config";
defineProps<{
showSiteName?: boolean,
}>()
</script>

<template>
Expand All @@ -23,9 +27,11 @@
<slot name="prepend" />

<div class="bg-white rounded p-4 border-0 mb-3">
<template v-if="config('sharp.name') !== 'Sharp'">
<template v-if="showSiteName && config('sharp.name') !== 'Sharp'">
<div class="card-header bg-transparent border-0 pb-0 pt-4">
<h1 class="text-center card-title mb-0 fs-4">{{ config("sharp.name") }}</h1>
<h1 class="text-center card-title mb-0 fs-4">
{{ config("sharp.name") }}
</h1>
</div>
</template>

Expand Down
49 changes: 49 additions & 0 deletions resources/js/Pages/Auth/ForgotPassword.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<script setup lang="ts">
import AuthLayout from "@/Layouts/AuthLayout.vue";
import Title from "@/components/Title.vue";
import { __ } from "sharp/utils/i18n";
import { useForm } from "@inertiajs/vue3";
import TextInput from "@sharp/form/src/components/fields/text/TextInput.vue";
import { Button } from "@sharp/ui";
const props = defineProps<{
status: string,
}>();
const form = useForm({
email: '',
});
</script>

<template>
<AuthLayout>
<Title>
{{ __('sharp::pages/auth/forgot-password.title') }}
</Title>

<div class="text-sm text-gray-700 mb-4">
{{ __('sharp::pages/auth/forgot-password.description') }}
</div>

<form @submit.prevent="form.post(route('code16.sharp.password.reset.post'))">
<TextInput
id="email"
v-model="form.email"
:has-error="!!form.errors.email"
:placeholder="__('sharp::pages/auth/forgot-password.email_field')"
autofocus
/>
<template v-if="form.errors.email">
<p class="mt-2 text-sm text-red-600">
{{ form.errors.email }}
</p>
</template>

<div class="mt-4">
<Button class="w-full" type="submit">
{{ __('sharp::pages/auth/forgot-password.submit') }}
</Button>
</div>
</form>
</AuthLayout>
</template>
22 changes: 15 additions & 7 deletions resources/js/Pages/Auth/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@


<template>
<AuthLayout>
<AuthLayout show-site-name>
<Title>
{{ __('sharp::login.login_page_title') }}
{{ __('sharp::pages/auth/login.title') }}
</Title>
<template v-if="form.hasErrors" #prepend>
<div class="rounded-md bg-red-100 p-4 mb-4">
Expand All @@ -30,29 +30,37 @@
<form @submit.prevent="form.post(route('code16.sharp.login.post'))">
<div class="mb-3">
<input type="text" name="login" id="login" class="form-control"
:placeholder="__('sharp::login.login_field')" v-model="form.login" autocomplete="username" autofocus>
:placeholder="__('sharp::pages/auth/login.login_field')" v-model="form.login" autocomplete="username" autofocus>
</div>

<div class="mb-3">
<input type="password" name="password" id="password" class="form-control"
:placeholder="__('sharp::login.password_field')" v-model="form.password" autocomplete="current-password">
:placeholder="__('sharp::pages/auth/login.password_field')" v-model="form.password" autocomplete="current-password">
</div>

<template v-if="config('sharp.auth.forgotten_password.enabled')">
<div class="mb-3 -mt-2">
<a class="font-medium text-xs text-primary-600 hover:text-primary-500" :href="route('code16.sharp.password.request')">
{{ __('sharp::pages/auth/login.forgot_password_link') }}
</a>
</div>
</template>

<template v-if="config('sharp.auth.suggest_remember_me')">
<div class="SharpForm__form-item mb-3">
<div class="SharpCheck form-check mb-0">
<input class="form-check-input" type="checkbox" name="remember"
id="remember" v-model="form.remember">
<label class="form-check-label" for="remember">
{{ __('sharp::login.remember') }}
{{ __('sharp::pages/auth/login.remember') }}
</label>
</div>
</div>
</template>

<div class="text-center mt-4">
<button type="submit" id="submit" class="btn btn-primary btn-lg">
{{ __('sharp::login.button') }}
<button type="submit" id="submit" class="btn btn-primary btn-lg w-full">
{{ __('sharp::pages/auth/login.button') }}
</button>
</div>
</form>
Expand Down
10 changes: 5 additions & 5 deletions resources/js/Pages/Auth/Login2Fa.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
}>();
const form = useForm({
code: "",
code: '',
});
</script>

<template>
<AuthLayout>
<AuthLayout show-site-name>
<Title>
{{ __('sharp::login.login_page_title') }}
{{ __('sharp::pages/auth/login.title') }}
</Title>
<template v-if="form.hasErrors" #prepend>
<div class="rounded-md bg-red-100 p-4 mb-4">
Expand All @@ -31,12 +31,12 @@

<form @submit.prevent="form.post(route('code16.sharp.login.2fa.post'))">
<div class="mb-3">
<input type="text" name="code" id="code" class="form-control" v-model="form.code" :placeholder="__('sharp::login.code_field')">
<input type="text" name="code" id="code" class="form-control" v-model="form.code" :placeholder="__('sharp::pages/auth/login.code_field')">
</div>

<div class="text-center mt-4">
<button type="submit" id="submit" class="btn btn-primary btn-lg">
{{ __('sharp::login.button') }}
{{ __('sharp::pages/auth/login.button') }}
</button>
</div>
</form>
Expand Down
41 changes: 41 additions & 0 deletions resources/js/Pages/Auth/ResetPassword.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<script setup lang="ts">
import AuthLayout from "@/Layouts/AuthLayout.vue";
import Title from "@/components/Title.vue";
import { __ } from "sharp/utils/i18n";
import { useForm } from "@inertiajs/vue3";
import TextInput from "@sharp/form/src/components/fields/text/TextInput.vue";
const props = defineProps<{
token: string,
email: string,
}>();
const form = useForm({
token: props.token,
email: props.email,
password: '',
password_confirmation: '',
});
</script>

<template>
<AuthLayout>
<Title>
{{ __('sharp::auth.reset_password.page_title') }}
</Title>

<template #title>
{{ __('sharp::auth.reset_password.page_title') }}
</template>

<form @submit.prevent="form.post(route('code16.sharp.password.reset.post'))">
<TextInput
id="email"

v-model="form.email"
:has-error="!!form.errors.email"
autofocus
/>
</form>
</AuthLayout>
</template>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'login_page_title' => 'Login',
'title' => 'Login',
'login_field' => 'login',
'password_field' => 'password',
'code_field' => 'code',
Expand Down
9 changes: 9 additions & 0 deletions resources/lang/de/passwords.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

return [
'reset' => 'Das Passwort wurde zurückgesetzt!',
'sent' => 'Passworterinnerung wurde gesendet! (Wenn ein Benutzer mit dieser E-Mail-Adresse verknüpft ist)',
'throttled' => 'Bitte warten Sie, bevor Sie es erneut versuchen.',
'token' => 'Der Passwort-Wiederherstellungs-Schlüssel ist ungültig oder abgelaufen.',
'user' => 'Es konnte leider kein Nutzer mit dieser E-Mail-Adresse gefunden werden.',
];
8 changes: 8 additions & 0 deletions resources/lang/en/pages/auth/forgot-password.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'title' => 'Forgot password',
'description' => 'Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.',
'email_field' => 'Email',
'submit' => 'Email password reset link',
];
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

return [
'login_page_title' => 'Login',
'title' => 'Login',
'login_field' => 'login',
'password_field' => 'password',
'code_field' => 'code',
'remember' => 'Remember me',
'button' => 'Login',
'forgot_password_link' => 'Forgot password?',
];
5 changes: 5 additions & 0 deletions resources/lang/en/pages/auth/reset-password.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'title' => 'Reset password',
];
9 changes: 9 additions & 0 deletions resources/lang/en/passwords.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

return [
'reset' => 'Your password has been reset!',
'sent' => 'We have emailed your password reset link! (If an user is associated with this email address)',
'throttled' => 'Please wait before retrying.',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that email address.",
];
23 changes: 23 additions & 0 deletions resources/lang/es/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@
return [
'validation_error' => 'Por favor, introduce un valor para ambos campos.',
'invalid_credentials' => 'No podemos encontrar un usuario con esos credenciales',
'login' => [
'page_title' => 'Iniciar sesión',
'login_field' => 'login',
'password_field' => 'contraseña',
'code_field' => 'código',
'remember' => 'Mantener sesión activa',
'button' => 'login',
],
'reset_password' => [
'page_title' => 'Restablecer contraseña',
],
'forgot_password' => [
'page_title' => '¿Has olvidado tu contraseña?',
],
'status' => [
'passwords' => [
'reset' => '¡Tu contraseña ha sido restablecida!',
'sent' => '¡Te hemos enviado por correo electrónico el enlace para restablecer tu contraseña! (Si un usuario está asociado a esta dirección de correo electrónico)',
'throttled' => 'Por favor, espera antes de volver a intentarlo.',
'token' => 'Este token de restablecimiento de contraseña no es válido.',
'user' => 'No podemos encontrar un usuario con esa dirección de correo electrónico.',
],
],
'2fa' => [
'validation_error' => 'Introduce un valor para el código.',
'invalid' => 'Este código no es válido.',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'login_page_title' => 'Iniciar sesión',
'title' => 'Iniciar sesión',
'login_field' => 'login',
'password_field' => 'contraseña',
'code_field' => 'código',
Expand Down
9 changes: 9 additions & 0 deletions resources/lang/es/passwords.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

return [
'reset' => 'Su contraseña ha sido restablecida.',
'sent' => 'Le hemos enviado por correo electrónico el enlace para restablecer su contraseña. (Si un usuario está asociado con esta dirección de correo electrónico)',
'throttled' => 'Por favor espere antes de intentar de nuevo.',
'token' => 'El token de restablecimiento de contraseña es inválido.',
'user' => 'No encontramos ningún usuario con ese correo electrónico.',
];
23 changes: 23 additions & 0 deletions resources/lang/fr/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@
return [
'validation_error' => 'Veuillez renseigner les deux champs',
'invalid_credentials' => 'Impossible de trouver un compte avec ces identifiants',
'login' => [
'page_title' => 'Connexion',
'login_field' => 'identifiant',
'password_field' => 'mot de passe',
'code_field' => 'code',
'remember' => 'Rester connecté',
'button' => 'Connexion',
],
'forgot_password' => [
'page_title' => 'Mot de passe oublié',
],
'reset_password' => [
'page_title' => 'Réinitialiser le mot de passe',
],
'status' => [
'passwords' => [
'reset' => 'Votre mot de passe a été réinitialisé !',
'sent' => 'Nous vous avons envoyé par email le lien de réinitialisation de votre mot de passe ! (Si un utilisateur est associé à cette adresse email)',
'throttled' => 'Veuillez patienter avant de réessayer.',
'token' => 'Ce jeton de réinitialisation de mot de passe est invalide.',
'user' => 'Impossible de trouver un compte avec cette adresse email.',
],
],
'2fa' => [
'validation_error' => 'Veuillez saisir le code',
'invalid' => 'Ce code est invalide',
Expand Down
5 changes: 5 additions & 0 deletions resources/lang/fr/pages/auth/forgot-password.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'title' => 'Mot de passe oublié',
];
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php

return [
'login_page_title' => 'Connexion',
'title' => 'Connexion',
'login_field' => 'identifiant',
'password_field' => 'mot de passe',
'code_field' => 'code',
'remember' => 'Rester connecté',
'button' => 'Connexion',
'forgot_password_link' => 'Mot de passe oublié ?',
];
5 changes: 5 additions & 0 deletions resources/lang/fr/pages/auth/reset-password.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
'title' => 'Réinitialiser le mot de passe',
];
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'login_page_title' => '로그인',
'title' => '로그인',
'login_field' => '로그인',
'remember' => '로그인 상태 유지',
'password_field' => '비밀번호',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'login_page_title' => 'Login',
'title' => 'Login',
'login_field' => 'login',
'remember' => 'Onthoud mij',
'password_field' => 'wachtwoord',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'login_page_title' => 'Iniciar sessão',
'title' => 'Iniciar sessão',
'login_field' => 'login',
'remember' => 'Lembre-se de mim',
'password_field' => 'senha',
Expand Down
Loading

0 comments on commit 0ab16b6

Please sign in to comment.