From 6d47dcaf22f9d6be2e88b646cb6cc03dc0abc33c Mon Sep 17 00:00:00 2001 From: Antonio Ramirez Date: Sat, 10 Dec 2016 20:55:17 +0100 Subject: [PATCH] added views and Authclients --- lib/User/AuthClient/Facebook.php | 25 ++++ lib/User/AuthClient/GitHub.php | 27 +++++ lib/User/AuthClient/Google.php | 25 ++++ lib/User/AuthClient/LinkedIn.php | 25 ++++ lib/User/AuthClient/Twitter.php | 26 +++++ lib/User/AuthClient/VKontakte.php | 39 +++++++ lib/User/AuthClient/Yandex.php | 42 +++++++ lib/User/Controller/RecoveryController.php | 6 +- .../Controller/RegistrationController.php | 4 +- lib/User/resources/views/admin/_account.php | 45 ++++++++ .../resources/views/admin/_assignments.php | 32 +++++ lib/User/resources/views/admin/_info.php | 58 ++++++++++ lib/User/resources/views/admin/_menu.php | 56 +++++++++ lib/User/resources/views/admin/_profile.php | 52 +++++++++ lib/User/resources/views/admin/_user.php | 20 ++++ lib/User/resources/views/admin/create.php | 86 ++++++++++++++ lib/User/resources/views/admin/index.php | 107 +++++++++++++++++ lib/User/resources/views/admin/update.php | 109 ++++++++++++++++++ .../resources/views/mail/confirmation.php | 34 ++++++ .../resources/views/mail/layouts/html.php | 64 ++++++++++ .../resources/views/mail/layouts/text.php | 21 ++++ .../resources/views/mail/reconfirmation.php | 37 ++++++ lib/User/resources/views/mail/recovery.php | 34 ++++++ .../views/mail/text/confirmation.php | 26 +++++ .../views/mail/text/reconfirmation.php | 29 +++++ .../resources/views/mail/text/recovery.php | 26 +++++ .../resources/views/mail/text/welcome.php | 32 +++++ lib/User/resources/views/mail/welcome.php | 48 ++++++++ lib/User/resources/views/profile/show.php | 51 ++++++++ lib/User/resources/views/recovery/request.php | 45 ++++++++ lib/User/resources/views/recovery/reset.php | 45 ++++++++ .../resources/views/registration/connect.php | 63 ++++++++++ .../resources/views/registration/register.php | 54 +++++++++ .../resources/views/registration/resend.php | 44 +++++++ lib/User/resources/views/security/login.php | 92 +++++++++++++++ lib/User/resources/views/settings/_menu.php | 47 ++++++++ lib/User/resources/views/settings/account.php | 88 ++++++++++++++ .../resources/views/settings/networks.php | 72 ++++++++++++ lib/User/resources/views/settings/profile.php | 90 +++++++++++++++ lib/User/resources/views/shared/_alert.php | 32 +++++ lib/User/resources/views/shared/message.php | 23 ++++ 41 files changed, 1876 insertions(+), 5 deletions(-) create mode 100644 lib/User/AuthClient/Facebook.php create mode 100644 lib/User/AuthClient/GitHub.php create mode 100644 lib/User/AuthClient/Google.php create mode 100644 lib/User/AuthClient/LinkedIn.php create mode 100644 lib/User/AuthClient/Twitter.php create mode 100644 lib/User/AuthClient/VKontakte.php create mode 100644 lib/User/AuthClient/Yandex.php create mode 100644 lib/User/resources/views/admin/_account.php create mode 100644 lib/User/resources/views/admin/_assignments.php create mode 100644 lib/User/resources/views/admin/_info.php create mode 100644 lib/User/resources/views/admin/_menu.php create mode 100644 lib/User/resources/views/admin/_profile.php create mode 100644 lib/User/resources/views/admin/_user.php create mode 100644 lib/User/resources/views/admin/create.php create mode 100644 lib/User/resources/views/admin/index.php create mode 100644 lib/User/resources/views/admin/update.php create mode 100644 lib/User/resources/views/mail/confirmation.php create mode 100644 lib/User/resources/views/mail/layouts/html.php create mode 100644 lib/User/resources/views/mail/layouts/text.php create mode 100644 lib/User/resources/views/mail/reconfirmation.php create mode 100644 lib/User/resources/views/mail/recovery.php create mode 100644 lib/User/resources/views/mail/text/confirmation.php create mode 100644 lib/User/resources/views/mail/text/reconfirmation.php create mode 100644 lib/User/resources/views/mail/text/recovery.php create mode 100644 lib/User/resources/views/mail/text/welcome.php create mode 100644 lib/User/resources/views/mail/welcome.php create mode 100644 lib/User/resources/views/profile/show.php create mode 100644 lib/User/resources/views/recovery/request.php create mode 100644 lib/User/resources/views/recovery/reset.php create mode 100644 lib/User/resources/views/registration/connect.php create mode 100644 lib/User/resources/views/registration/register.php create mode 100644 lib/User/resources/views/registration/resend.php create mode 100644 lib/User/resources/views/security/login.php create mode 100644 lib/User/resources/views/settings/_menu.php create mode 100644 lib/User/resources/views/settings/account.php create mode 100644 lib/User/resources/views/settings/networks.php create mode 100644 lib/User/resources/views/settings/profile.php create mode 100644 lib/User/resources/views/shared/_alert.php create mode 100644 lib/User/resources/views/shared/message.php diff --git a/lib/User/AuthClient/Facebook.php b/lib/User/AuthClient/Facebook.php new file mode 100644 index 0000000..bc08f57 --- /dev/null +++ b/lib/User/AuthClient/Facebook.php @@ -0,0 +1,25 @@ +getUserAttributes()['email']) + ? $this->getUserAttributes()['email'] + : null; + } + + /** + * @inheritdoc + */ + public function getUsername() + { + return; + } +} diff --git a/lib/User/AuthClient/GitHub.php b/lib/User/AuthClient/GitHub.php new file mode 100644 index 0000000..0a5d45d --- /dev/null +++ b/lib/User/AuthClient/GitHub.php @@ -0,0 +1,27 @@ +getUserAttributes()['email']) + ? $this->getUserAttributes()['email'] + : null; + } + + /** + * @inheritdoc + */ + public function getUsername() + { + return isset($this->getUserAttributes()['login']) + ? $this->getUserAttributes()['login'] + : null; + } +} diff --git a/lib/User/AuthClient/Google.php b/lib/User/AuthClient/Google.php new file mode 100644 index 0000000..3fe4f3d --- /dev/null +++ b/lib/User/AuthClient/Google.php @@ -0,0 +1,25 @@ +getUserAttributes()['emails'][0]['value']) + ? $this->getUserAttributes()['emails'][0]['value'] + : null; + } + + /** + * @inheritdoc + */ + public function getUsername() + { + return; + } +} diff --git a/lib/User/AuthClient/LinkedIn.php b/lib/User/AuthClient/LinkedIn.php new file mode 100644 index 0000000..919a1c2 --- /dev/null +++ b/lib/User/AuthClient/LinkedIn.php @@ -0,0 +1,25 @@ +getUserAttributes()['email-address']) + ? $this->getUserAttributes()['email-address'] + : null; + } + + /** + * @inheritdoc + */ + public function getUsername() + { + return; + } +} diff --git a/lib/User/AuthClient/Twitter.php b/lib/User/AuthClient/Twitter.php new file mode 100644 index 0000000..0733b3e --- /dev/null +++ b/lib/User/AuthClient/Twitter.php @@ -0,0 +1,26 @@ +getUserAttributes()['screen_name']) + ? $this->getUserAttributes()['screen_name'] + : null; + } + + /** + * @return null Twitter does not provide user's email address + */ + public function getEmail() + { + return null; + } +} diff --git a/lib/User/AuthClient/VKontakte.php b/lib/User/AuthClient/VKontakte.php new file mode 100644 index 0000000..6101099 --- /dev/null +++ b/lib/User/AuthClient/VKontakte.php @@ -0,0 +1,39 @@ +getAccessToken()->getParam('email'); + } + + /** + * @inheritdoc + */ + public function getUsername() + { + return isset($this->getUserAttributes()['screen_name']) + ? $this->getUserAttributes()['screen_name'] + : null; + } + + /** + * @inheritdoc + */ + protected function defaultTitle() + { + return Yii::t('user', 'VKontakte'); + } +} diff --git a/lib/User/AuthClient/Yandex.php b/lib/User/AuthClient/Yandex.php new file mode 100644 index 0000000..ead2475 --- /dev/null +++ b/lib/User/AuthClient/Yandex.php @@ -0,0 +1,42 @@ +getUserAttributes()['emails']) + ? $this->getUserAttributes()['emails'] + : null; + + if ($emails !== null && isset($emails[0])) { + return $emails[0]; + } else { + return null; + } + } + + /** + * @inheritdoc + */ + public function getUsername() + { + return isset($this->getUserAttributes()['login']) + ? $this->getUserAttributes()['login'] + : null; + } + + /** + * @inheritdoc + */ + protected function defaultTitle() + { + return Yii::t('user', 'Yandex'); + } +} diff --git a/lib/User/Controller/RecoveryController.php b/lib/User/Controller/RecoveryController.php index 14555b8..d7436b4 100644 --- a/lib/User/Controller/RecoveryController.php +++ b/lib/User/Controller/RecoveryController.php @@ -90,7 +90,7 @@ class RecoveryController extends Controller $this->trigger(FormEvent::EVENT_AFTER_REQUEST, $event); return $this->render( - 'message', + '/user/shared/message', [ 'title' => Yii::t('user', 'Recovery message sent'), 'module' => $this->module, @@ -130,7 +130,7 @@ class RecoveryController extends Controller ); return $this->render( - 'message', + '/user/shared/message', [ 'title' => Yii::t('user', 'Invalid or expired link'), 'module' => $this->module, @@ -149,7 +149,7 @@ class RecoveryController extends Controller $this->trigger(ResetPasswordEvent::EVENT_AFTER_RESET, $event); return $this->render( - 'message', + '/user/shared/message', [ 'title' => Yii::t('user', 'Password has been changed'), 'module' => $this->module, diff --git a/lib/User/Controller/RegistrationController.php b/lib/User/Controller/RegistrationController.php index 045a401..f84b702 100644 --- a/lib/User/Controller/RegistrationController.php +++ b/lib/User/Controller/RegistrationController.php @@ -106,7 +106,7 @@ class RegistrationController extends Controller 'Your account has been created and a message with further instructions has been sent to your email' ) ); - return $this->render('message', [ + return $this->render('/user/shared/message', [ 'title' => Yii::t('user', 'Your account has been created') ]); } @@ -186,7 +186,7 @@ class RegistrationController extends Controller } return $this->render( - 'message', + '/user/shared/message', [ 'title' => Yii::t('user', 'Account confirmation'), 'module' => $this->module, diff --git a/lib/User/resources/views/admin/_account.php b/lib/User/resources/views/admin/_account.php new file mode 100644 index 0000000..af4dcef --- /dev/null +++ b/lib/User/resources/views/admin/_account.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\bootstrap\ActiveForm; +use yii\helpers\Html; + +/* + * @var yii\web\View $this + * @var dektrium\user\models\User $user + */ + +?> + +beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?> + + 'horizontal', + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + 'fieldConfig' => [ + 'horizontalCssClasses' => [ + 'wrapper' => 'col-sm-9', + ], + ], +]); ?> + +render('_user', ['form' => $form, 'user' => $user]) ?> + +
+
+ 'btn btn-block btn-success']) ?> +
+
+ + + +endContent() ?> diff --git a/lib/User/resources/views/admin/_assignments.php b/lib/User/resources/views/admin/_assignments.php new file mode 100644 index 0000000..50f93ba --- /dev/null +++ b/lib/User/resources/views/admin/_assignments.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use dektrium\rbac\widgets\Assignments; + +/** + * @var yii\web\View $this + * @var dektrium\user\models\User $user + */ + +?> + +beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?> + + [ + 'class' => 'alert-info alert-dismissible', + ], + 'body' => Yii::t('user', 'You can assign multiple roles or permissions to user by using the form below'), +]) ?> + + $user->id]) ?> + +endContent() ?> diff --git a/lib/User/resources/views/admin/_info.php b/lib/User/resources/views/admin/_info.php new file mode 100644 index 0000000..03345a6 --- /dev/null +++ b/lib/User/resources/views/admin/_info.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +/** + * @var yii\web\View + * @var dektrium\user\models\User + */ +?> + +beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?> + + + + + + + registration_ip !== null): ?> + + + + + + + + isConfirmed): ?> + + + + + + + + isBlocked): ?> + + + + + +
:created_at]) ?>
:registration_ip ?>
:confirmed_at] + ) ?>
:blocked_at] + ) ?> +
+ +endContent() ?> diff --git a/lib/User/resources/views/admin/_menu.php b/lib/User/resources/views/admin/_menu.php new file mode 100644 index 0000000..efe0bf0 --- /dev/null +++ b/lib/User/resources/views/admin/_menu.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\bootstrap\Nav; + +?> + + [ + 'class' => 'nav-tabs', + 'style' => 'margin-bottom: 15px', + ], + 'items' => [ + [ + 'label' => Yii::t('user', 'Users'), + 'url' => ['/user/admin/index'], + ], + [ + 'label' => Yii::t('user', 'Roles'), + 'url' => ['/rbac/role/index'], + 'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']), + ], + [ + 'label' => Yii::t('user', 'Permissions'), + 'url' => ['/rbac/permission/index'], + 'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']), + ], + [ + 'label' => Yii::t('user', 'Create'), + 'items' => [ + [ + 'label' => Yii::t('user', 'New user'), + 'url' => ['/user/admin/create'], + ], + [ + 'label' => Yii::t('user', 'New role'), + 'url' => ['/rbac/role/create'], + 'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']), + ], + [ + 'label' => Yii::t('user', 'New permission'), + 'url' => ['/rbac/permission/create'], + 'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']), + ], + ], + ], + ], +]) ?> diff --git a/lib/User/resources/views/admin/_profile.php b/lib/User/resources/views/admin/_profile.php new file mode 100644 index 0000000..b19012c --- /dev/null +++ b/lib/User/resources/views/admin/_profile.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\bootstrap\ActiveForm; +use yii\helpers\Html; + +/** + * @var yii\web\View $this + * @var dektrium\user\models\User $user + * @var dektrium\user\models\Profile $profile + */ + +?> + +beginContent('@dektrium/user/views/admin/update.php', ['user' => $user]) ?> + + 'horizontal', + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + 'fieldConfig' => [ + 'horizontalCssClasses' => [ + 'wrapper' => 'col-sm-9', + ], + ], +]); ?> + +field($profile, 'name') ?> +field($profile, 'public_email') ?> +field($profile, 'website') ?> +field($profile, 'location') ?> +field($profile, 'gravatar_email') ?> +field($profile, 'bio')->textarea() ?> + + +
+
+ 'btn btn-block btn-success']) ?> +
+
+ + + +endContent() ?> diff --git a/lib/User/resources/views/admin/_user.php b/lib/User/resources/views/admin/_user.php new file mode 100644 index 0000000..757b50b --- /dev/null +++ b/lib/User/resources/views/admin/_user.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +/** + * @var yii\widgets\ActiveForm $form + * @var dektrium\user\models\User $user + */ +?> + +field($user, 'email')->textInput(['maxlength' => 255]) ?> +field($user, 'username')->textInput(['maxlength' => 255]) ?> +field($user, 'password')->passwordInput() ?> diff --git a/lib/User/resources/views/admin/create.php b/lib/User/resources/views/admin/create.php new file mode 100644 index 0000000..57036d4 --- /dev/null +++ b/lib/User/resources/views/admin/create.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\bootstrap\ActiveForm; +use yii\bootstrap\Nav; +use yii\helpers\Html; + +/** + * @var yii\web\View $this + * @var dektrium\user\models\User $user + */ + +$this->title = Yii::t('user', 'Create a user account'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Users'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; + +?> + +render('/_alert', [ + 'module' => Yii::$app->getModule('user'), +]) ?> + +render('_menu') ?> + +
+
+
+
+ [ + 'class' => 'nav-pills nav-stacked', + ], + 'items' => [ + ['label' => Yii::t('user', 'Account details'), 'url' => ['/user/admin/create']], + ['label' => Yii::t('user', 'Profile details'), 'options' => [ + 'class' => 'disabled', + 'onclick' => 'return false;', + ]], + ['label' => Yii::t('user', 'Information'), 'options' => [ + 'class' => 'disabled', + 'onclick' => 'return false;', + ]], + ], + ]) ?> +
+
+
+
+
+
+
+ . + . +
+ 'horizontal', + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + 'fieldConfig' => [ + 'horizontalCssClasses' => [ + 'wrapper' => 'col-sm-9', + ], + ], + ]); ?> + + render('_user', ['form' => $form, 'user' => $user]) ?> + +
+
+ 'btn btn-block btn-success']) ?> +
+
+ + +
+
+
+
diff --git a/lib/User/resources/views/admin/index.php b/lib/User/resources/views/admin/index.php new file mode 100644 index 0000000..1a730b8 --- /dev/null +++ b/lib/User/resources/views/admin/index.php @@ -0,0 +1,107 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use dektrium\user\models\UserSearch; +use yii\data\ActiveDataProvider; +use yii\grid\GridView; +use yii\helpers\Html; +use yii\web\View; +use yii\widgets\Pjax; + +/** + * @var View $this + * @var ActiveDataProvider $dataProvider + * @var UserSearch $searchModel + */ + +$this->title = Yii::t('user', 'Manage users'); +$this->params['breadcrumbs'][] = $this->title; +?> + +render('/_alert', [ + 'module' => Yii::$app->getModule('user'), +]) ?> + +render('/admin/_menu') ?> + + + + $dataProvider, + 'filterModel' => $searchModel, + 'layout' => "{items}\n{pager}", + 'columns' => [ + 'username', + 'email:email', + [ + 'attribute' => 'registration_ip', + 'value' => function ($model) { + return $model->registration_ip == null + ? '' . Yii::t('user', '(not set)') . '' + : $model->registration_ip; + }, + 'format' => 'html', + ], + [ + 'attribute' => 'created_at', + 'value' => function ($model) { + if (extension_loaded('intl')) { + return Yii::t('user', '{0, date, MMMM dd, YYYY HH:mm}', [$model->created_at]); + } else { + return date('Y-m-d G:i:s', $model->created_at); + } + }, + ], + [ + 'header' => Yii::t('user', 'Confirmation'), + 'value' => function ($model) { + if ($model->isConfirmed) { + return '
+ ' . Yii::t('user', 'Confirmed') . ' +
'; + } else { + return Html::a(Yii::t('user', 'Confirm'), ['confirm', 'id' => $model->id], [ + 'class' => 'btn btn-xs btn-success btn-block', + 'data-method' => 'post', + 'data-confirm' => Yii::t('user', 'Are you sure you want to confirm this user?'), + ]); + } + }, + 'format' => 'raw', + 'visible' => Yii::$app->getModule('user')->enableConfirmation, + ], + [ + 'header' => Yii::t('user', 'Block status'), + 'value' => function ($model) { + if ($model->isBlocked) { + return Html::a(Yii::t('user', 'Unblock'), ['block', 'id' => $model->id], [ + 'class' => 'btn btn-xs btn-success btn-block', + 'data-method' => 'post', + 'data-confirm' => Yii::t('user', 'Are you sure you want to unblock this user?'), + ]); + } else { + return Html::a(Yii::t('user', 'Block'), ['block', 'id' => $model->id], [ + 'class' => 'btn btn-xs btn-danger btn-block', + 'data-method' => 'post', + 'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?'), + ]); + } + }, + 'format' => 'raw', + ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{update} {delete}', + ], + ], +]); ?> + + diff --git a/lib/User/resources/views/admin/update.php b/lib/User/resources/views/admin/update.php new file mode 100644 index 0000000..7fb4606 --- /dev/null +++ b/lib/User/resources/views/admin/update.php @@ -0,0 +1,109 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use dektrium\user\models\User; +use yii\bootstrap\Nav; +use yii\web\View; + +/** + * @var View $this + * @var User $user + * @var string $content + */ + +$this->title = Yii::t('user', 'Update user account'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('user', 'Users'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; + +?> + +render('/_alert', [ + 'module' => Yii::$app->getModule('user'), +]) ?> + +render('_menu') ?> + +
+
+
+
+ [ + 'class' => 'nav-pills nav-stacked', + ], + 'items' => [ + [ + 'label' => Yii::t('user', 'Account details'), + 'url' => ['/user/admin/update', 'id' => $user->id] + ], + [ + 'label' => Yii::t('user', 'Profile details'), + 'url' => ['/user/admin/update-profile', 'id' => $user->id] + ], + ['label' => Yii::t('user', 'Information'), 'url' => ['/user/admin/info', 'id' => $user->id]], + [ + 'label' => Yii::t('user', 'Assignments'), + 'url' => ['/user/admin/assignments', 'id' => $user->id], + 'visible' => isset(Yii::$app->extensions['dektrium/yii2-rbac']), + ], + '
', + [ + 'label' => Yii::t('user', 'Confirm'), + 'url' => ['/user/admin/confirm', 'id' => $user->id], + 'visible' => !$user->isConfirmed, + 'linkOptions' => [ + 'class' => 'text-success', + 'data-method' => 'post', + 'data-confirm' => Yii::t('user', 'Are you sure you want to confirm this user?'), + ], + ], + [ + 'label' => Yii::t('user', 'Block'), + 'url' => ['/user/admin/block', 'id' => $user->id], + 'visible' => !$user->isBlocked, + 'linkOptions' => [ + 'class' => 'text-danger', + 'data-method' => 'post', + 'data-confirm' => Yii::t('user', 'Are you sure you want to block this user?'), + ], + ], + [ + 'label' => Yii::t('user', 'Unblock'), + 'url' => ['/user/admin/block', 'id' => $user->id], + 'visible' => $user->isBlocked, + 'linkOptions' => [ + 'class' => 'text-success', + 'data-method' => 'post', + 'data-confirm' => Yii::t('user', 'Are you sure you want to unblock this user?'), + ], + ], + [ + 'label' => Yii::t('user', 'Delete'), + 'url' => ['/user/admin/delete', 'id' => $user->id], + 'linkOptions' => [ + 'class' => 'text-danger', + 'data-method' => 'post', + 'data-confirm' => Yii::t('user', 'Are you sure you want to delete this user?'), + ], + ], + ], + ]) ?> +
+
+
+
+
+
+ +
+
+
+
diff --git a/lib/User/resources/views/mail/confirmation.php b/lib/User/resources/views/mail/confirmation.php new file mode 100644 index 0000000..75ded1e --- /dev/null +++ b/lib/User/resources/views/mail/confirmation.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; + +/** + * @var dektrium\user\models\User $user + * @var dektrium\user\models\Token $token + */ +?> +

+ , +

+

+ name) ?>. + . +

+

+ url), $token->url) ?> +

