Skip to content

docs: add configuration for Config\Email #570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@ Require it with an explicit version constraint allowing its desired stability.
php spark shield:setup
```

2. Configure `app/Config/Email.php` to allow Shield to send emails with the [Email Class](https://codeigniter.com/user_guide/libraries/email.html).

```php
<?php

namespace Config;

use CodeIgniter\Config\BaseConfig;

class Email extends BaseConfig
{
/**
* @var string
*/
public $fromEmail = '[email protected]';

/**
* @var string
*/
public $fromName = 'your name';

// ...
}
```

### Manual Setup

There are a few setup items to do before you can start using Shield in
Expand Down Expand Up @@ -134,6 +159,31 @@ your project.

1. Use InnoDB, not MyISAM.

6. Configure `app/Config/Email.php` to allow Shield to send emails.

```php
<?php

namespace Config;

use CodeIgniter\Config\BaseConfig;

class Email extends BaseConfig
{
/**
* @var string
*/
public $fromEmail = '[email protected]';

/**
* @var string
*/
public $fromName = 'your name';

// ...
}
```

## Controller Filters
The [Controller Filters](https://codeigniter.com/user_guide/incoming/filters.html) you can use to protect your routes the shield provides are:

Expand Down
6 changes: 6 additions & 0 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public int $unusedTokenLifetime = YEAR;

### Enable Account Activation via Email

> **Note** You need to configure `app/Config/Email.php` to allow Shield to send emails. See [Installation](install.md#initial-setup).

By default, once a user registers they have an active account that can be used. You can enable Shield's built-in, email-based activation flow within the `Auth` config file.

```php
Expand All @@ -120,6 +122,8 @@ public array $actions = [

### Enable Two-Factor Authentication

> **Note** You need to configure `app/Config/Email.php` to allow Shield to send emails. See [Installation](install.md#initial-setup).

Turned off by default, Shield's Email-based 2FA can be enabled by specifying the class to use in the `Auth` config file.

```php
Expand All @@ -131,6 +135,8 @@ public array $actions = [

### Responding to Magic Link Logins

> **Note** You need to configure `app/Config/Email.php` to allow Shield to send emails. See [Installation](install.md#initial-setup).

Magic Link logins allow a user that has forgotten their password to have an email sent with a unique, one-time login link. Once they've logged in you can decide how to respond. In some cases, you might want to redirect them to a special page where they must choose a new password. In other cases, you might simply want to display a one-time message prompting them to go to their account page and choose a new password.

#### Session Notification
Expand Down