Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding language updates #28

Merged
merged 3 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: tests
name: Authenticaiton Tests

on:
push:
Expand Down
1 change: 1 addition & 0 deletions config/devdojo/auth/descriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
'dev_mode' => 'This is for development mode, when set in Dev Mode Assets will be loaded from Vite',
'enable_2fa' => 'Enable the ability for users to turn on Two Factor Authentication',
'login_show_social_providers' => 'Show the social providers login buttons on the login form',
'social_providers_location' => 'The location of the social provider buttons (top or bottom)',
],
];
30 changes: 0 additions & 30 deletions config/devdojo/auth/fields.php

This file was deleted.

19 changes: 19 additions & 0 deletions config/devdojo/auth/language.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@
'subheadline' => 'Before you can proceed you must verify your email.',
'show_subheadline' => false,
],
'passwordConfirm' => [
'page_title' => 'Confirm Your Password',
'headline' => 'Confirm Password',
'subheadline' => 'Be sure to confirm your password below',
'show_subheadline' => false,
],
'passwordResetRequest' => [
'page_title' => 'Request a Password Reset',
'headline' => 'Reset password',
'subheadline' => 'Enter your email below to reset your password',
'show_subheadline' => false,
],
'passwordReset' => [
'page_title' => 'Reset Your Password',
'headline' => 'Reset Password',
'subheadline' => 'Reset your password below',
'show_subheadline' => false,
],
'twoFactorChallenge' => [
'page_title' => 'Two Factor Challenge',
'headline_auth' => 'Authentication Code',
Expand All @@ -31,4 +49,5 @@
'subheadline_recovery' => 'Please confirm access to your account by entering one of your emergency recovery codes.',
'show_subheadline_recovery' => false,
],

];
25 changes: 0 additions & 25 deletions config/devdojo/auth/pages.php

This file was deleted.

14 changes: 14 additions & 0 deletions config/devdojo/auth/providers.php

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions config/devdojo/auth/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
'dev_mode' => false,
'enable_2fa' => false, // Enable or disable 2FA functionality globally
'login_show_social_providers' => true,
'social_providers_location' => 'bottom',
];
2 changes: 1 addition & 1 deletion public/build/assets/styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/views/components/elements/heading.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@endphp

<div @class([
'flex flex-col sm:mx-auto sm:w-full sm:max-w-md',
'flex flex-col sm:mx-auto sm:w-full mb-5 sm:max-w-md',
'items-start' => $heading_alignment == 'left',
'items-center' => $heading_alignment == 'center',
'items-end' => $heading_alignment == 'right'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
'separator_text' => 'or'
])
@if(count($socialProviders))
@if($separator)
<x-auth::elements.separator class="my-7">{{ $separator_text }}</x-auto::elements.separator>
@if($separator && config('devdojo.auth.settings.social_providers_location') != 'top')
<x-auth::elements.separator class="my-6">{{ $separator_text }}</x-auto::elements.separator>
@endif
<div class="relative space-y-2 w-full">
@foreach($socialProviders as $slug => $provider)
<x-auth::elements.social-button :$slug :$provider />
@endforeach
</div>
@if($separator && config('devdojo.auth.settings.social_providers_location') == 'top')
<x-auth::elements.separator class="my-6">{{ $separator_text }}</x-auto::elements.separator>
@endif
@endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<span class="relative">
<span class="block text-sm font-medium leading-tight text-gray-900">{{ $title ?? '' }}</span>
@if(($description))
@if(($description ?? false))
<span class="text-sm leading-tight text-gray-400">{{ $description }}</span>
@endif
</span>
Expand Down
14 changes: 7 additions & 7 deletions resources/views/includes/setup/preview.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<div x-show="preview" @click="preview=false" x-transition.opacity class="absolute inset-0 z-[98] w-screen h-screen delay-500 bg-black/50" x-cloak></div>
<div :class="{ 'translate-y-full duration-500' : !preview, 'translate-y-0 pt-3 duration-300' : preview }"
<div x-on:click="preview=true" x-show="!preview" class="flex fixed right-0 bottom-0 z-50 items-center px-4 py-2 mr-3 space-x-1 text-sm bg-white rounded-t-lg border border-b-0 cursor-pointer text-zinc-600 hover:text-zinc-800 border-zinc-200">
<x-phosphor-monitor-bold class="-ml-0.5 w-4 h-4 duration-300 ease-out translate-x-0 group-hover:-translate-x-0.5" />
<span>Open Preview</span>
</div>
<div :class="{ 'translate-y-full duration-500 invisible' : !preview, 'translate-y-0 pt-3 duration-300' : preview }"
class="flex absolute top-0 left-0 px-3 z-[99] ease-in-out flex-col w-screen h-screen" x-cloak>

