generator-folklore 3.0.10 → 3.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,6 +42,8 @@ class AppComposer
42
42
  'user' => !is_null($user) ? new UserResource($user) : null,
43
43
  'isPanneau' => true,
44
44
  'statusCode' => $view->statusCode,
45
+ 'baseUrl' => config('app.url'),
46
+ 'tusUrl' => null,
45
47
  'pubnubNamespace' => config('services.pubnub.namespace'),
46
48
  'pubnubPublishKey' => config('services.pubnub.publish_key'),
47
49
  'pubnubSubscribeKey' => config('services.pubnub.subscribe_key'),
@@ -4,10 +4,12 @@ namespace App\Panneau\Http\Controllers;
4
4
 
5
5
  use App\Panneau\Http\Requests\UploadRequest;
6
6
  use Folklore\Contracts\Repositories\Medias as MediasRepository;
7
- use Folklore\Http\Resources\Medias\MediaResource;
7
+ use Folklore\Http\Resources\MediaResource;
8
8
 
9
9
  class UploadController extends Controller
10
10
  {
11
+ protected $medias;
12
+
11
13
  public function __construct(MediasRepository $medias)
12
14
  {
13
15
  $this->medias = $medias;
@@ -0,0 +1,18 @@
1
+ <?php
2
+
3
+ namespace App\Actions\Fortify;
4
+
5
+ use Laravel\Fortify\Rules\Password;
6
+
7
+ trait PasswordValidationRules
8
+ {
9
+ /**
10
+ * Get the validation rules used to validate passwords.
11
+ *
12
+ * @return array
13
+ */
14
+ protected function passwordRules()
15
+ {
16
+ return ['required', 'string', new Password, 'confirmed'];
17
+ }
18
+ }
@@ -0,0 +1,27 @@
1
+ <?php
2
+
3
+ namespace App\Http\Responses;
4
+
5
+ use Laravel\Fortify\Contracts\LoginResponse as LoginResponseContract;
6
+ use Laravel\Fortify\Fortify;
7
+ use App\Http\Resources\UserResource;
8
+ use App\Panneau\Http\Resources\UserResource as PanneauUserResource;
9
+
10
+ class LoginResponse implements LoginResponseContract
11
+ {
12
+ /**
13
+ * Create an HTTP response that represents the object.
14
+ *
15
+ * @param \Illuminate\Http\Request $request
16
+ * @return \Symfony\Component\HttpFoundation\Response
17
+ */
18
+ public function toResponse($request)
19
+ {
20
+ if ($request->wantsJson()) {
21
+ return $request->isPanneau()
22
+ ? new PanneauUserResource($request->user())
23
+ : new UserResource($request->participant());
24
+ }
25
+ return redirect()->intended(Fortify::redirects('login'));
26
+ }
27
+ }
@@ -0,0 +1,19 @@
1
+ <?php
2
+
3
+ namespace App\Http\Responses;
4
+
5
+ use Laravel\Fortify\Contracts\LoginViewResponse as LoginViewResponseContract;
6
+
7
+ class LoginViewResponse implements LoginViewResponseContract
8
+ {
9
+ /**
10
+ * Create an HTTP response that represents the object.
11
+ *
12
+ * @param \Illuminate\Http\Request $request
13
+ * @return \Symfony\Component\HttpFoundation\Response
14
+ */
15
+ public function toResponse($request)
16
+ {
17
+ return $request->isPanneau() ? view('panneau::app') : view('app');
18
+ }
19
+ }
@@ -0,0 +1,54 @@
1
+ <?php
2
+
3
+ namespace App\Providers;
4
+
5
+ use App\Actions\Fortify\CreateNewUser;
6
+ use App\Actions\Fortify\ResetUserPassword;
7
+ use App\Actions\Fortify\UpdateUserPassword;
8
+ use App\Actions\Fortify\UpdateUserProfileInformation;
9
+ use App\Http\Responses\LoginResponse;
10
+ use App\Http\Responses\LoginViewResponse;
11
+ use Illuminate\Cache\RateLimiting\Limit;
12
+ use Illuminate\Http\Request;
13
+ use Illuminate\Support\Facades\RateLimiter;
14
+ use Illuminate\Support\ServiceProvider;
15
+ use Laravel\Fortify\Fortify;
16
+ use Laravel\Fortify\Contracts\LoginResponse as LoginResponseContract;
17
+ use Laravel\Fortify\Contracts\LoginViewResponse as LoginViewResponseContract;
18
+
19
+ class FortifyServiceProvider extends ServiceProvider
20
+ {
21
+ /**
22
+ * Register any application services.
23
+ *
24
+ * @return void
25
+ */
26
+ public function register()
27
+ {
28
+ $this->app->bind(LoginResponseContract::class, LoginResponse::class);
29
+ $this->app->bind(LoginViewResponseContract::class, LoginViewResponse::class);
30
+ }
31
+
32
+ /**
33
+ * Bootstrap any application services.
34
+ *
35
+ * @return void
36
+ */
37
+ public function boot()
38
+ {
39
+ Fortify::createUsersUsing(CreateNewUser::class);
40
+ Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
41
+ Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
42
+ Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
43
+
44
+ RateLimiter::for('login', function (Request $request) {
45
+ $email = (string) $request->email;
46
+
47
+ return Limit::perMinute(5)->by($email . $request->ip());
48
+ });
49
+
50
+ RateLimiter::for('two-factor', function (Request $request) {
51
+ return Limit::perMinute(5)->by($request->session()->get('login.id'));
52
+ });
53
+ }
54
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-folklore",
3
- "version": "3.0.10",
3
+ "version": "3.0.12",
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": "1d7f2e259b004828e208b643fb2d123aad8cc5ec"
43
+ "gitHead": "0dfd991ecfcba97bced8e4b8dde631e54f2ed684"
44
44
  }