diff --git a/.env.example b/.env.example index 907bb477..cd7fdb90 100644 --- a/.env.example +++ b/.env.example @@ -37,3 +37,4 @@ VANILLA_FORUM_SECRET= DISQUS_API_KEY= DISQUS_API_SECRET= DISQUS_DOMAIN= +DISQUS_ENABLED=false diff --git a/app/Http/Controllers/AccountApiController.php b/app/Http/Controllers/AccountApiController.php index 14b81839..cf635e4d 100644 --- a/app/Http/Controllers/AccountApiController.php +++ b/app/Http/Controllers/AccountApiController.php @@ -52,8 +52,8 @@ public function update($id) if (!Input::has('password')) { $this->validator->setData(Input::except(['password', 'password_confirmation'])); } - $input = $this->validator->validate('update'); $user = $this->userRepo->getById($id); + $input = $this->validator->bind('nickName', ['userId' => $user->id])->validate('update'); $this->userRepo->update($user, $input); return Response::json(['success' => true]); } catch (ValidationException $e) { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index b1160400..03821542 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -38,7 +38,7 @@ function ($view) { if ($user) { $data = [ "id" => $user["id"], - "username" => $user["firstName"] . ' ' . $user["lastName"], + "username" => $user->getPresenter()->displayName(), "email" => $user["email"], //"avatar" => $user["avatar"], ]; diff --git a/config/disqus.php b/config/disqus.php index 2f65c80a..6054d1d5 100644 --- a/config/disqus.php +++ b/config/disqus.php @@ -3,5 +3,5 @@ 'api_key' => env('DISQUS_API_KEY', ''), 'api_secret' => env('DISQUS_API_SECRET', ''), 'domain' => env('DISQUS_DOMAIN', ''), //.disqus.com/embed.js - 'enabled' => false, + 'enabled' => env('DISQUS_ENABLED', 'false'), ]; diff --git a/config/gzero.php b/config/gzero.php index 3f4468b3..31abbfab 100644 --- a/config/gzero.php +++ b/config/gzero.php @@ -6,6 +6,7 @@ 'seoTitleAlternativeField' => 'title', 'seoDescriptionAlternativeField' => 'body', 'seoDescLength' => 160, + 'useUsersNickNames' => true, 'siteDesc' => 'Content management system.', 'multilang' => [ 'enabled' => true, diff --git a/resources/lang/en/common.php b/resources/lang/en/common.php index 5fd521be..b383082f 100644 --- a/resources/lang/en/common.php +++ b/resources/lang/en/common.php @@ -33,10 +33,12 @@ 'loginWith' => 'or sign in with', 'logout' => 'Logout', 'newPassword' => 'New password', + 'nickName' => 'Nick name', 'noTranslation' => 'No translation', 'notAMember' => 'Not a member yet?', 'notPublished' => 'Not published', 'numberOfViews' => 'Number of views:', + 'optional' => 'optional', 'options' => 'Options', 'order' => 'Order', 'pageNotFound' => 'Page not found', diff --git a/resources/lang/pl/common.php b/resources/lang/pl/common.php index 7ddf4890..c7b90903 100644 --- a/resources/lang/pl/common.php +++ b/resources/lang/pl/common.php @@ -33,10 +33,12 @@ 'loginWith' => 'lub zaloguj się z', 'logout' => 'Wyloguj', 'newPassword' => 'Nowe hasło', + 'nickName' => 'Nick', 'noTranslation' => 'Brak tłumaczenia', 'notAMember' => 'Nie masz jeszcze konta?', 'notPublished' => 'Niepublikowany', 'numberOfViews' => 'Liczba wyświetleń:', + 'optional' => 'opcjonalnie', 'options' => 'Opcje', 'order' => 'Kolejność', 'pageNotFound' => 'Nie znaleziono strony', diff --git a/resources/views/account/edit.blade.php b/resources/views/account/edit.blade.php index 7213dbb3..2f01ad62 100644 --- a/resources/views/account/edit.blade.php +++ b/resources/views/account/edit.blade.php @@ -15,6 +15,15 @@
+
+ + + @if($errors->first('nickName')) +

{{ $errors->first('nickName') }}

+ @endif +
-

{{ Auth::user()->firstName }} {{ Auth::user()->lastName }}

+

{{ Auth::user()->getPresenter()->displayName() }}

@foreach($menu as $link)
  • @if($link['children']) diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 48c67cf9..12ddeb0b 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -19,11 +19,20 @@

    {{ $errors->first('email') }}

    @endif
  • +
    + + + @if($errors->first('nickName')) +

    {{ $errors->first('nickName') }}

    + @endif +
    + placeholder="@lang('common.firstName') (@lang('common.optional'))"> @if($errors->first('firstName'))

    {{ $errors->first('firstName') }}

    @endif @@ -32,7 +41,7 @@ + placeholder="@lang('common.lastName') (@lang('common.optional'))"> @if($errors->first('lastName'))

    {{ $errors->first('lastName') }}

    @endif diff --git a/resources/views/includes/navbar.blade.php b/resources/views/includes/navbar.blade.php index 3b74cb6c..4d6af022 100644 --- a/resources/views/includes/navbar.blade.php +++ b/resources/views/includes/navbar.blade.php @@ -35,7 +35,7 @@ - {{ Auth::user()->firstName }} {{ Auth::user()->lastName }} + {{ Auth::user()->getPresenter()->displayName() }}