Modulos Externos

Versión 5 (Guillermo Zdanowicz, 18/03/2016 00:55)

1 1 Guillermo Zdanowicz
h1. Modulos Externos
2 1 Guillermo Zdanowicz
3 3 Guillermo Zdanowicz
Basandonos en el link
4 3 Guillermo Zdanowicz
5 3 Guillermo Zdanowicz
http://code.tutsplus.com/tutorials/how-to-program-with-yii2-integrating-user-registration--cms-22974
6 3 Guillermo Zdanowicz
7 1 Guillermo Zdanowicz
en el archivo composer.json del raiz se agrego 
8 1 Guillermo Zdanowicz
9 1 Guillermo Zdanowicz
 *"dektrium/yii2-user": "*"*
10 1 Guillermo Zdanowicz
11 1 Guillermo Zdanowicz
<pre>
12 1 Guillermo Zdanowicz
    "require": {
13 1 Guillermo Zdanowicz
        "php": ">=5.4.0",
14 1 Guillermo Zdanowicz
        "yiisoft/yii2": ">=2.0.5",
15 1 Guillermo Zdanowicz
        "yiisoft/yii2-bootstrap": "*",
16 1 Guillermo Zdanowicz
        "yiisoft/yii2-swiftmailer": "*",
17 1 Guillermo Zdanowicz
        "dektrium/yii2-user": "*"
18 1 Guillermo Zdanowicz
    },
19 1 Guillermo Zdanowicz
</pre>
20 2 Guillermo Zdanowicz
21 2 Guillermo Zdanowicz
y se corrio la sentencia
22 2 Guillermo Zdanowicz
23 2 Guillermo Zdanowicz
*./composer.phar update*
24 2 Guillermo Zdanowicz
25 2 Guillermo Zdanowicz
para bajar paquetes de gestion de usuarios
26 4 Guillermo Zdanowicz
27 4 Guillermo Zdanowicz
en /config/web.php
28 4 Guillermo Zdanowicz
29 4 Guillermo Zdanowicz
cambiamos
30 4 Guillermo Zdanowicz
31 4 Guillermo Zdanowicz
<pre>
32 4 Guillermo Zdanowicz
        'user' => [
33 4 Guillermo Zdanowicz
            'identityClass' => 'app\models\User',
34 4 Guillermo Zdanowicz
            'enableAutoLogin' => true,
35 4 Guillermo Zdanowicz
        ],
36 4 Guillermo Zdanowicz
</pre>
37 4 Guillermo Zdanowicz
38 4 Guillermo Zdanowicz
por
39 4 Guillermo Zdanowicz
40 4 Guillermo Zdanowicz
<pre>
41 4 Guillermo Zdanowicz
		'user' => [
42 4 Guillermo Zdanowicz
			'class' => 'dektrium\user\Module',
43 4 Guillermo Zdanowicz
			'enableUnconfirmedLogin' => true,
44 4 Guillermo Zdanowicz
			'confirmWithin' => 21600,
45 4 Guillermo Zdanowicz
			'cost' => 12,
46 4 Guillermo Zdanowicz
			'admins' => ['admin']
47 4 Guillermo Zdanowicz
		],
48 4 Guillermo Zdanowicz
</pre>
49 4 Guillermo Zdanowicz
50 4 Guillermo Zdanowicz
Y para gestion de email
51 4 Guillermo Zdanowicz
52 4 Guillermo Zdanowicz
<pre>
53 4 Guillermo Zdanowicz
        'mailer' => [
54 4 Guillermo Zdanowicz
            'class' => 'yii\swiftmailer\Mailer',
55 4 Guillermo Zdanowicz
            // send all mails to a file by default. You have to set
56 4 Guillermo Zdanowicz
            // 'useFileTransport' to false and configure a transport
57 4 Guillermo Zdanowicz
            // for the mailer to send real emails.
58 4 Guillermo Zdanowicz
            'useFileTransport' => true,
59 4 Guillermo Zdanowicz
        ],
60 4 Guillermo Zdanowicz
</pre>
61 4 Guillermo Zdanowicz
62 4 Guillermo Zdanowicz
por
63 4 Guillermo Zdanowicz
64 4 Guillermo Zdanowicz
<pre>
65 4 Guillermo Zdanowicz
		'mailer' => [
66 4 Guillermo Zdanowicz
        'class' => 'yii\swiftmailer\Mailer',
67 4 Guillermo Zdanowicz
        'viewPath' => '@app/mailer',
68 4 Guillermo Zdanowicz
        'useFileTransport' => false,
69 4 Guillermo Zdanowicz
        'transport' => [
70 4 Guillermo Zdanowicz
            'class' => 'Swift_SmtpTransport',
71 4 Guillermo Zdanowicz
            'host' => 'your-host-domain e.g. smtp.gmail.com',
72 4 Guillermo Zdanowicz
            'username' => 'informatica@ucu.edu.ar',
73 4 Guillermo Zdanowicz
            'password' => 'xxxxxxx',
74 4 Guillermo Zdanowicz
            'port' => '587',
75 4 Guillermo Zdanowicz
            'encryption' => 'tls',
76 4 Guillermo Zdanowicz
                        ],
77 4 Guillermo Zdanowicz
    ],
78 4 Guillermo Zdanowicz
</pre>
79 5 Guillermo Zdanowicz
80 5 Guillermo Zdanowicz
en /views/layouts/main.php
81 5 Guillermo Zdanowicz
82 5 Guillermo Zdanowicz
reemplazar
83 5 Guillermo Zdanowicz
84 5 Guillermo Zdanowicz
<pre>
85 5 Guillermo Zdanowicz
 echo Nav::widget([
86 5 Guillermo Zdanowicz
        'options' => ['class' => 'navbar-nav navbar-right'],
87 5 Guillermo Zdanowicz
        'items' => [
88 5 Guillermo Zdanowicz
            ['label' => 'Home', 'url' => ['/site/index']],
89 5 Guillermo Zdanowicz
            ['label' => 'Proveedores', 'url' => ['/proveedores']],
90 5 Guillermo Zdanowicz
            ['label' => 'Compras', 'url' => ['/compras']],
91 5 Guillermo Zdanowicz
            ['label' => 'Pagos', 'url' => ['/pagos']],
92 5 Guillermo Zdanowicz
            Yii::$app->user->isGuest ? (
93 5 Guillermo Zdanowicz
                ['label' => 'Login', 'url' => ['/site/login']]
94 5 Guillermo Zdanowicz
            ) : (
95 5 Guillermo Zdanowicz
                '<li>'
96 5 Guillermo Zdanowicz
                . Html::beginForm(['/site/logout'], 'post')
97 5 Guillermo Zdanowicz
                . Html::submitButton(
98 5 Guillermo Zdanowicz
                    'Logout (' . Yii::$app->user->identity->username . ')',
99 5 Guillermo Zdanowicz
                    ['class' => 'btn btn-link']
100 5 Guillermo Zdanowicz
                )
101 5 Guillermo Zdanowicz
                . Html::endForm()
102 5 Guillermo Zdanowicz
                . '</li>'
103 5 Guillermo Zdanowicz
            )
104 5 Guillermo Zdanowicz
        ],
105 5 Guillermo Zdanowicz
    ]);
106 5 Guillermo Zdanowicz
</pre>
107 5 Guillermo Zdanowicz
108 5 Guillermo Zdanowicz
por
109 5 Guillermo Zdanowicz
110 5 Guillermo Zdanowicz
<pre>
111 5 Guillermo Zdanowicz
112 5 Guillermo Zdanowicz
</pre>
Redmine Appliance - Powered by TurnKey Linux