login.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /*
  3. * This file is part of the Dektrium project.
  4. *
  5. * (c) Dektrium project <http://github.com/dektrium>
  6. *
  7. * For the full copyright and license information, please view the LICENSE.md
  8. * file that was distributed with this source code.
  9. */
  10. use dektrium\user\widgets\Connect;
  11. use yii\helpers\Html;
  12. use yii\widgets\ActiveForm;
  13. /**
  14. * @var yii\web\View $this
  15. * @var dektrium\user\models\LoginForm $model
  16. * @var dektrium\user\Module $module
  17. */
  18. $this->title = Yii::t('user', 'Sign in');
  19. $this->params['breadcrumbs'][] = $this->title;
  20. ?>
  21. <div class="container">
  22. <?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
  23. <div class="row justify-content-center">
  24. <div class="col-md-8 col-lg-4">
  25. <div class="login-container">
  26. <div class="panel panel-default">
  27. <div class="panel-heading">
  28. <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
  29. </div>
  30. <div class="panel-body">
  31. <?php $form = ActiveForm::begin([
  32. 'id' => 'login-form',
  33. 'enableAjaxValidation' => true,
  34. 'enableClientValidation' => false,
  35. 'validateOnBlur' => false,
  36. 'validateOnType' => false,
  37. 'validateOnChange' => false,
  38. ]) ?>
  39. <?= $form->field($model, 'login', ['inputOptions' => ['autofocus' => 'autofocus', 'class' => 'form-control', 'tabindex' => '1']]) ?>
  40. <?= $form->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'], ['class' => 'link-secondary'], ['tabindex' => '5']) . ')' : '')) ?>
  41. <?= $form->field($model, 'rememberMe')->checkbox(['tabindex' => '4']) ?>
  42. <?= Html::submitButton(Yii::t('user', 'Sign in'), ['class' => 'btn btn-primary btn-block', 'tabindex' => '3']) ?>
  43. <?php ActiveForm::end(); ?>
  44. </div>
  45. </div>
  46. <?php if ($module->enableConfirmation): ?>
  47. <p class="text-center">
  48. <?= Html::a(Yii::t('user', 'Didn\'t receive confirmation message?'), ['/registration/resend']) ?>
  49. </p>
  50. <?php endif ?>
  51. <?php if ($module->enableRegistration): ?>
  52. <p class="text-center">
  53. <?= Html::a(Yii::t('user', 'Don\'t have an account? Sign up!'), ['/registration/register']) ?>
  54. </p>
  55. <?php endif ?>
  56. <?= Connect::widget([
  57. 'baseAuthUrl' => ['/user/security/auth'],
  58. ]) ?>
  59. </div>
  60. </div>
  61. </div>
  62. </div>