<div class="flex flex-col w-full h-full bg-white rounded-t-md">
<div class="flex relative z-50 flex-shrink-0 justify-center items-center w-full h-10 bg-white rounded-t-md border-b border-zinc-200">
<div class="relative" x-on:click.outside="previewMenuDropdown=false">
<div x-show="preview" class="relative" x-on:click.outside="previewMenuDropdown=false">
<button x-on:click="previewMenuDropdown=!previewMenuDropdown" class="flex justify-between items-center px-3 w-64 h-7 text-xs rounded-md border cursor-pointer bg-zinc-100 hover:bg-zinc-200/70">
<img src="{{ url(config('devdojo.auth.appearance.favicon.light')) }}" class="w-4 h-4 -translate-x-1.5" />
<span class="font-medium" x-text="previewPageActive.name"></span>
Expand All @@ -21,11 +25,7 @@ class="flex absolute top-0 left-0 px-3 z-[99] ease-in-out flex-col w-screen h-s
<span>Preview in New Tab</span>
<x-phosphor-arrow-right-bold class="flex-shrink-0 ml-1 w-3 h-3 duration-200 ease-out -rotate-45 group-hover:-translate-y-px group-hover:translate-x-px" />
</a>
<button :class="{ '-translate-y-full rounded-t-md border border-zinc-200 shadow-xl' : !preview, 'rounded-tr-md border-l border-zinc-200' : preview }" x-on:click="preview=!preview" class="inline-flex z-50 items-center px-4 h-full text-sm font-medium bg-white hover:bg-zinc-100 group text-zinc-600 hover:text-zinc-800">
<div x-show="!preview" class="flex items-center space-x-1">
<x-phosphor-monitor-bold class="-ml-0.5 w-4 h-4 duration-300 ease-out translate-x-0 group-hover:-translate-x-0.5" />
<span>Open Preview</span>
</div>
<button x-on:click="preview=false" class="inline-flex z-50 items-center px-4 h-full text-sm font-medium bg-white rounded-tr-md border-l hover:bg-zinc-100 group border-zinc-200 text-zinc-600 hover:text-zinc-800">
<div x-show="preview" class="flex items-center space-x-1">
<x-phosphor-x-bold class="-ml-0.5 w-3.5 h-3.5 duration-300 ease-out" />
</div>
Expand Down
10 changes: 7 additions & 3 deletions resources/views/pages/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ public function authenticate()
:description="($language->login->subheadline ?? 'No Description')"
:show_subheadline="($language->login->show_subheadline ?? false)" />

<form wire:submit="authenticate" class="mt-5 space-y-5">
@if(config('devdojo.auth.settings.login_show_social_providers') && config('devdojo.auth.settings.social_providers_location') == 'top')
<x-auth::elements.social-providers />
@endif

<form wire:submit="authenticate" class="space-y-5">

@if($showPasswordField)
<x-auth::elements.input-placeholder value="{{ $email }}">
Expand Down Expand Up @@ -168,8 +172,8 @@ public function authenticate()
<span class="opacity-[47%]">Don't have an account?</span>
<x-auth::elements.text-link href="{{ route('auth.register') }}">Sign up</x-auth::elements.text-link>
</div>

@if(config('devdojo.auth.settings.login_show_social_providers'))
@if(config('devdojo.auth.settings.login_show_social_providers') && config('devdojo.auth.settings.social_providers_location') != 'top')
<x-auth::elements.social-providers />
@endif

Expand Down
14 changes: 10 additions & 4 deletions resources/views/pages/auth/password/[token].blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Devdojo\Auth\Traits\HasConfigs;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
Expand All @@ -15,18 +16,19 @@

