login.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 dektrium\user\models\LoginForm;
  12. use yii\helpers\Html;
  13. use yii\widgets\ActiveForm;
  14. /**
  15. * @var yii\web\View $this
  16. * @var dektrium\user\models\LoginForm $model
  17. * @var dektrium\user\Module $module
  18. */
  19. $this->title = Yii::t('user', 'Sign in');
  20. $this->params['breadcrumbs'][] = $this->title;
  21. ?>
  22. <?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
  23. <div class="row">
  24. <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
  25. <div class="panel panel-default">
  26. <div class="panel-heading">
  27. <h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
  28. </div>
  29. <div class="panel-body">
  30. <?php $form = ActiveForm::begin([
  31. 'id' => 'login-form',
  32. 'enableAjaxValidation' => true,
  33. 'enableClientValidation' => false,
  34. 'validateOnBlur' => false,
  35. 'validateOnType' => false,
  36. 'validateOnChange' => false,
  37. ]) ?>
  38. <?php if ($module->debug): ?>
  39. <?= $form->field($model, 'login', [
  40. 'inputOptions' => [
  41. 'autofocus' => 'autofocus',
  42. 'class' => 'form-control',
  43. 'tabindex' => '1']])->dropDownList(LoginForm::loginList());
  44. ?>
  45. <?php else: ?>
  46. <?= $form->field($model, 'login',
  47. ['inputOptions' => ['autofocus' => 'autofocus', 'class' => 'form-control', 'tabindex' => '1']]
  48. );
  49. ?>
  50. <?php endif ?>
  51. <?php if ($module->debug): ?>
  52. <div class="alert alert-warning">
  53. <?= Yii::t('user', 'Password is not necessary because the module is in DEBUG mode.'); ?>
  54. </div>
  55. <?php else: ?>
  56. <?= $form->field(
  57. $model,
  58. 'password',
  59. ['inputOptions' => ['class' => 'form-control', 'tabindex' => '2']])
  60. ->passwordInput()
  61. ->label(
  62. Yii::t('user', 'Password')
  63. . ($module->enablePasswordRecovery ?
  64. ' (' . Html::a(
  65. Yii::t('user', 'Forgot password?'),
  66. ['/user/recovery/request'],
  67. ['tabindex' => '5']
  68. )
  69. . ')' : '')
  70. ) ?>
  71. <?php endif ?>
  72. <?= $form->field($model, 'rememberMe')->checkbox(['tabindex' => '3']) ?>
  73. <?= Html::submitButton(
  74. Yii::t('user', 'Sign in'),
  75. ['class' => 'btn btn-primary btn-block', 'tabindex' => '4']
  76. ) ?>
  77. <?php ActiveForm::end(); ?>
  78. </div>
  79. </div>
  80. <?php if ($module->enableConfirmation): ?>
  81. <p class="text-center">
  82. <?= Html::a(Yii::t('user', 'Didn\'t receive confirmation message?'), ['/user/registration/resend']) ?>
  83. </p>
  84. <?php endif ?>
  85. <?php if ($module->enableRegistration): ?>
  86. <p class="text-center">
  87. <?= Html::a(Yii::t('user', 'Don\'t have an account? Sign up!'), ['/user/registration/register']) ?>
  88. </p>
  89. <?php endif ?>
  90. <?= Connect::widget([
  91. 'baseAuthUrl' => ['/user/security/auth'],
  92. ]) ?>
  93. </div>
  94. </div>