generator-folklore 3.0.8 → 3.0.9

Sign up to get free protection for your applications and to get access to all the features.
package/Readme.md CHANGED
@@ -1,12 +1,15 @@
1
1
  # Folklore Generator
2
+
2
3
  Yeoman generator to start projects at Folklore
3
4
 
4
5
  ## Install
6
+
5
7
  ```
6
8
  npm install -g generator-folklore
7
9
  ```
8
10
 
9
11
  ## Usage
12
+
10
13
  ```
11
14
  yo folklore
12
15
  ```
@@ -14,20 +17,23 @@ yo folklore
14
17
  ## Sub-Generators
15
18
 
16
19
  ```
17
- yo folklore:laravel
20
+ yo folklore:laravel-project
18
21
  ```
19
- Laravel 5 project, JS, Sass, and miscellaneous Laravel boilerplate.
22
+
23
+ Laravel boilerplate.
20
24
 
21
25
  --
22
26
 
23
27
  ```
24
- yo folklore:html
28
+ yo folklore:html-project
25
29
  ```
30
+
26
31
  HTML static application
27
32
 
28
33
  --
29
34
 
30
35
  ```
31
- yo folklore:npm-package
36
+ yo folklore:node-project
32
37
  ```
33
- NPM package
38
+
39
+ Node package
@@ -53,6 +53,9 @@ module.exports = class AppGenerator extends _generator.default {
53
53
  choices: [{
54
54
  name: 'HTML',
55
55
  value: 'html-project'
56
+ }, {
57
+ name: 'Laravel',
58
+ value: 'laravel-project'
56
59
  }, {
57
60
  name: 'Node',
58
61
  value: 'node-project'
@@ -62,7 +62,7 @@ module.exports = class IntlGenerator extends _generator.default {
62
62
  'without-id-only': withoutIdOnly = false,
63
63
  locales
64
64
  } = this.options;
65
- const intlCommand = `flklr intl --po${withoutIdOnly ? ' --without-id-only' : ''} --output-path$ '${outputPath}' '${translationsPath}'`;
65
+ const intlCommand = `flklr intl --po${withoutIdOnly ? ' --without-id-only' : ''} --output-path '${outputPath}' '${translationsPath}'`;
66
66
  this.packageJson.merge({
67
67
  scripts: jsonPath !== null ? {
68
68
  intl: 'npm run intl:build && npm run intl:copy',
@@ -1,5 +1,7 @@
1
1
  <?php
2
2
 
3
+ use Illuminate\Support\Facades\Route;
4
+
3
5
  Route::groupWithLocales(function ($locale) {
4
6
  // Authentication Routes...
5
7
  Route::getLocalized('login', 'LoginController@showLoginForm')->nameWithLocale('auth.login');
@@ -0,0 +1,27 @@
1
+ <?php
2
+
3
+ namespace App\Http\Middleware;
4
+
5
+ use Illuminate\Auth\Middleware\Authenticate as Middleware;
6
+
7
+ class Authenticate extends Middleware
8
+ {
9
+ /**
10
+ * Get the path the user should be redirected to when they are not authenticated.
11
+ *
12
+ * @param \Illuminate\Http\Request $request
13
+ * @return string|null
14
+ */
15
+ protected function redirectTo($request)
16
+ {
17
+ if (!$request->expectsJson()) {
18
+ $routeWithLocale =
19
+ route_with_locale('login') .
20
+ '?' .
21
+ http_build_query([
22
+ 'next' => $request->fullUrl(),
23
+ ]);
24
+ return $request->isPanneau() ? route('panneau.auth.login') : $routeWithLocale;
25
+ }
26
+ }
27
+ }
@@ -10,6 +10,11 @@ use Panneau\Support\LocalizedField;
10
10
  use Folklore\Panneau\Fields\PageSlug as PageSlugField;
11
11
  use Panneau\Support\Facade as Panneau;
12
12
 
13
+ use Illuminate\Http\Request;
14
+ use Laravel\Fortify\Fortify;
15
+ use Illuminate\Support\Facades\Hash;
16
+ use App\Models\User;
17
+
13
18
  class PanneauServiceProvider extends BaseServiceProvider
14
19
  {
15
20
  /**
@@ -31,6 +36,7 @@ class PanneauServiceProvider extends BaseServiceProvider
31
36
  {
32
37
  $this->bootFields();
33
38
  $this->bootViews();
39
+ $this->bootAuth();
34
40
  }
35
41
 
36
42
  protected function bootFields()
@@ -71,4 +77,14 @@ class PanneauServiceProvider extends BaseServiceProvider
71
77
  $view->composer('errors::*', \App\Panneau\Composers\AppComposer::class);
72
78
  });
73
79
  }
80
+
81
+ protected function bootAuth()
82
+ {
83
+ Fortify::authenticateUsing(function (Request $request) {
84
+ $user = User::where('email', $request->email)->first();
85
+ if (!is_null($user) && Hash::check($request->password, $user->password)) {
86
+ return $user;
87
+ }
88
+ });
89
+ }
74
90
  }
@@ -51,7 +51,8 @@ class Users extends Resource
51
51
  ],
52
52
  ])
53
53
  ->withoutReset()
54
- ->withDefaultValue('guest'),
54
+ ->withDefaultValue('admin')
55
+ ->isRequired(),
55
56
  ];
56
57
  }
57
58
  }
@@ -10,7 +10,9 @@ Panneau::router()->group(function () {
10
10
  return app('tus-server')->serve();
11
11
  })->where('any', '.*');
12
12
 
13
- Panneau::router()->auth();
13
+ Route::middleware(['web'])->group(function () {
14
+ Panneau::router()->auth();
15
+ });
14
16
 
15
17
  Route::namespace('\App\Panneau\Http\Controllers')
16
18
  ->middleware(['web', 'auth', 'can:view,' . \Panneau\Panneau::class])
@@ -297,7 +297,7 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
297
297
  if (this.options.panneau) {
298
298
  this.composeWith('folklore:laravel-panneau', {
299
299
  'project-name': this.options['project-name'],
300
- 'skip-install': skipInstall,
300
+ 'skip-install': true,
301
301
  quiet: true
302
302
  });
303
303
  } // if (this.options.auth) {
@@ -305,7 +305,7 @@ module.exports = class LaravelProjectGenerator extends _generator.default {
305
305
  // 'project-name': this.options['project-name'],
306
306
  // 'js-path': jsSrcPath,
307
307
  // 'styles-path': stylesSrcPath,
308
- // 'skip-install': skipInstall,
308
+ // 'skip-install': true,
309
309
  // 'install-npm': true,
310
310
  // quiet: true,
311
311
  // });
@@ -0,0 +1,67 @@
1
+ <?php
2
+
3
+ namespace App\Providers;
4
+
5
+ use Illuminate\Support\Facades\Gate;
6
+ use Laravel\Telescope\IncomingEntry;
7
+ use Laravel\Telescope\Telescope;
8
+ use Laravel\Telescope\TelescopeApplicationServiceProvider;
9
+
10
+ class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
11
+ {
12
+ /**
13
+ * Register any application services.
14
+ *
15
+ * @return void
16
+ */
17
+ public function register()
18
+ {
19
+ // Telescope::night();
20
+
21
+ $this->hideSensitiveRequestDetails();
22
+
23
+ Telescope::filter(function (IncomingEntry $entry) {
24
+ if ($this->app->environment('local')) {
25
+ return true;
26
+ }
27
+
28
+ return $entry->isReportableException() ||
29
+ $entry->isFailedRequest() ||
30
+ $entry->isFailedJob() ||
31
+ $entry->isScheduledTask() ||
32
+ $entry->hasMonitoredTag();
33
+ });
34
+ }
35
+
36
+ /**
37
+ * Prevent sensitive request details from being logged by Telescope.
38
+ *
39
+ * @return void
40
+ */
41
+ protected function hideSensitiveRequestDetails()
42
+ {
43
+ if ($this->app->environment('local')) {
44
+ return;
45
+ }
46
+
47
+ Telescope::hideRequestParameters(['_token']);
48
+
49
+ Telescope::hideRequestHeaders(['cookie', 'x-csrf-token', 'x-xsrf-token']);
50
+ }
51
+
52
+ /**
53
+ * Register the Telescope gate.
54
+ *
55
+ * This gate determines who can access Telescope in non-local environments.
56
+ *
57
+ * @return void
58
+ */
59
+ protected function gate()
60
+ {
61
+ Gate::define('viewTelescope', function ($user) {
62
+ return in_array($user->email, [
63
+ //
64
+ ]);
65
+ });
66
+ }
67
+ }
@@ -1,5 +1,6 @@
1
1
  <?php
2
2
 
3
+ use Illuminate\Support\Facades\Route;
3
4
  use App\Http\Controllers\HomeController;
4
5
 
5
6
  //Redirect to current langage home
@@ -8,5 +9,7 @@ Route::get('/', [HomeController::class, 'redirect'])->name('home');
8
9
  Route::groupWithLocales(function () {
9
10
  Route::getTrans('/', [HomeController::class, 'index'])->nameWithLocale('home');
10
11
  Route::getTrans('/test', [HomeController::class, 'index'])->nameWithLocale('test');
11
- Route::getTrans('/test/{with_param}', [HomeController::class, 'index'])->nameWithLocale('test_with_param');
12
+ Route::getTrans('/test/{with_param}', [HomeController::class, 'index'])->nameWithLocale(
13
+ 'test_with_param'
14
+ );
12
15
  });
@@ -8,21 +8,23 @@ import { BrowserRouter } from 'react-router-dom';
8
8
  import App from './App';
9
9
 
10
10
  const propTypes = {
11
- locale: PropTypes.string,
12
- messages: PropTypes.oneOfType([
13
- PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)),
14
- PropTypes.objectOf(PropTypes.string),
15
- ]),
11
+ intl: PropTypes.shape({
12
+ locale: PropTypes.string,
13
+ messages: PropTypes.oneOfType([
14
+ PropTypes.objectOf(PropTypes.objectOf(PropTypes.string)),
15
+ PropTypes.objectOf(PropTypes.string),
16
+ ]),
17
+ }),
16
18
  routes: PropTypes.objectOf(PropTypes.string),
17
19
  };
18
20
 
19
21
  const defaultProps = {
20
- locale: 'fr',
21
- messages: {},
22
+ intl: null,
22
23
  routes: {},
23
24
  };
24
25
 
25
- function Container({ locale, messages, routes }) {
26
+ function Container({ intl, routes }) {
27
+ const { locale = null, messages = null } = intl || {};
26
28
  return (
27
29
  <IntlProvider locale={locale} messages={messages[locale] || messages}>
28
30
  <BrowserRouter>
@@ -12,7 +12,7 @@ module.exports = class StylelintGenerator extends _generator.default {
12
12
  this.option('camel-case', {
13
13
  type: Boolean,
14
14
  required: false,
15
- defaults: false
15
+ defaults: true
16
16
  });
17
17
  }
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-folklore",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "Yeoman generator for projects at Folklore",
5
5
  "keywords": [
6
6
  "yeoman-generator"
@@ -40,5 +40,5 @@
40
40
  "yeoman-generator": "^5.7.0",
41
41
  "yeoman-remote": "^1.0.1"
42
42
  },
43
- "gitHead": "a8406b4ff188934ed49c13826cf577968669ed4e"
43
+ "gitHead": "88e0fd31cded9ff974e5b50f4c76464ef26efb12"
44
44
  }