diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index dc031af..b47aea7 100755 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -101,7 +101,7 @@ class AuthController extends Controller { $this->user->password = $input['password']; $this->user->save(); - flash()->success('Password berhasil diubah!'); + flash()->success(trans('auth.password_changed')); return redirect()->back(); } diff --git a/config/app.php b/config/app.php index d6d8e73..6547340 100644 --- a/config/app.php +++ b/config/app.php @@ -159,12 +159,8 @@ return [ App\Providers\OptionServiceProvider::class, App\Providers\RouteServiceProvider::class, - BackupManager\Laravel\Laravel55ServiceProvider::class, Laracasts\Flash\FlashServiceProvider::class, - Luthfi\FormField\FormFieldServiceProvider::class, - Maatwebsite\Excel\ExcelServiceProvider::class, Riskihajar\Terbilang\TerbilangServiceProvider::class, - Spatie\Fractal\FractalServiceProvider::class, ], /* @@ -212,15 +208,8 @@ return [ 'View' => Illuminate\Support\Facades\View::class, 'Carbon' => Carbon\Carbon::class, - 'Excel' => Maatwebsite\Excel\Facades\Excel::class, - 'Fractal' => Spatie\Fractal\FractalFacade::class, 'Option' => App\Services\Facades\Option::class, - - 'FormField' => Luthfi\FormField\FormFieldFacade::class, - 'Form' => Collective\Html\FormFacade::class, - 'Html' => Collective\Html\HtmlFacade::class, 'Terbilang' => Riskihajar\Terbilang\Facades\Terbilang::class, - ], ]; diff --git a/resources/lang/id/auth.php b/resources/lang/id/auth.php index ced9b61..72ee466 100644 --- a/resources/lang/id/auth.php +++ b/resources/lang/id/auth.php @@ -23,6 +23,7 @@ return [ 'have_an_account' => 'Saya sudah punya Akun', 'need_account' => 'Belum punya Akun?', 'change_password' => 'Ganti Password', + 'password_changed' => 'Password berhasil diubah.', 'forgot_password' => 'Lupa Password?', 'reset_password' => 'Reset Password', 'password_confirmation' => 'Ulangi Password', @@ -30,4 +31,6 @@ return [ 'new_password' => 'Password Baru', 'new_password_confirmation' => 'Ulangi Password Baru', 'send_reset_password_link' => 'Kirim Link Reset Password', + 'old_password_failed' => 'Password lama tidak cocok!', + 'welcome' => 'Selamat datang kembali :name.', ]; diff --git a/tests/Feature/Auth/MemberChangePasswordTest.php b/tests/Feature/Auth/MemberChangePasswordTest.php index 131d50c..6a26113 100644 --- a/tests/Feature/Auth/MemberChangePasswordTest.php +++ b/tests/Feature/Auth/MemberChangePasswordTest.php @@ -15,27 +15,29 @@ class MemberChangePasswordTest extends TestCase $this->actingAs($user); $this->visit(route('home')); - $this->seePageIs(route('home')); $this->click(trans('auth.change_password')); - $this->type('member1', 'old_password'); - $this->type('rahasia', 'password'); - $this->type('rahasia', 'password_confirmation'); - $this->press(trans('auth.change_password')); - $this->see('Password lama tidak cocok'); + $this->submitForm(trans('auth.change_password'), [ + 'old_password' => 'member1', + 'password' => 'rahasia', + 'password_confirmation' => 'rahasia', + ]); + $this->see(trans('auth.old_password_failed')); + $this->assertTrue( + app('hash')->check('member', $user->password), + 'The password shouldn\'t changed!' + ); - $this->type('member', 'old_password'); - $this->type('rahasia', 'password'); - $this->type('rahasia', 'password_confirmation'); - $this->press(trans('auth.change_password')); - $this->see('Password berhasil diubah'); + $this->submitForm(trans('auth.change_password'), [ + 'old_password' => 'member', + 'password' => 'rahasia', + 'password_confirmation' => 'rahasia', + ]); + $this->see(trans('auth.password_changed')); - // Logout and login using new Password - $this->click('Keluar'); - $this->seePageIs(route('auth.login')); - $this->type($user->email, 'email'); - $this->type('rahasia', 'password'); - $this->press('Login'); - $this->seePageIs(route('home')); + $this->assertTrue( + app('hash')->check('rahasia', $user->password), + 'The password should changed!' + ); } }