+

+ . +

+

+ . +

diff --git a/lib/User/resources/views/mail/layouts/html.php b/lib/User/resources/views/mail/layouts/html.php new file mode 100644 index 0000000..cd80b96 --- /dev/null +++ b/lib/User/resources/views/mail/layouts/html.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +/** + * @var \yii\web\View $this + * @var yii\mail\BaseMessage $content + */ +?> +beginPage() ?> + + + + + + head() ?> + + + + + + + + +
+
+ + + + +
+ beginBody() ?> + + endBody() ?> +
+
+
+ + + + + + + +endPage() ?> diff --git a/lib/User/resources/views/mail/layouts/text.php b/lib/User/resources/views/mail/layouts/text.php new file mode 100644 index 0000000..097eb30 --- /dev/null +++ b/lib/User/resources/views/mail/layouts/text.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +/** + * @var string $content main view render result + */ +?> + +beginPage() ?> +beginBody() ?> + +endBody() ?> +endPage() ?> diff --git a/lib/User/resources/views/mail/reconfirmation.php b/lib/User/resources/views/mail/reconfirmation.php new file mode 100644 index 0000000..312e166 --- /dev/null +++ b/lib/User/resources/views/mail/reconfirmation.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; + +/** + * @var dektrium\user\models\Token $token + */ +?> +

