Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 718adf3

Browse files
committed
Changed the default admin login email [email protected] to [email protected], because the domain admin.com can possible cause problems in email servers at some point
1 parent 6a5361d commit 718adf3

File tree

6 files changed

+43
-44
lines changed

6 files changed

+43
-44
lines changed

database/migrations/2014_10_12_000000_create_users_table.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
use Illuminate\Database\Migrations\Migration;
44
use Illuminate\Database\Schema\Blueprint;
55

6-
return new class extends Migration
7-
{
6+
return new class extends Migration {
87
/**
98
* Run the migrations.
109
*
@@ -23,9 +22,9 @@ public function up()
2322

2423
// Create the initial admin user
2524
DB::table('users')->insert([
26-
'name' => 'Admin',
27-
'email' => 'admin@admin.com',
28-
'password' => bcrypt('password'),
25+
'name' => 'Admin',
26+
'email' => 'admin@example.com',
27+
'password' => bcrypt('password'),
2928
'created_at' => \Carbon\Carbon::now()->toDateTimeString(),
3029
'updated_at' => \Carbon\Carbon::now()->toDateTimeString(),
3130
]);
@@ -40,4 +39,4 @@ public function down()
4039
{
4140
Schema::drop('users');
4241
}
43-
};
42+
};

dev/docs/development.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Development & Testing
22

3-
All development on BookStack is currently done on the `development` branch.
3+
All development on BookStack is currently done on the `development` branch.
44
When it's time for a release the `development` branch is merged into release with built & minified CSS & JS then tagged at its version. Here are the current development requirements:
55

6-
* [Node.js](https://nodejs.org/en/) v18.0+
6+
- [Node.js](https://nodejs.org/en/) v18.0+
77

88
## Building CSS & JavaScript Assets
99

1010
This project uses SASS for CSS development and this is built, along with the JavaScript, using a range of npm scripts. The below npm commands can be used to install the dependencies & run the build tasks:
1111

12-
``` bash
12+
```bash
1313
# Install NPM Dependencies
1414
npm install
1515

@@ -29,7 +29,7 @@ The testing database will also need migrating and seeding beforehand. This can b
2929

3030
Once done you can run `composer test` in the application root directory to run all tests. Tests can be ran in parallel by running them via `composer t`. This will use Laravel's built-in parallel testing functionality, and attempt to create and seed a database instance for each testing thread. If required these parallel testing instances can be reset, before testing again, by running `composer t-reset`.
3131

32-
If the codebase needs to be tested with deprecations, this can be done via uncommenting the relevant line within the TestCase@setUp function.
32+
If the codebase needs to be tested with deprecations, this can be done via uncommenting the relevant line within the TestCase@setUp function.
3333

3434
## Code Standards
3535

@@ -81,10 +81,10 @@ To get started, make sure you meet the following requirements:
8181
If all the conditions are met, you can proceed with the following steps:
8282

8383
1. **Copy `.env.example` to `.env`**, change `APP_KEY` to a random 32 char string and set `APP_ENV` to `local`.
84-
2. Make sure **port 8080 is unused** *or else* change `DEV_PORT` to a free port on your host.
84+
2. Make sure **port 8080 is unused** _or else_ change `DEV_PORT` to a free port on your host.
8585
3. **Run `chgrp -R docker storage`**. The development container will chown the `storage` directory to the `www-data` user inside the container so BookStack can write to it. You need to change the group to your host's `docker` group here to not lose access to the `storage` directory.
8686
4. **Run `docker-compose up`** and wait until the image is built and all database migrations have been done.
87-
5. You can now login with `admin@admin.com` and `password` as password on `localhost:8080` (or another port if specified).
87+
5. You can now login with `admin@example.com` and `password` as password on `localhost:8080` (or another port if specified).
8888

8989
If needed, You'll be able to run any artisan commands via docker-compose like so:
9090

@@ -98,15 +98,15 @@ The docker-compose setup runs an instance of [MailHog](https://github.com/mailho
9898

9999
After starting the general development Docker, migrate & seed the testing database:
100100

101-
```bash
101+
```bash
102102
# This only needs to be done once
103103
docker-compose run app php artisan migrate --database=mysql_testing
104104
docker-compose run app php artisan db:seed --class=DummyContentSeeder --database=mysql_testing
105105
```
106106

107107
Once the database has been migrated & seeded, you can run the tests like so:
108108

109-
```bash
109+
```bash
110110
docker-compose run app php vendor/bin/phpunit
111111
```
112112

tests/Auth/AuthTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function test_auth_working()
1515

1616
public function test_login()
1717
{
18-
$this->login('admin@admin.com', 'password')->assertRedirect('/');
18+
$this->login('admin@example.com', 'password')->assertRedirect('/');
1919
}
2020

2121
public function test_public_viewing()
@@ -60,7 +60,7 @@ public function test_login_redirects_to_initially_requested_url_correctly()
6060
$page = $this->entities->page();
6161

6262
$this->get($page->getUrl())->assertRedirect(url('/login'));
63-
$this->login('admin@admin.com', 'password')
63+
$this->login('admin@example.com', 'password')
6464
->assertRedirect($page->getUrl());
6565
}
6666

@@ -70,7 +70,7 @@ public function test_login_intended_redirect_does_not_redirect_to_external_pages
7070
$this->setSettings(['app-public' => true]);
7171

7272
$this->get('/login', ['referer' => 'https://example.com']);
73-
$login = $this->post('/login', ['email' => 'admin@admin.com', 'password' => 'password']);
73+
$login = $this->post('/login', ['email' => 'admin@example.com', 'password' => 'password']);
7474

7575
$login->assertRedirect('http://localhost');
7676
}
@@ -79,13 +79,13 @@ public function test_login_intended_redirect_does_not_factor_mfa_routes()
7979
{
8080
$this->get('/books')->assertRedirect('/login');
8181
$this->get('/mfa/setup')->assertRedirect('/login');
82-
$login = $this->post('/login', ['email' => 'admin@admin.com', 'password' => 'password']);
82+
$login = $this->post('/login', ['email' => 'admin@example.com', 'password' => 'password']);
8383
$login->assertRedirect('/books');
8484
}
8585

8686
public function test_login_authenticates_admins_on_all_guards()
8787
{
88-
$this->post('/login', ['email' => 'admin@admin.com', 'password' => 'password']);
88+
$this->post('/login', ['email' => 'admin@example.com', 'password' => 'password']);
8989
$this->assertTrue(auth()->check());
9090
$this->assertTrue(auth('ldap')->check());
9191
$this->assertTrue(auth('saml2')->check());
@@ -113,8 +113,8 @@ public function test_failed_logins_are_logged_when_message_configured()
113113
$this->post('/login', ['email' => '[email protected]', 'password' => 'cattreedog']);
114114
$this->assertTrue($log->hasWarningThatContains('Failed login for [email protected]'));
115115

116-
$this->post('/login', ['email' => 'admin@admin.com', 'password' => 'password']);
117-
$this->assertFalse($log->hasWarningThatContains('Failed login for admin@admin.com'));
116+
$this->post('/login', ['email' => 'admin@example.com', 'password' => 'password']);
117+
$this->assertFalse($log->hasWarningThatContains('Failed login for admin@example.com'));
118118
}
119119

120120
public function test_logged_in_user_with_unconfirmed_email_is_logged_out()
@@ -151,4 +151,4 @@ protected function login(string $email, string $password): TestResponse
151151
{
152152
return $this->post('/login', compact('email', 'password'));
153153
}
154-
}
154+
}

tests/Auth/ResetPasswordTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ public function test_reset_flow()
2020
$this->withHtml($resp)->assertElementContains('form[action="' . url('/password/email') . '"]', 'Send Reset Link');
2121

2222
$resp = $this->post('/password/email', [
23-
'email' => 'admin@admin.com',
23+
'email' => 'admin@example.com',
2424
]);
2525
$resp->assertRedirect('/password/email');
2626

2727
$resp = $this->get('/password/email');
28-
$resp->assertSee('A password reset link will be sent to admin@admin.com if that email address is found in the system.');
28+
$resp->assertSee('A password reset link will be sent to admin@example.com if that email address is found in the system.');
2929

3030
$this->assertDatabaseHas('password_resets', [
31-
'email' => 'admin@admin.com',
31+
'email' => 'admin@example.com',
3232
]);
3333

3434
/** @var User $user */
35-
$user = User::query()->where('email', '=', 'admin@admin.com')->first();
35+
$user = User::query()->where('email', '=', 'admin@example.com')->first();
3636

3737
Notification::assertSentTo($user, ResetPasswordNotification::class);
3838
$n = Notification::sent($user, ResetPasswordNotification::class);
@@ -42,10 +42,10 @@ public function test_reset_flow()
4242
->assertSee('Reset Password');
4343

4444
$resp = $this->post('/password/reset', [
45-
'email' => 'admin@admin.com',
46-
'password' => 'randompass',
45+
'email' => 'admin@example.com',
46+
'password' => 'randompass',
4747
'password_confirmation' => 'randompass',
48-
'token' => $n->first()->token,
48+
'token' => $n->first()->token,
4949
]);
5050
$resp->assertRedirect('/');
5151

@@ -63,10 +63,10 @@ public function test_reset_flow_shows_success_message_even_if_wrong_password_to_
6363

6464
$this->get('/password/reset/arandometokenvalue')->assertSee('Reset Password');
6565
$resp = $this->post('/password/reset', [
66-
'email' => '[email protected]',
67-
'password' => 'randompass',
66+
'email' => '[email protected]',
67+
'password' => 'randompass',
6868
'password_confirmation' => 'randompass',
69-
'token' => 'arandometokenvalue',
69+
'token' => 'arandometokenvalue',
7070
]);
7171
$resp->assertRedirect('/password/reset/arandometokenvalue');
7272

@@ -98,4 +98,4 @@ public function test_reset_request_is_throttled()
9898
Notification::assertTimesSent(1, ResetPasswordNotification::class);
9999
$resp->assertSee('A password reset link will be sent to ' . $editor->email . ' if that email address is found in the system.');
100100
}
101-
}
101+
}

