add console command docs
This commit is contained in:
11
README.md
11
README.md
@ -1,4 +1,4 @@
|
||||
Yii2 Usuario Extension
|
||||
Yii 2 Usuario Extension
|
||||
======================
|
||||
|
||||
[](http://yii2-usuario.readthedocs.io/en/latest/?badge=latest)
|
||||
@ -39,5 +39,14 @@ Please, remember that we may not be online all the time. We expect that we can b
|
||||
|
||||
Please, read our [CONTRIBUTION guidelines](CONTRIBUTING.md).
|
||||
|
||||
## Credits
|
||||
|
||||
This module is highly inspired by the excellent work of [Dektrium](https://dektrium.com/) on both of its modules:
|
||||
|
||||
- [Yii 2 User](https://github.com/dektrium/yii2-user)
|
||||
- [Yii 2 RBAC](https://github.com/dektrium/yii2-rbac)
|
||||
|
||||
In fact, we have used some of its processes, commands, views, and some of its attribute names to somehow standardize the
|
||||
modules and make it easier for our developers to swap from [Dektrium's](https://dektrium.com) modules to our own.
|
||||
|
||||
[](http://www.2amigos.us)
|
||||
|
||||
@ -1 +1,7 @@
|
||||
Separate Frontend and Backend Sessions
|
||||
======================================
|
||||
|
||||
- TODO
|
||||
|
||||
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
|
||||
62
docs/installation/console-commands.md
Normal file
62
docs/installation/console-commands.md
Normal file
@ -0,0 +1,62 @@
|
||||
Console Commands
|
||||
================
|
||||
|
||||
The module comes with a set of console commands to facilitate some of the most common actions during development time:
|
||||
|
||||
- `user/create` to create a new user
|
||||
- `user/confirm` to confirm a user
|
||||
- `user/delete` to delete a user
|
||||
- `user/password` to update a user's password
|
||||
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
To enable the commands add the following configuration details to your console config of your application:
|
||||
|
||||
```php
|
||||
// ...
|
||||
|
||||
'modules' => [
|
||||
'user' => Da\User\Module::class,
|
||||
]
|
||||
```
|
||||
|
||||
How to Use Them
|
||||
---------------
|
||||
|
||||
#### user/create
|
||||
|
||||
If password is not set, it will automatically generate it. The newly created user will receive an email message with its
|
||||
new credentials.
|
||||
|
||||
```php
|
||||
./yii user/create <email> <username> [password]
|
||||
```
|
||||
|
||||
#### user/confirm
|
||||
|
||||
You can confirm a user whether by using its email or username.
|
||||
|
||||
```php
|
||||
./yii user/confirm <email|username>
|
||||
```
|
||||
|
||||
#### user/delete
|
||||
|
||||
You can delete a user whether by using its email or username.
|
||||
|
||||
```php
|
||||
./yii user/delete <email|username>
|
||||
```
|
||||
|
||||
#### user/delete
|
||||
|
||||
You can update a user's password whether by using its email or username.
|
||||
|
||||
```php
|
||||
./yii user/password <email|username> <password>
|
||||
```
|
||||
|
||||
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
@ -25,6 +25,7 @@ class CreateController extends Controller
|
||||
|
||||
public function actionIndex($email, $username, $password = null)
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->make(
|
||||
User::class,
|
||||
['scenario' => 'create', 'email' => $email, 'username' => $username, 'password' => $password]
|
||||
|
||||
@ -5,6 +5,7 @@ namespace Da\User\Service;
|
||||
use Da\User\Contracts\ServiceInterface;
|
||||
use Yii;
|
||||
use yii\mail\BaseMailer;
|
||||
use yii\mail\MailerInterface;
|
||||
|
||||
class MailService implements ServiceInterface
|
||||
{
|
||||
@ -25,9 +26,9 @@ class MailService implements ServiceInterface
|
||||
* @param string $subject
|
||||
* @param string $view
|
||||
* @param array $params
|
||||
* @param MailerInterface $mailer
|
||||
* @param BaseMailer|MailerInterface $mailer
|
||||
*/
|
||||
public function __construct($from, $to, $subject, $view, array $params, BaseMailer $mailer)
|
||||
public function __construct($from, $to, $subject, $view, array $params, MailerInterface $mailer)
|
||||
{
|
||||
$this->from = $from;
|
||||
$this->to = $to;
|
||||
|
||||
Reference in New Issue
Block a user