new class extends Component
{
use HasConfigs;

#[Validate('required')]
public $token;

#[Validate('required|email')]
public $email;

#[Validate('required|min:8|same:passwordConfirmation')]
public $password;
public $passwordConfirmation;

public function mount($token)
{
$this->loadConfigs();
$this->email = request()->query('email', '');
$this->token = $token;
}
Expand Down Expand Up @@ -69,9 +71,13 @@ function ($user, $password) {
<x-auth::layouts.app>
@volt('auth.password.token')
<x-auth::elements.container>
<x-auth::elements.heading text="Reset password" />
<x-auth::elements.heading
:text="($language->passwordReset->headline ?? 'No Heading')"
:description="($language->passwordReset->subheadline ?? 'No Description')"
:show_subheadline="($language->passwordReset->show_subheadline ?? false)"
/>

<form wire:submit="resetPassword" class="mt-5 space-y-5">
<form wire:submit="resetPassword" class="space-y-5">
<x-auth::elements.input label="Email address" type="email" id="email" name="email" wire:model="email" autofocus="true" />
<x-auth::elements.input label="Password" type="password" id="password" name="password" wire:model="password" />
<x-auth::elements.input label="Confirm Password" type="password" id="password_confirmation" name="password_confirmation" wire:model="passwordConfirmation" />
Expand Down
15 changes: 13 additions & 2 deletions resources/views/pages/auth/password/confirm.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
use function Laravel\Folio\name;
use Livewire\Volt\Component;
use Livewire\Attributes\Validate;
use Devdojo\Auth\Traits\HasConfigs;

name('password.confirm');

new class extends Component
{
use HasConfigs;

#[Validate('required|current_password')]
public $password = '';

public function mount(){
$this->loadConfigs();
}

public function confirm()
{
$this->validate();
Expand All @@ -27,8 +34,12 @@ public function confirm()

@volt('auth.password.confirm')
<x-auth::elements.container>
<x-auth::elements.heading text="Confirm password" description="Please confirm your password before continuing" />
<form wire:submit="confirm" class="mt-5 space-y-5">
<x-auth::elements.heading
:text="($language->passwordConfirm->headline ?? 'No Heading')"
:description="($language->passwordConfirm->subheadline ?? 'No Description')"
:show_subheadline="($language->passwordConfirm->show_subheadline ?? false)"
/>
<form wire:submit="confirm" class="space-y-5">
<x-auth::elements.input label="Password" type="password" id="password" name="password" autofocus="true" wire:model="password" />
<x-auth::elements.button type="primary" rounded="md" submit="true">Confirm password</x-auth::elements.button>
</form>
Expand Down
16 changes: 13 additions & 3 deletions resources/views/pages/auth/password/reset.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Devdojo\Auth\Traits\HasConfigs;
use Illuminate\Support\Facades\Password;
use function Laravel\Folio\name;
use Livewire\Volt\Component;
Expand All @@ -9,11 +10,16 @@

new class extends Component
{
use HasConfigs;

#[Validate('required|email')]
public $email = null;

public $emailSentMessage = false;

public function mount(){
$this->loadConfigs();
}

public function sendResetPasswordLink()
{
$this->validate();
Expand All @@ -38,7 +44,11 @@ public function sendResetPasswordLink()
@volt('auth.password.reset')
<x-auth::elements.container>

<x-auth::elements.heading text="Reset password" />
<x-auth::elements.heading
:text="($language->passwordResetRequest->headline ?? 'No Heading')"
:description="($language->passwordResetRequest->subheadline ?? 'No Description')"
:show_subheadline="($language->passwordResetRequest->show_subheadline ?? false)"
/>

@if ($emailSentMessage)
<div class="p-4 mt-5 bg-green-50 rounded-md dark:bg-green-600">
Expand All @@ -57,7 +67,7 @@ public function sendResetPasswordLink()
</div>
</div>
@else
<form wire:submit="sendResetPasswordLink" class="mt-5 space-y-5">
<form wire:submit="sendResetPasswordLink" class="space-y-5">
<x-auth::elements.input label="Email address" type="email" id="email" name="email" wire:model="email" autofocus="true" />
<x-auth::elements.button type="primary" rounded="md" submit="true">Send password reset link</x-auth::elements.button>
</form>
Expand Down
10 changes: 8 additions & 2 deletions resources/views/pages/auth/register.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ public function register()
:description="($language->register->subheadline ?? 'No Description')"
:show_subheadline="($language->register->show_subheadline ?? false)" />

<form wire:submit="register" class="mt-5 space-y-5">
@if(config('devdojo.auth.settings.social_providers_location') == 'top')
<x-auth::elements.social-providers />
@endif

<form wire:submit="register" class="space-y-5">

@if($showNameField)
<x-auth::elements.input label="Name" type="text" wire:model="name" autofocus="true" required />
Expand All @@ -139,7 +143,9 @@ public function register()
<x-auth::elements.text-link href="{{ route('auth.login') }}">Sign in</x-auth::elements.text-link>
</div>

<x-auth::elements.social-providers />
@if(config('devdojo.auth.settings.social_providers_location') != 'top')
<x-auth::elements.social-providers />
@endif


</x-auth::elements.container>
Expand Down
Loading
Loading