+ , +

+

+ name + ) ?>. + . +

+

+ getUrl()), $token->getUrl()); ?> +

+

+ . +

+

+ . +

diff --git a/lib/User/resources/views/mail/recovery.php b/lib/User/resources/views/mail/recovery.php new file mode 100644 index 0000000..a7aadb2 --- /dev/null +++ b/lib/User/resources/views/mail/recovery.php @@ -0,0 +1,34 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; + +/** + * @var dektrium\user\models\User $user + * @var dektrium\user\models\Token $token + */ +?> +

+ , +

+

+ name) ?>. + . +

+

+ url), $token->url); ?> +

+

+ . +

+

+ . +

diff --git a/lib/User/resources/views/mail/text/confirmation.php b/lib/User/resources/views/mail/text/confirmation.php new file mode 100644 index 0000000..e2f7a38 --- /dev/null +++ b/lib/User/resources/views/mail/text/confirmation.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +/** + * @var dektrium\user\models\User $user + * @var dektrium\user\models\Token $token + */ +?> +, + +name) ?>. +. + +url ?> + +. + +. diff --git a/lib/User/resources/views/mail/text/reconfirmation.php b/lib/User/resources/views/mail/text/reconfirmation.php new file mode 100644 index 0000000..fdb6c64 --- /dev/null +++ b/lib/User/resources/views/mail/text/reconfirmation.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +/** + * @var dektrium\user\models\Token $token + */ +?> +, + +name +) ?>. +. + +url ?> + +. + +. diff --git a/lib/User/resources/views/mail/text/recovery.php b/lib/User/resources/views/mail/text/recovery.php new file mode 100644 index 0000000..3ffec17 --- /dev/null +++ b/lib/User/resources/views/mail/text/recovery.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +/** + * @var dektrium\user\models\User $user + * @var dektrium\user\models\Token $token + */ +?> +, + +name) ?>. +. + +url ?> + +. + +. diff --git a/lib/User/resources/views/mail/text/welcome.php b/lib/User/resources/views/mail/text/welcome.php new file mode 100644 index 0000000..a9f208c --- /dev/null +++ b/lib/User/resources/views/mail/text/welcome.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +/** + * @var dektrium\user\models\User + */ +?> +, + +name) ?>. +enableGeneratingPassword): ?> +: +password ?> + + + +. + +url ?> + +. + + +. diff --git a/lib/User/resources/views/mail/welcome.php b/lib/User/resources/views/mail/welcome.php new file mode 100644 index 0000000..79da04e --- /dev/null +++ b/lib/User/resources/views/mail/welcome.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; + +/** + * @var dektrium\user\Module $module + * @var dektrium\user\models\User $user + * @var dektrium\user\models\Token $token + * @var bool $showPassword + */ + +?> +