tests/PublicActionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function test_public_page_creation()
105105

106106
$user = User::getDefault();
107107
$this->assertDatabaseHas('pages', [
108-
'name' => 'My guest page',
108+
'name' => 'My guest page',
109109
'chapter_id' => $chapter->id,
110110
'created_by' => $user->id,
111111
'updated_by' => $user->id,
@@ -175,7 +175,7 @@ public function test_public_view_then_login_redirects_to_previous_content()
175175
$resp->assertSee($book->name);
176176

177177
$this->get('/login');
178-
$resp = $this->post('/login', ['email' => 'admin@admin.com', 'password' => 'password']);
178+
$resp = $this->post('/login', ['email' => 'admin@example.com', 'password' => 'password']);
179179
$resp->assertRedirect($book->getUrl());
180180
}
181181

@@ -189,7 +189,7 @@ public function test_access_hidden_content_then_login_redirects_to_intended_cont
189189
$resp->assertSee('Book not found');
190190

191191
$this->get('/login');
192-
$resp = $this->post('/login', ['email' => 'admin@admin.com', 'password' => 'password']);
192+
$resp = $this->post('/login', ['email' => 'admin@example.com', 'password' => 'password']);
193193
$resp->assertRedirect($book->getUrl());
194194
$this->followRedirects($resp)->assertSee($book->name);
195195
}
@@ -219,4 +219,4 @@ public function test_public_user_cannot_view_or_update_their_profile()
219219
$resp = $this->put($guest->getEditUrl(), ['name' => 'My new guest name']);
220220
$this->assertPermissionError($resp);
221221
}
222-
}
222+
}

