login.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. $this->params['body-class']['class'] = 'login-page';
  22. ?>
  23. <div class="login-box">
  24. <div class="login-logo">
  25. <?= Html::encode($this->title) ?>
  26. </div>
  27. <!-- /.login-logo -->
  28. <div class="card">
  29. <div class="card-body login-card-body">
  30. <?= $this->render('/_alert', ['module' => Yii::$app->getModule('user')]) ?>
  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. <?php if ($module->debug): ?>
  40. <?= $form->field($model, 'login', [
  41. 'inputOptions' => [
  42. 'autofocus' => 'autofocus',
  43. 'class' => 'form-control',
  44. 'tabindex' => '1']])->dropDownList(LoginForm::loginList());
  45. ?>
  46. <?php else: ?>
  47. <?= $form->field($model, 'uuid', ['inputOptions' => ['autofocus' => 'autofocus', 'class' => 'form-control', 'tabindex' => '1']]); ?>
  48. <?php endif ?>
  49. <?php if ($module->debug): ?>
  50. <div class="alert alert-warning">
  51. <?= Yii::t('user', 'Password is not necessary because the module is in DEBUG mode.'); ?>
  52. </div>
  53. <?php else: ?>
  54. <?= $form->field(
  55. $model,
  56. 'password',
  57. ['inputOptions' => ['class' => 'form-control', 'tabindex' => '2']])
  58. ->passwordInput()
  59. ->label(
  60. Yii::t('user', 'Password')
  61. . ($module->enablePasswordRecovery ?
  62. ' (' . Html::a(
  63. Yii::t('user', 'Forgot password?'),
  64. ['/user/recovery/request'],
  65. ['tabindex' => '5']
  66. )
  67. . ')' : '')
  68. ) ?>
  69. <?php endif ?>
  70. <?= $form->field($model, 'rememberMe')->checkbox(['tabindex' => '3']) ?>
  71. <?= Html::submitButton(
  72. Yii::t('user', 'Sign in'),
  73. ['class' => 'btn btn-primary btn-block', 'tabindex' => '4']
  74. ) ?>
  75. <?php ActiveForm::end(); ?>
  76. <?php if ($module->enableConfirmation): ?>
  77. <p class="text-center">
  78. <?= Html::a(Yii::t('user', 'Didn\'t receive confirmation message?'), ['/user/registration/resend']) ?>
  79. </p>
  80. <?php endif ?>
  81. <?php if ($module->enableRegistration): ?>
  82. <p class="text-center">
  83. <?= Html::a(Yii::t('user', 'Don\'t have an account? Sign up!'), ['/user/registration/register']) ?>
  84. </p>
  85. <?php endif ?>
  86. <?= Connect::widget([
  87. 'baseAuthUrl' => ['/user/security/auth'],
  88. ]) ?>
  89. </div>
  90. <!-- /.login-card-body -->
  91. </div>
  92. </div>