+ , +

+ +

+ name) ?>. + enableGeneratingPassword): ?> + : password ?> + + +

+ + +

+ . +

+

+ url), $token->url); ?> +

+

+ . +

+ + +

+ . +

diff --git a/lib/User/resources/views/profile/show.php b/lib/User/resources/views/profile/show.php new file mode 100644 index 0000000..076ff3e --- /dev/null +++ b/lib/User/resources/views/profile/show.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; + +/** + * @var \yii\web\View $this + * @var \dektrium\user\models\Profile $profile + */ + +$this->title = empty($profile->name) ? Html::encode($profile->user->username) : Html::encode($profile->name); +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+
+
+ getAvatarUrl(230), [ + 'class' => 'img-rounded img-responsive', + 'alt' => $profile->user->username, + ]) ?> +
+
+

title ?>

+
    + location)): ?> +
  • location) ?>
  • + + website)): ?> +
  • website), Html::encode($profile->website)) ?>
  • + + public_email)): ?> +
  • public_email), 'mailto:' . Html::encode($profile->public_email)) ?>
  • + +
  • user->created_at) ?>
  • +
+ bio)): ?> +

bio) ?>

+ +
+
+
+
diff --git a/lib/User/resources/views/recovery/request.php b/lib/User/resources/views/recovery/request.php new file mode 100644 index 0000000..7635380 --- /dev/null +++ b/lib/User/resources/views/recovery/request.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; +use yii\widgets\ActiveForm; + +/* + * @var yii\web\View $this + * @var yii\widgets\ActiveForm $form + * @var dektrium\user\models\RecoveryForm $model + */ + +$this->title = Yii::t('user', 'Recover your password'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+
+
+

title) ?>