tests/ThemeTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function test_event_auth_login_standard()
154154
};
155155

156156
Theme::listen(ThemeEvents::AUTH_LOGIN, $callback);
157-
$this->post('/login', ['email' => 'admin@admin.com', 'password' => 'password']);
157+
$this->post('/login', ['email' => 'admin@example.com', 'password' => 'password']);
158158

159159
$this->assertCount(2, $args);
160160
$this->assertEquals('standard', $args[0]);
@@ -259,7 +259,7 @@ public function test_event_page_include_parse()
259259
public function test_add_social_driver()
260260
{
261261
Theme::addSocialDriver('catnet', [
262-
'client_id' => 'abc123',
262+
'client_id' => 'abc123',
263263
'client_secret' => 'def456',
264264
], 'SocialiteProviders\Discord\DiscordExtendSocialite@handleTesting');
265265

@@ -274,9 +274,9 @@ public function test_add_social_driver()
274274
public function test_add_social_driver_uses_name_in_config_if_given()
275275
{
276276
Theme::addSocialDriver('catnet', [
277-
'client_id' => 'abc123',
277+
'client_id' => 'abc123',
278278
'client_secret' => 'def456',
279-
'name' => 'Super Cat Name',
279+
'name' => 'Super Cat Name',
280280
], 'SocialiteProviders\Discord\DiscordExtendSocialite@handleTesting');
281281

282282
$this->assertEquals('Super Cat Name', config('services.catnet.name'));
@@ -289,9 +289,9 @@ public function test_add_social_driver_allows_a_configure_for_redirect_callback_
289289
Theme::addSocialDriver(
290290
'discord',
291291
[
292-
'client_id' => 'abc123',
292+
'client_id' => 'abc123',
293293
'client_secret' => 'def456',
294-
'name' => 'Super Cat Name',
294+
'name' => 'Super Cat Name',
295295
],
296296
'SocialiteProviders\Discord\DiscordExtendSocialite@handle',
297297
function ($driver) {
@@ -392,4 +392,4 @@ public function handle()
392392
{
393393
$this->line('Command ran!');
394394
}
395-
}
395+
}

0 commit comments

Comments
 (0)