login.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. $module = Yii::$app->getModule('user');
  21. ?>
  22. <div class="container">
  23. <?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
  24. <div class="row justify-content-center">
  25. <div class="col-md-8 col-lg-4">
  26. <div class="login-container">
  27. <div class="panel panel-default">
  28. <div class="panel-heading">
  29. <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
  30. </div>
  31. <div class="panel-body">
  32. <?php $form = ActiveForm::begin([
  33. 'id' => 'login-form',
  34. 'enableAjaxValidation' => true,
  35. 'enableClientValidation' => false,
  36. 'validateOnBlur' => false,
  37. 'validateOnType' => false,
  38. 'validateOnChange' => false,
  39. ]) ?>
  40. <?= $form->field($model, 'login', ['inputOptions' => ['autofocus' => 'autofocus', 'class' => 'form-control', 'tabindex' => '1']]) ?>
  41. <?= $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']) . ')' : '')) ?>
  42. <?= $form->field($model, 'rememberMe')->checkbox(['tabindex' => '4']) ?>
  43. <?= Html::submitButton(Yii::t('user', 'Sign in'), ['class' => 'btn btn-primary btn-block', 'tabindex' => '3']) ?>
  44. <?php ActiveForm::end(); ?>
  45. </div>
  46. </div>
  47. <?php if ($module->enableConfirmation): ?>
  48. <p class="text-center">
  49. <?= Html::a(Yii::t('user', 'Didn\'t receive confirmation message?'), ['/registration/resend']) ?>
  50. </p>
  51. <?php endif ?>
  52. <?php if ($module->enableRegistration): ?>
  53. <p class="text-center">
  54. <?= Html::a(Yii::t('user', 'Don\'t have an account? Sign up!'), ['/registration/register']) ?>
  55. </p>
  56. <?php endif ?>
  57. <?= Connect::widget([
  58. 'baseAuthUrl' => ['/user/security/auth'],
  59. ]) ?>
  60. </div>
  61. </div>
  62. </div>
  63. </div>