+
+
+ 'password-recovery-form', + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + ]); ?> + + field($model, 'email')->textInput(['autofocus' => true]) ?> + + 'btn btn-primary btn-block']) ?>
+ + +
+
+
+
diff --git a/lib/User/resources/views/recovery/reset.php b/lib/User/resources/views/recovery/reset.php new file mode 100644 index 0000000..6f29ea3 --- /dev/null +++ b/lib/User/resources/views/recovery/reset.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; +use yii\widgets\ActiveForm; + +/* + * @var yii\web\View $this + * @var yii\widgets\ActiveForm $form + * @var dektrium\user\models\RecoveryForm $model + */ + +$this->title = Yii::t('user', 'Reset your password'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+
+
+

title) ?>

+
+
+ 'password-recovery-form', + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + ]); ?> + + field($model, 'password')->passwordInput() ?> + + 'btn btn-success btn-block']) ?>
+ + +
+
+
+
diff --git a/lib/User/resources/views/registration/connect.php b/lib/User/resources/views/registration/connect.php new file mode 100644 index 0000000..9ed4957 --- /dev/null +++ b/lib/User/resources/views/registration/connect.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; +use yii\widgets\ActiveForm; + +/** + * @var yii\web\View $this + * @var yii\widgets\ActiveForm $form + * @var dektrium\user\models\User $model + * @var dektrium\user\models\Account $account + */ + +$this->title = Yii::t('user', 'Sign in'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+
+
+

title) ?>

