diff --git a/composer.json b/composer.json index f60d4b7b..bc87932c 100644 --- a/composer.json +++ b/composer.json @@ -33,8 +33,7 @@ ], "psr-4": { "Kaleidoscope\\Factotum\\": "src", - "Kaleidoscope\\Factotum\\": "src/app", - "Kaleidoscope\\Factotum\\Models\\": "src/app/Models" + "Kaleidoscope\\Factotum\\Seeds\\": "database/seeds" }, "files": [ "src/app/Library/ContentSearch.php", diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 7ab77b21..9b5db45a 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -1,19 +1,21 @@ getRouter()->pushMiddlewareToGroup('session_start', \Illuminate\Session\Middleware\StartSession::class); - $this->getRouter()->pushMiddlewareToGroup('preflight', \Kaleidoscope\Factotum\Http\Middleware\PreflightResponse::class); - $this->getRouter()->pushMiddlewareToGroup('cors', \Fruitcake\Cors\HandleCors::class); - $this->getRouter()->pushMiddlewareToGroup('add_access_token', \Kaleidoscope\Factotum\Http\Middleware\AddHeaderAccessToken::class); + $this->getRouter()->pushMiddlewareToGroup('session_start', \Illuminate\Session\Middleware\StartSession::class); + $this->getRouter()->pushMiddlewareToGroup('preflight', \Kaleidoscope\Factotum\Http\Middleware\PreflightResponse::class); + $this->getRouter()->pushMiddlewareToGroup('uncomplete_profile', \Kaleidoscope\Factotum\Http\Middleware\UncompleteProfile::class); + $this->getRouter()->pushMiddlewareToGroup('cors', \Fruitcake\Cors\HandleCors::class); + $this->getRouter()->pushMiddlewareToGroup('add_access_token', \Kaleidoscope\Factotum\Http\Middleware\AddHeaderAccessToken::class); @@ -381,7 +382,10 @@ private function _setupRoutes() if ( !file_exists( base_path('routes') . '/web/ecommerce/checkout.php' ) ) { Route::group([ - 'middleware' => [ 'web' ], + 'middleware' => [ + 'web', + 'uncomplete_profile' + ], 'namespace' => 'Kaleidoscope\Factotum\Http\Controllers\Web\Ecommerce\Checkout' ], function ($router) { require __DIR__ . '/routes/web/ecommerce/checkout.php'; @@ -394,7 +398,10 @@ private function _setupRoutes() if ( !file_exists( base_path('routes') . '/web/ecommerce/payment.php' ) ) { Route::group([ - 'middleware' => [ 'web' ], + 'middleware' => [ + 'web', + 'uncomplete_profile' + ], 'namespace' => 'Kaleidoscope\Factotum\Http\Controllers\Web\Ecommerce\Payment' ], function ($router) { require __DIR__ . '/routes/web/ecommerce/payment.php'; @@ -444,22 +451,11 @@ private function _setupRoutes() } + if ( !file_exists( base_path('routes') . '/web/public/web.php' ) ) { + require __DIR__ . '/routes/web/public/web.php'; - - // PAY ATTENTION! - // IF YOU OVERRIDE ONE OF THE DEFAULT FACTOTUM ROUTES, YOU SHOULD ALSO OVERRIDE THE MAIN public/web.php ROUTE FILE - if ( !file_exists( base_path('routes') . '/web.php' ) ) { - // Public routes - Route::group([ - 'middleware' => [ - 'web' - ], - 'namespace' => 'Kaleidoscope\Factotum\Http\Controllers\Web' - ], function ($router) { - require __DIR__ . '/routes/web/public/web.php'; - }); + $overridingRoutes = true; } - } diff --git a/src/app/Console/Commands/FactotumInstallation.php b/src/app/Console/Commands/FactotumInstallation.php index dc6b86cb..5e13d3fb 100644 --- a/src/app/Console/Commands/FactotumInstallation.php +++ b/src/app/Console/Commands/FactotumInstallation.php @@ -28,8 +28,7 @@ public function __construct() $this->installEcommerce = false; $this->installNewsletter = false; $this->reInstall = false; - $this->migrationPath = 'vendor/kaleidoscope/' . ( env('APP_ENV') == 'local' ? 'dev-' : '') - . 'factotum/database/migrations'; + $this->migrationPath = 'vendor/kaleidoscope/factotum/database/migrations'; } @@ -110,7 +109,9 @@ private function _installPassport() private function _dbSeeding() { $this->info('Seeding running...'); - $this->call('db:seed'); + $this->call('db:seed', [ + '--class' => 'Kaleidoscope\Factotum\Seeds\DatabaseSeeder' + ]); $this->info('Seeding done.'); if ( $this->installEcommerce ) { diff --git a/src/app/Helpers/PrintMenuHelper.php b/src/app/Helpers/PrintMenuHelper.php index 3f2c5ab2..35f188cd 100644 --- a/src/app/Helpers/PrintMenuHelper.php +++ b/src/app/Helpers/PrintMenuHelper.php @@ -42,7 +42,7 @@ private static function print_menu_items( $menu, $level = 0 ) } else { $active = false; - $currUrl = trim( Request::url(), '/' ); + $currUrl = trim( request()->url(), '/' ); $checkUrl = trim( $item->abs_url, '/' ); if ( $currUrl == $checkUrl || ( strstr( $currUrl, $checkUrl) && $checkUrl != url('')) ) { $active = true; diff --git a/src/app/Http/Controllers/Api/NewsletterSubscription/CreateController.php b/src/app/Http/Controllers/Api/NewsletterSubscription/CreateController.php index 8572d442..acf65950 100644 --- a/src/app/Http/Controllers/Api/NewsletterSubscription/CreateController.php +++ b/src/app/Http/Controllers/Api/NewsletterSubscription/CreateController.php @@ -2,12 +2,12 @@ namespace Kaleidoscope\Factotum\Http\Controllers\Api\NewsletterSubscription; -use Kaleidoscope\Factotum\Http\Controllers\Api\Controller; +use Kaleidoscope\Factotum\Http\Controllers\Api\ApiBaseController; use Kaleidoscope\Factotum\Http\Requests\StoreNewsletterSubscription; -use Kaleidoscope\Factotum\NewsletterSubscription; +use Kaleidoscope\Factotum\Models\NewsletterSubscription; -class CreateController extends Controller +class CreateController extends ApiBaseController { public function create( StoreNewsletterSubscription $request ) diff --git a/src/app/Http/Controllers/Api/NewsletterSubscription/DeleteController.php b/src/app/Http/Controllers/Api/NewsletterSubscription/DeleteController.php index 08d05188..f37f88b9 100644 --- a/src/app/Http/Controllers/Api/NewsletterSubscription/DeleteController.php +++ b/src/app/Http/Controllers/Api/NewsletterSubscription/DeleteController.php @@ -4,11 +4,11 @@ use Illuminate\Http\Request; -use Kaleidoscope\Factotum\Http\Controllers\Api\Controller; +use Kaleidoscope\Factotum\Http\Controllers\Api\ApiBaseController; +use Kaleidoscope\Factotum\Models\NewsletterSubscription; -use Kaleidoscope\Factotum\NewsletterSubscription; -class DeleteController extends Controller +class DeleteController extends ApiBaseController { public function remove(Request $request, $id) diff --git a/src/app/Http/Controllers/Api/NewsletterSubscription/ReadController.php b/src/app/Http/Controllers/Api/NewsletterSubscription/ReadController.php index 35f29684..a1b767e8 100644 --- a/src/app/Http/Controllers/Api/NewsletterSubscription/ReadController.php +++ b/src/app/Http/Controllers/Api/NewsletterSubscription/ReadController.php @@ -4,12 +4,12 @@ use Illuminate\Http\Request; -use Kaleidoscope\Factotum\Http\Controllers\Api\Controller; +use Kaleidoscope\Factotum\Http\Controllers\Api\ApiBaseController; -use Kaleidoscope\Factotum\NewsletterSubscription; +use Kaleidoscope\Factotum\Models\NewsletterSubscription; -class ReadController extends Controller +class ReadController extends ApiBaseController { public function getListPaginated( Request $request ) diff --git a/src/app/Http/Controllers/Api/NewsletterSubscription/UpdateController.php b/src/app/Http/Controllers/Api/NewsletterSubscription/UpdateController.php index 89da8e4d..8466dc06 100644 --- a/src/app/Http/Controllers/Api/NewsletterSubscription/UpdateController.php +++ b/src/app/Http/Controllers/Api/NewsletterSubscription/UpdateController.php @@ -2,12 +2,13 @@ namespace Kaleidoscope\Factotum\Http\Controllers\Api\NewsletterSubscription; -use Kaleidoscope\Factotum\Http\Controllers\Api\Controller; +use Kaleidoscope\Factotum\Http\Controllers\Api\ApiBaseController; use Kaleidoscope\Factotum\Http\Requests\StoreNewsletterSubscription; -use Kaleidoscope\Factotum\NewsletterSubscription; +use Kaleidoscope\Factotum\Models\NewsletterSubscription; -class UpdateController extends Controller + +class UpdateController extends ApiBaseController { public function update( StoreNewsletterSubscription $request, $id ) diff --git a/src/app/Http/Controllers/Web/Auth/AuthController.php b/src/app/Http/Controllers/Web/Auth/AuthController.php index 1b9e4500..905f9cc1 100644 --- a/src/app/Http/Controllers/Web/Auth/AuthController.php +++ b/src/app/Http/Controllers/Web/Auth/AuthController.php @@ -17,7 +17,9 @@ class AuthController extends Controller { - protected $redirectTo = '/auth/login'; + protected $redirectTo = '/auth/login'; + protected $redirectToEmailNotVerified = '/auth/email-not-verified'; + protected $successRedirectTo = '/?login=ok'; use AuthenticatesUsers; @@ -28,6 +30,7 @@ public function redirectTo() return '/auth/login'; } + public function showLoginForm( Request $request ) { if ( $request->input('abandonedCart') ) { @@ -49,6 +52,24 @@ public function showLoginForm( Request $request ) } + public function showEmailNotVerified( Request $request ) + { + + $view = 'factotum::auth.email-not-verified'; + if ( file_exists( resource_path('views/auth/email-not-verified.blade.php') ) ) { + $view = 'auth.email-not-verified'; + } + + return view($view) + ->with([ + 'metatags' => [ + 'title' => Lang::get('factotum::auth.email_not_verified_title'), + 'description' => Lang::get('factotum::auth.email_not_verified_description') + ] + ]); + } + + protected function sendFailedLoginResponse(Request $request) { $exception = ValidationException::withMessages([ @@ -73,16 +94,26 @@ protected function sendLoginResponse(Request $request) return $request->wantsJson() ? new JsonResponse([], 204) - : redirect()->intended( '/?login=ok' ); + : redirect()->intended( $this->successRedirectTo ); } protected function authenticated(Request $request, $user) { + $user = Auth::user(); + + if ( !$user->email_verified_at ) { + Auth::logout(); + return $request->wantsJson() ? new JsonResponse([], 401) : redirect( $this->redirectToEmailNotVerified ); + } + + if ( !$user->isProfileComplete() ) { + $this->successRedirectTo = '/user/profile?complete_profile=1'; + } + if ( env('FACTOTUM_ECOMMERCE_INSTALLED') ) { if ( $request->session()->get('force_extend_cart') ) { - $user = Auth::user(); $cart = Cart::where( 'customer_id', $user->id )->orderBy('id', 'DESC')->first(); $cart->expires_at = date('Y-m-d H:i:s', time() + 120 ); $cart->save(); diff --git a/src/app/Http/Controllers/Web/Auth/ResetPasswordController.php b/src/app/Http/Controllers/Web/Auth/ResetPasswordController.php index e78685d9..01fa8c6a 100644 --- a/src/app/Http/Controllers/Web/Auth/ResetPasswordController.php +++ b/src/app/Http/Controllers/Web/Auth/ResetPasswordController.php @@ -5,6 +5,8 @@ use Illuminate\Support\Facades\Lang; use Illuminate\Http\Request; use Illuminate\Foundation\Auth\ResetsPasswords; +use Illuminate\Auth\Events\PasswordReset; +use Illuminate\Support\Str; use Kaleidoscope\Factotum\Http\Controllers\Web\Controller; @@ -32,4 +34,29 @@ public function showResetForm(Request $request, $token = null) ] ]); } + + /** + * Reset the given user's password. + * + * @param \Illuminate\Contracts\Auth\CanResetPassword $user + * @param string $password + * @return void + */ + protected function resetPassword($user, $password) + { + $this->setUserPassword($user, $password); + + $user->setRememberToken(Str::random(60)); + $user->email_verified_at = date('Y-m-d H:i:s'); + $user->save(); + + event(new PasswordReset($user)); + + if ( !$user->isProfileComplete() ) { + $this->redirectTo = '/user/profile'; + } + + $this->guard()->login($user); + } + } diff --git a/src/app/Http/Controllers/Web/Ecommerce/User/ProfileController.php b/src/app/Http/Controllers/Web/Ecommerce/User/ProfileController.php index 589202ce..7b5af454 100644 --- a/src/app/Http/Controllers/Web/Ecommerce/User/ProfileController.php +++ b/src/app/Http/Controllers/Web/Ecommerce/User/ProfileController.php @@ -127,6 +127,7 @@ public function saveCustomerAddress( StoreCustomerAddress $request, $type, $cust } + public function setDefaultCustomerAddress( Request $request ) { try { @@ -163,4 +164,34 @@ public function setDefaultCustomerAddress( Request $request ) } } + + public function getProvinceSelect( Request $request ) + { + $view = 'factotum::ecommerce.user.ajax.province-select'; + + if ( file_exists( resource_path('views/ecommerce/user/province-select.blade.php') ) ) { + $view = 'ecommerce.user.ajax.province-select'; + } + + return response()->json([ + 'result' => 'ok', + 'html' => view( $view )->render() + ]); + } + + + public function getProvinceInput( Request $request ) + { + $view = 'factotum::ecommerce.user.ajax.province-input'; + + if ( file_exists( resource_path('views/ecommerce/user/province-input.blade.php') ) ) { + $view = 'ecommerce.user.ajax.province-input'; + } + + return response()->json([ + 'result' => 'ok', + 'html' => view( $view )->render() + ]); + } + } \ No newline at end of file diff --git a/src/app/Http/Controllers/Web/FrontController.php b/src/app/Http/Controllers/Web/FrontController.php index 2866ffbe..3b7944a9 100644 --- a/src/app/Http/Controllers/Web/FrontController.php +++ b/src/app/Http/Controllers/Web/FrontController.php @@ -52,7 +52,6 @@ protected function _getContentByURI() ->first(); - if ( $content ) { $contentType = ContentType::find($content->content_type_id)->toArray(); @@ -64,10 +63,10 @@ protected function _getContentByURI() ->search(); if ( $content ) { - $content[0] = $this->_loadAdditionalData( $content[0] ); + $content = $this->_loadAdditionalData( $content->first() ); } - return ( $content ? $content[0] : null ); + return ( $content ? $content : null ); } else { @@ -164,7 +163,6 @@ protected function _switchContent( $content, $category = null ) } - return [ 'view' => $content->page_template, 'data' => [ 'content' => $content, @@ -361,7 +359,12 @@ public function index( Request $request, $uri = '' ) } elseif ( isset( $data['data'] ) ) { - return view( $data['view'] )->with( $data['data'] ); + $view = 'factotum::' . $data['view']; + if ( file_exists( resource_path('views/' . $data['view'] . '.blade.php') ) ) { + $view = $data['view']; + } + + return view( $view )->with( $data['data'] ); } else { diff --git a/src/app/Http/Controllers/Web/User/ProfileController.php b/src/app/Http/Controllers/Web/User/ProfileController.php index 6fa20302..684d10fd 100644 --- a/src/app/Http/Controllers/Web/User/ProfileController.php +++ b/src/app/Http/Controllers/Web/User/ProfileController.php @@ -2,6 +2,7 @@ namespace Kaleidoscope\Factotum\Http\Controllers\Web\User; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Lang; @@ -14,10 +15,13 @@ class ProfileController extends Controller { - public function showProfileForm() + public function showProfileForm( Request $request ) { + $completeProfile = $request->input('complete_profile'); + return view('factotum::user.profile')->with([ - 'user' => Auth::user(), + 'user' => Auth::user(), + 'completeProfile' => ( isset($completeProfile) ? true : false ), 'metatags' => [ 'title' => Lang::get('factotum::user.profile_title'), 'description' => Lang::get('factotum::user.profile_description') diff --git a/src/app/Http/Middleware/UncompleteProfile.php b/src/app/Http/Middleware/UncompleteProfile.php new file mode 100644 index 00000000..e2b300a4 --- /dev/null +++ b/src/app/Http/Middleware/UncompleteProfile.php @@ -0,0 +1,30 @@ +check() ) { + $user = Auth::user(); + if ( !$user->isProfileComplete() ) { + return redirect('/user/profile?complete_profile=1'); + } + } + + return $next($request); + } + +} diff --git a/src/app/Http/Requests/UpdateUser.php b/src/app/Http/Requests/UpdateUser.php index 6ab7a0b7..5cc0c74b 100644 --- a/src/app/Http/Requests/UpdateUser.php +++ b/src/app/Http/Requests/UpdateUser.php @@ -18,9 +18,12 @@ public function authorize() public function rules() { $rules = [ - 'first_name' => 'required|max:64', - 'last_name' => 'required|max:64', - 'email' => 'required|email|max:128', + 'first_name' => 'required|max:64', + 'last_name' => 'required|max:64', + 'email' => 'required|email|max:128', + 'phone' => 'required', + 'privacy' => 'required', + 'terms_conditions' => 'required' ]; $data = $this->all(); diff --git a/src/app/Library/ContentListParser.php b/src/app/Library/ContentListParser.php index 802b85b1..67e6571e 100644 --- a/src/app/Library/ContentListParser.php +++ b/src/app/Library/ContentListParser.php @@ -67,7 +67,6 @@ private function _listNeededParsing() */ public function getList() { - foreach ( $this->_contentList as $index => $content ) { if ( $content && $content->fb_image ) { @@ -97,7 +96,11 @@ public function getList() foreach ( $this->_fields as $fieldName => $field ) { if ( $field->type == 'file_upload' ) { - $content->{$fieldName} = $this->_getFileData( $content->{$fieldName} ); + if ( $content->{$fieldName} ) { + $content->{$fieldName} = $this->_getFileData( $content->{$fieldName} ); + } else { + $content->{$fieldName} = null; + } } if ( $field->type == 'multiselect' ) { @@ -237,12 +240,13 @@ private function _getMultipleLinkedContentData($value, $fieldModel) $subContentList = $contentSearch->search(true); if ( $subContentList && $subContentList->count() > 0 ) { - $model = json_decode( Storage::get( 'models/' . $fieldModel->linked_content_type->content_type . '.json' ) ); - - $clp = new ContentListParser( $model, $subContentList ); - $clp->enableAvoidDeepLinking(); + return $subContentList; - return $clp->getList(); + // TODO: serve ripetere la get list? +// $model = json_decode( Storage::get( 'models/' . $fieldModel->linked_content_type->content_type . '.json' ) ); +// $clp = new ContentListParser( $model, $subContentList ); +// $clp->enableAvoidDeepLinking(); +// return $clp->getList(); } } } diff --git a/src/app/Library/ContentSearch.php b/src/app/Library/ContentSearch.php index c88fe664..dfad7c87 100644 --- a/src/app/Library/ContentSearch.php +++ b/src/app/Library/ContentSearch.php @@ -32,8 +32,9 @@ class ContentSearch { 'seo_title', 'seo_description', 'seo_canonical_url', 'seo_robots_indexing', 'seo_robots_following', 'fb_title', 'fb_description', 'fb_image', 'contents.created_at', 'contents.updated_at', - 'profiles.first_name', 'profiles.last_name', - 'users.email', 'users.avatar' + + // 'profiles.first_name', 'profiles.last_name', + // 'users.email', 'users.avatar' ]; @@ -61,8 +62,8 @@ public function __construct( $contentType ) $this->_query = DB::table('contents') ->select( DB::raw( $this->_cols ) ) ->leftJoin( $this->_contentType['content_type'], 'contents.id', '=', $this->_contentType['content_type'] . '.content_id') - ->leftJoin( 'users', 'users.id', '=', 'contents.user_id') - ->leftJoin( 'profiles', 'profiles.user_id', '=', 'users.id') + // ->leftJoin( 'users', 'users.id', '=', 'contents.user_id') + // ->leftJoin( 'profiles', 'profiles.user_id', '=', 'users.id') ->where( 'contents.content_type_id', '=', $this->_contentType['id']); @@ -163,6 +164,7 @@ public function loadCategories( $loadCategories ) return $this; } + /** * This function performs a query and returns all the contents that match the search conditions. * diff --git a/src/app/Library/Utility.php b/src/app/Library/Utility.php index fd4028d4..bed22c54 100644 --- a/src/app/Library/Utility.php +++ b/src/app/Library/Utility.php @@ -17,6 +17,15 @@ public static function debug($x) } + public static function jsonDebug( $debug ) + { + header('Accept: application/json'); + header('Content-Type: application/json'); + header('Access-Control-Allow-Origin: *'); + echo json_encode( ['debug' => $debug ] ); + } + + public static function getSqlQuery($query) { $params = array_map(function ($item) { diff --git a/src/app/Mail/CampaignEmail.php b/src/app/Mail/CampaignEmail.php index c35db1de..71ee9f0c 100644 --- a/src/app/Mail/CampaignEmail.php +++ b/src/app/Mail/CampaignEmail.php @@ -20,6 +20,8 @@ class CampaignEmail extends Mailable implements ShouldQueue public function __construct( $campaignTemplate, $campaignEmail = null ) { + $this->queue = 'mailing'; + if ( $campaignEmail ) { $this->_campaignEmail = $campaignEmail; } diff --git a/src/app/Models/Content.php b/src/app/Models/Content.php index 2c81d9ec..3422c8fd 100644 --- a/src/app/Models/Content.php +++ b/src/app/Models/Content.php @@ -14,6 +14,7 @@ class Content extends Model public static $FIRE_EVENTS = true; + protected $fillable = [ 'parent_id', 'user_id', diff --git a/src/app/Models/Media.php b/src/app/Models/Media.php index afecdbbe..6d82f51e 100644 --- a/src/app/Models/Media.php +++ b/src/app/Models/Media.php @@ -124,7 +124,7 @@ public static function retrieve( $mediaId, $fieldModel ) // Dato un Campo e un MediaId, eseguo la funzione saveImage per quell'immagine public static function saveImageById( $field, $mediaId ) { - $media = Media::find( $mediaId ); + $media = Media::findOrFail( $mediaId ); if ( $media && in_array($media->mime_type, [ 'image/jpeg', 'image/png', 'image/gif' ]) ) { return self::saveImage( $field, $media ); } elseif ( $media ) { @@ -143,6 +143,7 @@ public static function saveImage( $field, $media ) $ext = $origImage->extension; $operation = $field->image_operation; + if ( $field->resizes ) { foreach ( $field->resizes as $resize ) { diff --git a/src/app/NewsletterSubscription.php b/src/app/Models/NewsletterSubscription.php similarity index 77% rename from src/app/NewsletterSubscription.php rename to src/app/Models/NewsletterSubscription.php index 5d872f7b..c3352cfc 100644 --- a/src/app/NewsletterSubscription.php +++ b/src/app/Models/NewsletterSubscription.php @@ -1,6 +1,6 @@ role->role == 'admin' ? true : false); } + public function isProfileComplete() + { + if ( !$this->profile->phone || !$this->profile->privacy || ( env('FACTOTUM_ECOMMERCE_INSTALLED') && !$this->profile->terms_conditions ) ) { + return false; + } + + return true; + } public function canConfigure($contentTypeID) { diff --git a/src/config/factotum.php b/src/config/factotum.php index 4d6826b1..80a15082 100644 --- a/src/config/factotum.php +++ b/src/config/factotum.php @@ -187,6 +187,6 @@ - 'version' => '5.0.27', + 'version' => '6.0.9', ]; diff --git a/src/resources/lang/en-GB/auth.php b/src/resources/lang/en-GB/auth.php index 2a54aa7b..e3cd064e 100644 --- a/src/resources/lang/en-GB/auth.php +++ b/src/resources/lang/en-GB/auth.php @@ -18,5 +18,8 @@ 'sent' => 'Password Sent', 'reset' => 'Password Resetted', 'token' => 'Token not matching' - ] + ], + + 'email_not_verified_title' => 'Email Not Verified', + 'email_not_verified_description' => 'Email Not Verified', ]; \ No newline at end of file diff --git a/src/resources/lang/en-GB/user.php b/src/resources/lang/en-GB/user.php index a9ea9f3c..44628516 100644 --- a/src/resources/lang/en-GB/user.php +++ b/src/resources/lang/en-GB/user.php @@ -21,4 +21,6 @@ 'profile_title' => 'User Profile', 'profile_description' => 'User Profile', + 'should_complete_profile' => 'You should complete your profile to proceed.' + ]; \ No newline at end of file diff --git a/src/resources/lang/en-GB/validation.php b/src/resources/lang/en-GB/validation.php index 58f43736..fab155f2 100644 --- a/src/resources/lang/en-GB/validation.php +++ b/src/resources/lang/en-GB/validation.php @@ -115,4 +115,10 @@ 'attributes' => [], + 'passwords' => [ + 'user' => 'User not found', + 'sent' => 'Password Sent', + 'reset' => 'Password Resetted', + 'token' => 'Token not matching' + ], ]; diff --git a/src/resources/lang/it-IT/auth.php b/src/resources/lang/it-IT/auth.php index 026390a1..6b6b577f 100644 --- a/src/resources/lang/it-IT/auth.php +++ b/src/resources/lang/it-IT/auth.php @@ -18,5 +18,8 @@ 'sent' => 'Password Inviata', 'reset' => 'Password resettata', 'token' => 'Token non corrispondente' - ] + ], + + 'email_not_verified_title' => 'Email Non Verificata', + 'email_not_verified_description' => 'Email Non Verificata', ]; \ No newline at end of file diff --git a/src/resources/lang/it-IT/user.php b/src/resources/lang/it-IT/user.php index 75cfeda0..125d679a 100644 --- a/src/resources/lang/it-IT/user.php +++ b/src/resources/lang/it-IT/user.php @@ -20,5 +20,7 @@ 'profile_title' => 'Profilo Utente', 'profile_description' => 'Profilo Utente', + + 'should_complete_profile' => 'Completa il tuo profilo per procedere.' ]; \ No newline at end of file diff --git a/src/resources/lang/it-IT/validation.php b/src/resources/lang/it-IT/validation.php index a8bbda57..f7843a29 100644 --- a/src/resources/lang/it-IT/validation.php +++ b/src/resources/lang/it-IT/validation.php @@ -115,4 +115,10 @@ 'attributes' => [], + 'passwords' => [ + 'user' => 'Utente non trovato', + 'sent' => 'Password Inviata', + 'reset' => 'Password resettata', + 'token' => 'Token non corrispondente' + ], ]; diff --git a/src/resources/views/auth/email-not-verified.blade.php b/src/resources/views/auth/email-not-verified.blade.php new file mode 100644 index 00000000..64fefe89 --- /dev/null +++ b/src/resources/views/auth/email-not-verified.blade.php @@ -0,0 +1,37 @@ +@extends('layouts.app') + +@section('content') + +
+ +
+ + @include('layouts.breadcrumbs', [ + 'breadcrumbs' => [ + '/' => 'Home', + '#' => 'Verifica Indirizzo Email' + ]]) + +
+
+ +
+ +

Verifica indirizzo email

+ +
+ +

+ Prima di procedere, controlla la tua email con il link di verifica. +

+ +
+ +
+
+ +
+ +
+ +@endsection \ No newline at end of file diff --git a/src/resources/views/ecommerce/user/ajax/province-input.blade.php b/src/resources/views/ecommerce/user/ajax/province-input.blade.php new file mode 100644 index 00000000..e145359b --- /dev/null +++ b/src/resources/views/ecommerce/user/ajax/province-input.blade.php @@ -0,0 +1,3 @@ + diff --git a/src/resources/views/ecommerce/user/ajax/province-select.blade.php b/src/resources/views/ecommerce/user/ajax/province-select.blade.php new file mode 100644 index 00000000..b66e1958 --- /dev/null +++ b/src/resources/views/ecommerce/user/ajax/province-select.blade.php @@ -0,0 +1,6 @@ + diff --git a/src/resources/views/ecommerce/user/customer-address-form.blade.php b/src/resources/views/ecommerce/user/customer-address-form.blade.php index 38c76071..fff3992e 100644 --- a/src/resources/views/ecommerce/user/customer-address-form.blade.php +++ b/src/resources/views/ecommerce/user/customer-address-form.blade.php @@ -82,14 +82,13 @@ class="form-control @error('city') is-invalid @enderror" name="city"
- + - +
+ @include('factotum::ecommerce.user.ajax.province-select') +
- @error('province') + @error('prov') @enderror
diff --git a/src/resources/views/home.blade.php b/src/resources/views/home.blade.php index a3b3e557..519a8ae6 100644 --- a/src/resources/views/home.blade.php +++ b/src/resources/views/home.blade.php @@ -1,4 +1,4 @@ -@extends('layouts.app') +@extends('factotum::layouts.app') @section('content') diff --git a/src/resources/views/layouts/app.blade.php b/src/resources/views/layouts/app.blade.php index 99925c84..6ab4c38d 100644 --- a/src/resources/views/layouts/app.blade.php +++ b/src/resources/views/layouts/app.blade.php @@ -1,7 +1,7 @@ - @include('layouts.metatags', ['content' => ( isset($content) ? $content : null), 'metatags' => ( isset($metatags) ? $metatags : null )] ) + @include('factotum::layouts.metatags', ['content' => ( isset($content) ? $content : null), 'metatags' => ( isset($metatags) ? $metatags : null )] ) diff --git a/src/resources/views/user/profile.blade.php b/src/resources/views/user/profile.blade.php index 3b11c770..bbd40f2d 100644 --- a/src/resources/views/user/profile.blade.php +++ b/src/resources/views/user/profile.blade.php @@ -19,6 +19,10 @@

Il tuo profilo

+ @if ( isset($completeProfile) ) +

@lang('factotum::user.should_complete_profile')

+ @endif +
@csrf @@ -123,7 +127,37 @@ class="@error('password_confirmation') is-invalid @enderror" name="password_conf
+ +
+
+ +
+ profile->newsletter ) checked="checked" @endif value="1"> + +
+ +
+
+ +
+ profile->privacy ) checked="checked" @endif value="1"> + +
+ +
+
+ +
+ profile->terms_conditions ) checked="checked" @endif value="1"> + +
+ +
diff --git a/src/routes/web/auth.php b/src/routes/web/auth.php index 46e8570b..07e19076 100644 --- a/src/routes/web/auth.php +++ b/src/routes/web/auth.php @@ -8,6 +8,8 @@ * ======================================== */ +use Illuminate\Support\Facades\Route; + Route::group([ 'prefix' => 'auth', 'middleware' => 'auth' diff --git a/src/routes/web/ecommerce/user.php b/src/routes/web/ecommerce/user.php index abdc5eb5..338b388d 100644 --- a/src/routes/web/ecommerce/user.php +++ b/src/routes/web/ecommerce/user.php @@ -8,22 +8,31 @@ * ======================================== */ +use Illuminate\Support\Facades\Route; + Route::group([ 'prefix' => 'user' ], function() { if ( !config('factotum.guest_cart') ) { Route::group([ - 'middleware' => 'auth' + 'middleware' => 'auth', + 'prefix' => 'customer-addresses' ], function() { - Route::get('/customer-addresses', 'ProfileController@showCustomerAddresses'); - Route::get('/customer-addresses/edit/{type}', 'ProfileController@showCustomerAddressForm'); - Route::get('/customer-addresses/edit/{type}/{id?}', 'ProfileController@showCustomerAddressForm'); - Route::post('/customer-addresses/edit/{type}/{id?}', 'ProfileController@saveCustomerAddress'); - Route::post('/customer-addresses/set-default', 'ProfileController@setDefaultCustomerAddress'); + Route::get('/', 'ProfileController@showCustomerAddresses'); + Route::get('/edit/{type}', 'ProfileController@showCustomerAddressForm'); + Route::get('/edit/{type}/{id?}', 'ProfileController@showCustomerAddressForm'); + Route::post('/edit/{type}/{id?}', 'ProfileController@saveCustomerAddress'); + Route::post('/set-default', 'ProfileController@setDefaultCustomerAddress'); + Route::get('/get-province-input', 'ProfileController@getProvinceInput'); + Route::get('/get-province-select', 'ProfileController@getProvinceSelect'); }); } else { - Route::post('/customer-addresses/edit/{type}', 'ProfileController@saveCustomerAddress'); + Route::group([ + 'prefix' => 'customer-addresses' + ], function() { + Route::post('/edit/{type}', 'ProfileController@saveCustomerAddress'); + }); } }); \ No newline at end of file diff --git a/src/routes/web/public/auth.php b/src/routes/web/public/auth.php index 60fd6533..c40b36a9 100644 --- a/src/routes/web/public/auth.php +++ b/src/routes/web/public/auth.php @@ -8,13 +8,16 @@ * ======================================== */ +use Illuminate\Support\Facades\Route; + Route::group([ 'prefix' => 'auth' ], function() { // AUTH LOGIN ROUTES - Route::get('/login', 'AuthController@showLoginForm')->name('login'); - Route::post('/login', 'AuthController@login'); + Route::get('/login', 'AuthController@showLoginForm')->name('login'); + Route::post('/login', 'AuthController@login'); + Route::get('/email-not-verified', 'AuthController@showEmailNotVerified'); // PASSWORD RESET ROUTES Route::get('/forgot-password', 'ForgotPasswordController@showLinkRequestForm')->name('password.request'); diff --git a/src/routes/web/public/user.php b/src/routes/web/public/user.php index b219432f..20ac6921 100644 --- a/src/routes/web/public/user.php +++ b/src/routes/web/public/user.php @@ -8,6 +8,8 @@ * ======================================== */ +use Illuminate\Support\Facades\Route; + Route::group([ 'prefix' => 'user' ], function() { diff --git a/src/routes/web/public/web.php b/src/routes/web/public/web.php index 2917bbaa..2d6d4e4d 100644 --- a/src/routes/web/public/web.php +++ b/src/routes/web/public/web.php @@ -1,8 +1,14 @@ where('uri', '.*'); +Route::group([ + 'middleware' => 'web', + 'namespace' => 'Kaleidoscope\Factotum\Http\Controllers\Web' +], function() { + Route::get('/{uri?}', 'FrontController@index')->where('uri', '.*'); + Route::post('/{uri?}', 'FrontController@index')->where('uri', '.*'); + +}); -Route::get('/{uri?}', '\Kaleidoscope\Factotum\Http\Controllers\Web\FrontController@index')->where('uri', '.*'); -Route::post('/{uri?}', '\Kaleidoscope\Factotum\Http\Controllers\Web\FrontController@index')->where('uri', '.*'); \ No newline at end of file diff --git a/src/routes/web/user.php b/src/routes/web/user.php index b482f69e..a16bce6e 100644 --- a/src/routes/web/user.php +++ b/src/routes/web/user.php @@ -8,6 +8,8 @@ * ======================================== */ +use Illuminate\Support\Facades\Route; + Route::group([ 'middleware' => 'auth', 'prefix' => 'user'