PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/user/views/user/login.php

https://github.com/yii-simon/yii-user-management
PHP | 107 lines | 89 code | 18 blank | 0 comment | 15 complexity | 688bef681c71db25de0ebfa7ece5feb9 MD5 | raw file
  1. <?
  2. if(!isset($model))
  3. $model = new YumUserLogin();
  4. $module = Yum::module();
  5. $this->pageTitle = Yum::t('Login');
  6. if(isset($this->title))
  7. $this->title = Yum::t('Login');
  8. $this->breadcrumbs=array(Yum::t('Login'));
  9. Yum::renderFlash();
  10. ?>
  11. <div class="form">
  12. <p>
  13. <?
  14. echo Yum::t(
  15. 'Please fill out the following form with your login credentials:'); ?>
  16. </p>
  17. <? echo CHtml::beginForm(array('//user/auth/login')); ?>
  18. <?
  19. if(isset($_GET['action']))
  20. echo CHtml::hiddenField('returnUrl', urldecode($_GET['action']));
  21. ?>
  22. <? echo CHtml::errorSummary($model); ?>
  23. <div class="row">
  24. <?
  25. if($module->loginType & UserModule::LOGIN_BY_USERNAME
  26. || $module->loginType & UserModule::LOGIN_BY_LDAP)
  27. echo CHtml::activeLabelEx($model,'username');
  28. if($module->loginType & UserModule::LOGIN_BY_EMAIL)
  29. printf ('<label for="YumUserLogin_username">%s <span class="required">*</span></label>', Yum::t('E-Mail address'));
  30. if($module->loginType & UserModule::LOGIN_BY_OPENID)
  31. printf ('<label for="YumUserLogin_username">%s <span class="required">*</span></label>', Yum::t('OpenID username')); ?>
  32. <? echo CHtml::activeTextField($model,'username') ?>
  33. </div>
  34. <div class="row">
  35. <? echo CHtml::activeLabelEx($model,'password'); ?>
  36. <? echo CHtml::activePasswordField($model,'password');
  37. if($module->loginType & UserModule::LOGIN_BY_OPENID)
  38. echo '<br />'. Yum::t('When logging in with OpenID, password can be omitted');
  39. ?>
  40. </div>
  41. <div class="row">
  42. <p class="hint">
  43. <?
  44. if(Yum::hasModule('registration') && Yum::module('registration')->enableRegistration)
  45. echo CHtml::link(Yum::t("Registration"),
  46. Yum::module('registration')->registrationUrl);
  47. if(Yum::hasModule('registration')
  48. && Yum::module('registration')->enableRegistration
  49. && Yum::module('registration')->enableRecovery)
  50. echo ' | ';
  51. if(Yum::hasModule('registration')
  52. && Yum::module('registration')->enableRecovery)
  53. echo CHtml::link(Yum::t("Lost password?"),
  54. Yum::module('registration')->recoveryUrl);
  55. ?>
  56. </p>
  57. </div>
  58. <div class="row rememberMe">
  59. <? echo CHtml::activeCheckBox($model,'rememberMe', array('style' => 'display: inline;')); ?>
  60. <? echo CHtml::activeLabelEx($model,'rememberMe', array('style' => 'display: inline;')); ?>
  61. </div>
  62. <div class="row submit">
  63. <? echo CHtml::submitButton(Yum::t('Login')); ?>
  64. </div>
  65. <? echo CHtml::endForm(); ?>
  66. </div><!-- form -->
  67. <?
  68. $form = new CForm(array(
  69. 'elements'=>array(
  70. 'username'=>array(
  71. 'type'=>'text',
  72. 'maxlength'=>32,
  73. ),
  74. 'password'=>array(
  75. 'type'=>'password',
  76. 'maxlength'=>32,
  77. ),
  78. 'rememberMe'=>array(
  79. 'type'=>'checkbox',
  80. )
  81. ),
  82. 'buttons'=>array(
  83. 'login'=>array(
  84. 'type'=>'submit',
  85. 'label'=>'Login',
  86. ),
  87. ),
  88. ), $model);
  89. ?>