+
+
+
+

+ : +

+
+ 'connect-account-form', + ]); ?> + + field($model, 'email') ?> + + field($model, 'username') ?> + + 'btn btn-success btn-block']) ?> + + +
+
+

+ . +

+
+
diff --git a/lib/User/resources/views/registration/register.php b/lib/User/resources/views/registration/register.php new file mode 100644 index 0000000..a5d774f --- /dev/null +++ b/lib/User/resources/views/registration/register.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; +use yii\widgets\ActiveForm; + +/** + * @var yii\web\View $this + * @var dektrium\user\models\User $user + * @var dektrium\user\Module $module + */ + +$this->title = Yii::t('user', 'Sign up'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+
+
+

title) ?>

+
+
+ 'registration-form', + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + ]); ?> + + field($model, 'email') ?> + + field($model, 'username') ?> + + enableGeneratingPassword == false): ?> + field($model, 'password')->passwordInput() ?> + + + 'btn btn-success btn-block']) ?> + + +
+
+

+ +

+
+
diff --git a/lib/User/resources/views/registration/resend.php b/lib/User/resources/views/registration/resend.php new file mode 100644 index 0000000..d370aa5 --- /dev/null +++ b/lib/User/resources/views/registration/resend.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; +use yii\widgets\ActiveForm; + +/* + * @var yii\web\View $this + * @var dektrium\user\models\ResendForm $model + */ + +$this->title = Yii::t('user', 'Request new confirmation message'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+
+
+
+

title) ?>

