Skip to content

Commit

Permalink
Rilis v2408.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
andifahruddinakas committed Aug 15, 2024
1 parent 1e41ab6 commit 9c0c7fa
Show file tree
Hide file tree
Showing 901 changed files with 77,345 additions and 1,740 deletions.
2 changes: 1 addition & 1 deletion app/Enums/JenisPeraturan.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Events/Event.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Events/ExampleEvent.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Imports/SuratDinasImports.php

Large diffs are not rendered by default.

425 changes: 425 additions & 0 deletions app/Libraries/NoCaptcha.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Libraries/TinyMCE.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Libraries/TinyMCE/FakeDataIsian.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Libraries/TinyMCE/KodeIsianSurat.php

Large diffs are not rendered by default.

505 changes: 505 additions & 0 deletions app/Listeners/FailedAdminListener.php

Large diffs are not rendered by default.

513 changes: 513 additions & 0 deletions app/Listeners/LockoutAdminListener.php

Large diffs are not rendered by default.

497 changes: 497 additions & 0 deletions app/Listeners/LoginAdminListener.php

Large diffs are not rendered by default.

521 changes: 521 additions & 0 deletions app/Listeners/LoginPendudukListener.php

Large diffs are not rendered by default.

505 changes: 505 additions & 0 deletions app/Listeners/LogoutAdminListener.php

Large diffs are not rendered by default.

689 changes: 689 additions & 0 deletions app/Listeners/Penduduk/SendEmailVerificationNotification.php

Large diffs are not rendered by default.

713 changes: 713 additions & 0 deletions app/Listeners/Penduduk/SendTelegramVerificationNotification.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/Artikel.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/Bantuan.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/Keluarga.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/Komentar.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/LogPenduduk.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/LogSurat.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/Penduduk.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/PendudukHidup.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/PendudukMandiri.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/Shortcut.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/User.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Models/Wilayah.php

Large diffs are not rendered by default.

633 changes: 633 additions & 0 deletions app/Notifications/Admin/ResetPasswordNotification.php

Large diffs are not rendered by default.

537 changes: 537 additions & 0 deletions app/Notifications/ExampleNotification.php

Large diffs are not rendered by default.

657 changes: 657 additions & 0 deletions app/Notifications/Penduduk/ResetPasswordNotification.php

Large diffs are not rendered by default.

601 changes: 601 additions & 0 deletions app/Notifications/Penduduk/VerifyNotification.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Observers/AuthorObserver.php

Large diffs are not rendered by default.

215 changes: 215 additions & 0 deletions app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
<?php

/*
*
* File ini bagian dari:
*
* OpenSID
*
* Sistem informasi desa sumber terbuka untuk memajukan desa
*
* Aplikasi dan source code ini dirilis berdasarkan lisensi GPL V3
*
* Hak Cipta 2009 - 2015 Combine Resource Institution (http://lumbungkomunitas.net/)
* Hak Cipta 2016 - 2024 Perkumpulan Desa Digital Terbuka (https://opendesa.id)
*
* Dengan ini diberikan izin, secara gratis, kepada siapa pun yang mendapatkan salinan
* dari perangkat lunak ini dan file dokumentasi terkait ("Aplikasi Ini"), untuk diperlakukan
* tanpa batasan, termasuk hak untuk menggunakan, menyalin, mengubah dan/atau mendistribusikan,
* asal tunduk pada syarat berikut:
*
* Pemberitahuan hak cipta di atas dan pemberitahuan izin ini harus disertakan dalam
* setiap salinan atau bagian penting Aplikasi Ini. Barang siapa yang menghapus atau menghilangkan
* pemberitahuan ini melanggar ketentuan lisensi Aplikasi Ini.
*
* PERANGKAT LUNAK INI DISEDIAKAN "SEBAGAIMANA ADANYA", TANPA JAMINAN APA PUN, BAIK TERSURAT MAUPUN
* TERSIRAT. PENULIS ATAU PEMEGANG HAK CIPTA SAMA SEKALI TIDAK BERTANGGUNG JAWAB ATAS KLAIM, KERUSAKAN ATAU
* KEWAJIBAN APAPUN ATAS PENGGUNAAN ATAU LAINNYA TERKAIT APLIKASI INI.
*
* @package OpenSID
* @author Tim Pengembang OpenDesa
* @copyright Hak Cipta 2009 - 2015 Combine Resource Institution (http://lumbungkomunitas.net/)
* @copyright Hak Cipta 2016 - 2024 Perkumpulan Desa Digital Terbuka (https://opendesa.id)
* @license http://www.gnu.org/licenses/gpl.html GPL V3
* @link https://github.com/OpenSID/OpenSID
*
*/

namespace App\Providers;

use App\Services\Auth\PendudukMandiriProvider;
use App\Services\Auth\SessionGuard;
use Exception;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
use InvalidArgumentException;

class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];

/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
$this->bootExtendGuard();
$this->bootPendudukMandiriProvider();
$this->registerPolicies();
}

/**
* Register the application's policies.
*
* @return void
*/
public function register()
{
$this->booting(function () {
$this->registerPolicies();
});

$this->registerMd5Hasher();
}

/**
* Register the application's policies.
*
* @return void
*/
public function registerPolicies()
{
foreach ($this->policies() as $model => $policy) {
Gate::policy($model, $policy);
}
}

/**
* Get the policies defined on the provider.
*
* @return array<class-string, class-string>
*/
public function policies()
{
return $this->policies;
}

