diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.php index 10c9cd21..c00570a2 100644 --- a/app/Http/Controllers/Auth/PasswordController.php +++ b/app/Http/Controllers/Auth/PasswordController.php @@ -27,6 +27,6 @@ public function update(Request $request): RedirectResponse 'password' => Hash::make($validated['password']), ]); - return back(); + return back()->with('success', __('user.messages.password_updated_successfully')); } } diff --git a/app/Http/Controllers/Dashboard/UserController.php b/app/Http/Controllers/Dashboard/UserController.php index 2be3a4e3..eb1c0216 100644 --- a/app/Http/Controllers/Dashboard/UserController.php +++ b/app/Http/Controllers/Dashboard/UserController.php @@ -7,6 +7,7 @@ use App\Http\Controllers\Controller; use App\Http\Resources\Collections\UserCollection; use App\Models\User; +use App\Notifications\Ngo\UserRemovedFromOrganizationNotification; use App\Rules\UserDoesntBelongToAnOrganization; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; @@ -62,6 +63,7 @@ public function destroy(Request $request, User $user): RedirectResponse $user->organization() ->dissociate() ->save(); + $user->notify(new UserRemovedFromOrganizationNotification()); return redirect()->back() ->with('success', __('user.messages.deleted')); diff --git a/app/Http/Requests/Organization/UpdateOrganizationRequest.php b/app/Http/Requests/Organization/UpdateOrganizationRequest.php index 4b9c1d13..3643858e 100644 --- a/app/Http/Requests/Organization/UpdateOrganizationRequest.php +++ b/app/Http/Requests/Organization/UpdateOrganizationRequest.php @@ -20,7 +20,7 @@ public function rules(): array 'name' => ['nullable', 'string'], 'description' => ['nullable', 'string'], 'logo' => ['nullable', 'file', 'mimes:jpg,png'], - 'statute' => ['nullable', 'file'], + 'statute' => ['nullable', 'file', 'mimes:pdf'], 'street_address' => ['nullable', 'string'], 'cif' => ['nullable', 'string', 'unique:organizations,cif', new ValidCIF], 'contact_email' => ['nullable', 'email'], diff --git a/app/Http/Resources/Project/ShowProjectResource.php b/app/Http/Resources/Project/ShowProjectResource.php index 842b1e14..25436d0d 100644 --- a/app/Http/Resources/Project/ShowProjectResource.php +++ b/app/Http/Resources/Project/ShowProjectResource.php @@ -43,14 +43,14 @@ public function toArray(Request $request): array 'accepting_volunteers' => \boolval($this->accepting_volunteers), 'accepting_comments' => \boolval($this->accepting_comments), 'videos' => '', - 'embedded_videos'=> $this->embedded_videos, + 'embedded_videos' => $this->embedded_videos, 'swipe_gallery' => $this->getMedia('gallery')->map(function ($media) { return [ 'src' => $media->getFullUrl(), 'thumbnail' => $media->getFullUrl('preview'), 'w' => 1200, 'h' => 800, - ]; + ]; })->toArray(), 'is_active' => $this->is_active, 'external_links' => collect($this->external_links)->map(function (array $link) { diff --git a/app/Models/Activity.php b/app/Models/Activity.php index 5a863815..d690c0a9 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -131,7 +131,23 @@ public function approve(): void $this->subject->setAttribute($key, $value['new']); }); - $this->subject->save(); + if ($this->subject instanceof Organization) + { + $value = data_get($this->properties, $this->changed_field . '.new'); + if ($this->description === 'statute') { + $this->subject->getMedia('statute')->map(function(Media $media) use ($value){ + if ($media->id != $value) + { + $media->delete(); + } + }); + $media = Media::find($value); + $this->subject->media->add($media); + } + } + else{ + $this->subject->save(); + } $this->update([ 'approved_at' => now(), diff --git a/app/Notifications/Ngo/UserRemovedFromOrganizationNotification.php b/app/Notifications/Ngo/UserRemovedFromOrganizationNotification.php new file mode 100644 index 00000000..e701f111 --- /dev/null +++ b/app/Notifications/Ngo/UserRemovedFromOrganizationNotification.php @@ -0,0 +1,40 @@ + + */ + public function via(object $notifiable): array + { + return ['mail']; + } + + /** + * Get the mail representation of the notification. + */ + public function toMail(object $notifiable): MailMessage + { + return (new MailMessage) + ->subject(__('user.mail.remove_from_organization.subject', ['app' => config('app.name')])) + ->greeting(__('user.mail.remove_from_organization.greeting', [ + 'name' => $notifiable->name, + ])) + ->line(__('user.mail.remove_from_organization.intro', [ + 'app' => config('app.name'), + ])); + } +} diff --git a/lang/ro.json b/lang/ro.json index eacc656e..c76d1715 100644 --- a/lang/ro.json +++ b/lang/ro.json @@ -7,6 +7,7 @@ "retype_password": "Reintroduceți parola nouă", "name_last_name": "Nume și prenume", "email": "Email", + "denied_change_email": "Nu poți schimba adresa de email. Daca vrei sa o schimbi contactează-ne la: contact@bursabinelui.ro", "phone": "Telefon", "phone_input_info": "*Numarul de telefon nu va fi facut public.", "unverified_email": "Your email address is unverified.", diff --git a/lang/ro/user.php b/lang/ro/user.php index a6a7275e..b7e6248e 100644 --- a/lang/ro/user.php +++ b/lang/ro/user.php @@ -39,6 +39,7 @@ 'created' => 'Utilizatorul a fost adăugat.', 'deleted' => 'Utilizatorul a fost șters.', 'set_initial_password_success' => 'Parola a fost setată cu succes!', + 'password_updated_successfully'=> 'Parola a fost actualizată cu succes!', ], 'filters' => [ 'type' => 'Tip', diff --git a/resources/js/Components/form/Input.vue b/resources/js/Components/form/Input.vue index 7611cfad..a914a9f4 100644 --- a/resources/js/Components/form/Input.vue +++ b/resources/js/Components/form/Input.vue @@ -19,6 +19,7 @@ :pattern="pattern" :min="min" :max="max" + :disabled="disabled" :maxlength="maxlength" /> @@ -78,6 +79,10 @@ maxlength: { type: Number, default: null + }, + disabled: { + type: Boolean, + default: false } }); diff --git a/resources/js/Pages/Auth/Login.vue b/resources/js/Pages/Auth/Login.vue index fc7d8e14..d1677092 100644 --- a/resources/js/Pages/Auth/Login.vue +++ b/resources/js/Pages/Auth/Login.vue @@ -57,13 +57,13 @@ :label="$t('log_in')" /> - - - {{ $t('google_login') }} - + + + + + + + diff --git a/resources/js/Pages/Profile/Partials/UpdateProfileInformationForm.vue b/resources/js/Pages/Profile/Partials/UpdateProfileInformationForm.vue index 0be182d0..8afafcb6 100644 --- a/resources/js/Pages/Profile/Partials/UpdateProfileInformationForm.vue +++ b/resources/js/Pages/Profile/Partials/UpdateProfileInformationForm.vue @@ -24,7 +24,11 @@ v-model="form.email" :isRequired="true" :error="form.errors.email" - /> + disabled + > +

{{ $t("denied_change_email") }}

+ +