+
+
+ 'resend-form', + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + ]); ?> + + field($model, 'email')->textInput(['autofocus' => true]) ?> + + 'btn btn-primary btn-block']) ?>
+ + +
+
+
+
diff --git a/lib/User/resources/views/security/login.php b/lib/User/resources/views/security/login.php new file mode 100644 index 0000000..06f8280 --- /dev/null +++ b/lib/User/resources/views/security/login.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use dektrium\user\widgets\Connect; +use yii\helpers\Html; +use yii\widgets\ActiveForm; + +/** + * @var yii\web\View $this + * @var dektrium\user\models\LoginForm $model + * @var dektrium\user\Module $module + */ + +$this->title = Yii::t('user', 'Sign in'); +$this->params['breadcrumbs'][] = $this->title; +?> + +render('/_alert', ['module' => Yii::$app->getModule('user')]) ?> + +
+
+
+
+

title) ?>

+
+
+ 'login-form', + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + 'validateOnBlur' => false, + 'validateOnType' => false, + 'validateOnChange' => false, + ]) ?> + + field( + $model, + 'login', + ['inputOptions' => ['autofocus' => 'autofocus', 'class' => 'form-control', 'tabindex' => '1']] + ) ?> + + field( + $model, + 'password', + ['inputOptions' => ['class' => 'form-control', 'tabindex' => '2']] + ) + ->passwordInput() + ->label( + Yii::t('user', 'Password') + .($module->enablePasswordRecovery ? + ' (' . Html::a( + Yii::t('user', 'Forgot password?'), + ['/user/recovery/request'], + ['tabindex' => '5'] + ) + . ')' : '') + ) ?> + + field($model, 'rememberMe')->checkbox(['tabindex' => '4']) ?> + + 'btn btn-primary btn-block', 'tabindex' => '3'] + ) ?> + + +
+
+ enableConfirmation): ?> +

+ +

+ + enableRegistration): ?> +

+ +

+ + ['/user/security/auth'], + ]) ?> +
+
diff --git a/lib/User/resources/views/settings/_menu.php b/lib/User/resources/views/settings/_menu.php new file mode 100644 index 0000000..71554ee --- /dev/null +++ b/lib/User/resources/views/settings/_menu.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; +use yii\widgets\Menu; + +/** @var dektrium\user\models\User $user */ +$user = Yii::$app->user->identity; +$networksVisible = count(Yii::$app->authClientCollection->clients) > 0; + +?> + +
+
+

+ profile->getAvatarUrl(24), [ + 'class' => 'img-rounded', + 'alt' => $user->username, + ]) ?> + username ?> +

+
+
+ [ + 'class' => 'nav nav-pills nav-stacked', + ], + 'items' => [ + ['label' => Yii::t('user', 'Profile'), 'url' => ['/user/settings/profile']], + ['label' => Yii::t('user', 'Account'), 'url' => ['/user/settings/account']], + [ + 'label' => Yii::t('user', 'Networks'), + 'url' => ['/user/settings/networks'], + 'visible' => $networksVisible + ], + ], + ]) ?> +
+
diff --git a/lib/User/resources/views/settings/account.php b/lib/User/resources/views/settings/account.php new file mode 100644 index 0000000..ca1ee4c --- /dev/null +++ b/lib/User/resources/views/settings/account.php @@ -0,0 +1,88 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; +use yii\widgets\ActiveForm; + +/** + * @var $this yii\web\View + * @var $form yii\widgets\ActiveForm + * @var $model dektrium\user\models\SettingsForm + */ + +$this->title = Yii::t('user', 'Account settings'); +$this->params['breadcrumbs'][] = $this->title; +?> + +render('/_alert', ['module' => Yii::$app->getModule('user')]) ?> + +
+
+ render('_menu') ?> +
+
+
+
+