protected function bootExtendGuard()
{
$this->app['auth']->extend('session', function ($app, $name, $config) {
$provider = $app['auth']->createUserProvider($config['provider'] ?? null);

$guard = new SessionGuard(
name: $name,
provider: $provider,
session: $app['session.store'],
);

// When using the remember me functionality of the authentication services we
// will need to be set the encryption instance of the guard, which allows
// secure, encrypted cookie values to get generated for those cookies.
if (method_exists($guard, 'setCookieJar')) {
$guard->setCookieJar($this->app['cookie']);
}

if (method_exists($guard, 'setDispatcher')) {
$guard->setDispatcher($this->app['events']);
}

if (method_exists($guard, 'setRequest')) {
$guard->setRequest($app->refresh('request', $guard, 'setRequest'));
}

if (isset($config['remember'])) {
$guard->setRememberDuration($config['remember']);
}

return $guard;
});
}

protected function bootPendudukMandiriProvider()
{
$this->app['auth']->provider(PendudukMandiriProvider::class, static function ($app, $config) {
return new PendudukMandiriProvider(
$app['hash']->driver('md5'),
$config['model'],
$config['belongsTo']
);
});
}

protected function registerMd5Hasher()
{
$this->app['hash']->extend('md5', function () {
return new class () implements \Illuminate\Contracts\Hashing\Hasher {
/**
* {@inheritDoc}
*/
public function info($hashedValue)
{
return array_merge(
password_get_info($hashedValue),
['algo' => 'md5', 'algoName' => 'md5']
);
}

/**
* {@inheritDoc}
*
* @see https://github.com/OpenSID/OpenSID/blob/master/donjo-app/helpers/donjolib_helper.php#L492-L499
*/
public function make($value, array $options = [])
{
try {
if (! is_numeric($value) || strlen($value) != 6) {
throw new InvalidArgumentException('Value must be a 6-digit number');
}

$value = strrev($value);
$value *= 77;
$value .= '!#@$#%';

return md5($value);
} catch (Exception $e) {
throw new Exception(sprintf(
'Error processing value: %s. [%s].',
$e->getMessage(),
self::class
), 400);
}
}

/**
* {@inheritDoc}
*/
public function check($value, $hashedValue, array $options = [])
{
if (! is_numeric($value) || strlen($value) != 6) {
return false;
}

return hash_equals($this->make($value), $hashedValue);
}

/**
* {@inheritDoc}
*/
public function needsRehash($hashedValue, array $options = [])
{
throw new Exception(sprintf(
'This password md5 does not implement needsRehash. [%s].',
self::class
));
}
};
});
}
}
27 changes: 24 additions & 3 deletions app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,30 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [
// \App\Events\ExampleEvent::class => [
// \App\Listeners\ExampleListener::class,
// ],
\Illuminate\Auth\Events\Registered::class => [
\App\Listeners\Penduduk\SendEmailVerificationNotification::class,
\App\Listeners\Penduduk\SendTelegramVerificationNotification::class,
],
\Illuminate\Auth\Events\Attempting::class => [],
\Illuminate\Auth\Events\Authenticated::class => [],
\Illuminate\Auth\Events\Login::class => [
\App\Listeners\LoginAdminListener::class,
\App\Listeners\LoginPendudukListener::class,
],
\Illuminate\Auth\Events\Failed::class => [
\App\Listeners\FailedAdminListener::class,
],
\Illuminate\Auth\Events\Validated::class => [],
\Illuminate\Auth\Events\Verified::class => [],
\Illuminate\Auth\Events\Logout::class => [
\App\Listeners\LogoutAdminListener::class,
],
\Illuminate\Auth\Events\CurrentDeviceLogout::class => [],
\Illuminate\Auth\Events\OtherDeviceLogout::class => [],
\Illuminate\Auth\Events\Lockout::class => [
\App\Listeners\LockoutAdminListener::class,
],
\Illuminate\Auth\Events\PasswordReset::class => [],
];

/**
Expand Down
53 changes: 53 additions & 0 deletions app/Providers/NoCaptchaServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace App\Providers;

use App\Libraries\NoCaptcha;
use Illuminate\Support\ServiceProvider;
use ReflectionClass;

class NoCaptchaServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;

/**
* Bootstrap the application events.
*/
public function boot()
{
$app = $this->app;

$app['validator']->extend('captcha', function ($attribute, $value) use ($app) {
return $app['captcha']->verifyResponse($value, $app['request']->getClientIp());
});
}

/**
* Register the service provider.
*/
public function register()
{
$this->app->singleton('captcha', function ($app) {
return new NoCaptcha(
$app['config']['captcha.secret'],
$app['config']['captcha.sitekey'],
$app['config']['captcha.options']
);
});
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['captcha'];
}
}
25 changes: 25 additions & 0 deletions app/Providers/TelegramNotificationServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Providers;

use GuzzleHttp\Client as HttpClient;
use Illuminate\Support\ServiceProvider;
use NotificationChannels\Telegram\Telegram;
use Illuminate\Notifications\ChannelManager;
use Illuminate\Support\Facades\Notification;
use NotificationChannels\Telegram\TelegramChannel;

class TelegramNotificationServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->bind(Telegram::class, static fn ($app) => new Telegram(
$app['config']['services.telegram-bot-api.token'],
$app->make(HttpClient::class),
));

Notification::resolved(static function (ChannelManager $service) {
$service->extend('telegram', static fn ($app) => $app->make(TelegramChannel::class));
});
}
}
Loading

0 comments on commit 9c0c7fa

Please sign in to comment.