title) ?>

+
+
+ 'account-form', + 'options' => ['class' => 'form-horizontal'], + 'fieldConfig' => [ + 'template' => "{label}\n
{input}
\n
{error}\n{hint}
", + 'labelOptions' => ['class' => 'col-lg-3 control-label'], + ], + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + ]); ?> + + field($model, 'email') ?> + + field($model, 'username') ?> + + field($model, 'new_password')->passwordInput() ?> + +
+ + field($model, 'current_password')->passwordInput() ?> + +
+
+ 'btn btn-block btn-success']) ?>
+
+
+ + +
+
+ + module->enableAccountDelete): ?> +
+
+

+
+
+

+ . + . + . +

+ 'btn btn-danger', + 'data-method' => 'post', + 'data-confirm' => Yii::t('user', 'Are you sure? There is no going back'), + ]) ?> +
+
+ +
+
diff --git a/lib/User/resources/views/settings/networks.php b/lib/User/resources/views/settings/networks.php new file mode 100644 index 0000000..1ee1c7d --- /dev/null +++ b/lib/User/resources/views/settings/networks.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use dektrium\user\widgets\Connect; +use yii\helpers\Html; + +/* + * @var yii\web\View $this + * @var yii\widgets\ActiveForm $form + */ + +$this->title = Yii::t('user', 'Networks'); +$this->params['breadcrumbs'][] = $this->title; +?> + +render('/_alert', ['module' => Yii::$app->getModule('user')]) ?> + +
+
+ render('_menu') ?> +
+
+
+
+ title) ?> +
+
+
+

.

+
+ ['/user/security/auth'], + 'accounts' => $user->accounts, + 'autoRender' => false, + 'popupMode' => false, + ]) ?> + + getClients() as $client): ?> + + + + + + +
+ 'auth-icon ' . $client->getName()]) ?> + + getTitle() ?> + + isConnected($client) ? + Html::a(Yii::t('user', 'Disconnect'), $auth->createClientUrl($client), [ + 'class' => 'btn btn-danger btn-block', + 'data-method' => 'post', + ]) : + Html::a(Yii::t('user', 'Connect'), $auth->createClientUrl($client), [ + 'class' => 'btn btn-success btn-block', + ]) + ?> +
+ +
+
+
+
diff --git a/lib/User/resources/views/settings/profile.php b/lib/User/resources/views/settings/profile.php new file mode 100644 index 0000000..70b4618 --- /dev/null +++ b/lib/User/resources/views/settings/profile.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\helpers\Html; + +/** + * @var yii\web\View $this + * @var yii\widgets\ActiveForm $form + * @var dektrium\user\models\Profile $profile + */ + +$this->title = Yii::t('user', 'Profile settings'); +$this->params['breadcrumbs'][] = $this->title; +?> + +render('/_alert', ['module' => Yii::$app->getModule('user')]) ?> + +
+
+ render('_menu') ?> +
+
+
+
+ title) ?> +
+
+ 'profile-form', + 'options' => ['class' => 'form-horizontal'], + 'fieldConfig' => [ + 'template' => "{label}\n
{input}
\n
{error}\n{hint}
", + 'labelOptions' => ['class' => 'col-lg-3 control-label'], + ], + 'enableAjaxValidation' => true, + 'enableClientValidation' => false, + 'validateOnBlur' => false, + ]); ?> + + field($model, 'name') ?> + + field($model, 'public_email') ?> + + field($model, 'website') ?> + + field($model, 'location') ?> + + field($model, 'timezone') + ->dropDownList( + \yii\helpers\ArrayHelper::map( + \dektrium\user\helpers\Timezone::getAll(), + 'timezone', + 'name' + ) + ); ?> + + field($model, 'gravatar_email') + ->hint( + \yii\helpers\Html::a( + Yii::t('user', 'Change your avatar at Gravatar.com'), + 'http://gravatar.com' + ) + ) ?> + + field($model, 'bio')->textarea() ?> + +
+
+ 'btn btn-block btn-success'] + ) ?>
+
+
+ + +
+
+
+
diff --git a/lib/User/resources/views/shared/_alert.php b/lib/User/resources/views/shared/_alert.php new file mode 100644 index 0000000..e31ca24 --- /dev/null +++ b/lib/User/resources/views/shared/_alert.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +use yii\bootstrap\Alert; + +/** + * @var dektrium\user\Module $module + */ +?> + +enableFlashMessages): ?> +
+
+ session->getAllFlashes() as $type => $message): ?> + + ['class' => 'alert-dismissible alert-'.$type], + 'body' => $message + ]) ?> + + +
+
+ diff --git a/lib/User/resources/views/shared/message.php b/lib/User/resources/views/shared/message.php new file mode 100644 index 0000000..990ef2b --- /dev/null +++ b/lib/User/resources/views/shared/message.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE.md + * file that was distributed with this source code. + */ + +/** + * @var yii\web\View $this + * @var dektrium\user\Module $module + */ + +$this->title = $title; + +?> + +render('/_alert', [ + 'module' => $module, +]);