Fixes

parent 7c426cbc
...@@ -32,6 +32,7 @@ class LoginForm extends Model ...@@ -32,6 +32,7 @@ class LoginForm extends Model
['phone','safe'], ['phone','safe'],
// password is validated by validatePassword() // password is validated by validatePassword()
['password', 'validatePassword'], ['password', 'validatePassword'],
['username', 'validateStatus'],
]; ];
} }
...@@ -52,6 +53,23 @@ class LoginForm extends Model ...@@ -52,6 +53,23 @@ class LoginForm extends Model
} }
} }
/**
* Validates the status.
* This method serves as the inline validation for status.
*
* @param string $attribute the attribute currently being validated
* @param array $params the additional name-value pairs given in the rule
*/
public function validateStatus($attribute, $params)
{
if (!$this->hasErrors()) {
$user = $this->getUser();
if ($user->status != User::STATUS_ACTIVE) {
$this->addError($attribute, 'Пожалуйста, активируйте свой аккаунт.');
}
}
}
/** /**
* Logs in a user using the provided username and password. * Logs in a user using the provided username and password.
* *
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<div class="row"> <div class="row">
<div class="col-md-3 col-xs-3 col-sm-12"> <div class="col-md-3 col-xs-3 col-sm-12">
<div class="foot_logo"> <div class="foot_logo">
<img src="images/foot_logo.png" height="51" width="192" alt=""> <img src="/images/foot_logo.png" height="51" width="192" alt="">
</div> </div>
</div> </div>
<div class="col-md-6 col-xs-6 col-sm-12"> <div class="col-md-6 col-xs-6 col-sm-12">
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
</ul> </ul>
</div> </div>
<div class="col-md-3 col-xs-3 col-sm-12"> <div class="col-md-3 col-xs-3 col-sm-12">
<div class="taskon"><img src="images/taskon.png" height="31" width="100" alt=""></div> <div class="taskon"><img src="/images/taskon.png" height="31" width="100" alt=""></div>
<div class="copyring">Powered by Taskon <br> Собственная разработка Арт Проект</div> <div class="copyring">Powered by Taskon <br> Собственная разработка Арт Проект</div>
</div> </div>
</div> </div>
......
...@@ -247,7 +247,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter ...@@ -247,7 +247,7 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
*/ */
public static function findByUsername($username) public static function findByUsername($username)
{ {
return static::findOne(['email' => $username, 'status' => self::STATUS_ACTIVE]); return static::findOne(['email' => $username/*, 'status' => self::STATUS_ACTIVE*/]);
} }
/** /**
......
...@@ -11473,7 +11473,7 @@ h6 { ...@@ -11473,7 +11473,7 @@ h6 {
color: #698387; color: #698387;
font-size: 14px; font-size: 14px;
} }
a.submit_form_reg, a.submit_form_reg_popup{ a.submit_form_reg, a.submit_form_reg_popup, a.submit_form_login, a.submit_form_login_popup{
text-decoration: none; text-decoration: none;
} }
.errors-reg, .errors-reg_popup, .errors_login, .errors_login_popup{ .errors-reg, .errors-reg_popup, .errors_login, .errors_login_popup{
......
...@@ -621,27 +621,24 @@ $(document).ready(function() { ...@@ -621,27 +621,24 @@ $(document).ready(function() {
// bind to the form's submit event // bind to the form's submit event
$('#login_form_popup').submit(function() { $('#login_form_popup').submit(function() {
$('.errors_login_popup').append('');
$(this).ajaxSubmit(optionsLoginPopup); $(this).ajaxSubmit(optionsLoginPopup);
return false; return false;
}); });
// bind to the form's submit event // bind to the form's submit event
$('#login_form').submit(function() { $('#login_form').submit(function() {
$('.errors_login').append(''); $('.errors_login').html('');
$(this).ajaxSubmit(optionsLogin); $(this).ajaxSubmit(optionsLogin);
return false; return false;
}); });
// bind to the form's submit event // bind to the form's submit event
$('#sh_reg_form').submit(function() { $('#sh_reg_form').submit(function() {
$('.errors-reg').append('');
$(this).ajaxSubmit(options); $(this).ajaxSubmit(options);
return false; return false;
}); });
// bind to the form's submit event // bind to the form's submit event
$('#reg_form_popup').submit(function() { $('#reg_form_popup').submit(function() {
$('.errors-reg_popup').append('');
$(this).ajaxSubmit(optionsPopup); $(this).ajaxSubmit(optionsPopup);
return false; return false;
}); });
...@@ -696,6 +693,7 @@ function showRequest(formData, jqForm, options) { ...@@ -696,6 +693,7 @@ function showRequest(formData, jqForm, options) {
// post-submit callback // post-submit callback
function showResponse(responseText, statusText, xhr, $form) { function showResponse(responseText, statusText, xhr, $form) {
$('.errors-reg').html('');
if (responseText.errors){ if (responseText.errors){
$.each(responseText.errors, function(key,value) { $.each(responseText.errors, function(key,value) {
$('.errors-reg').append(value+'<br>'); $('.errors-reg').append(value+'<br>');
...@@ -708,6 +706,7 @@ function showResponse(responseText, statusText, xhr, $form) { ...@@ -708,6 +706,7 @@ function showResponse(responseText, statusText, xhr, $form) {
} }
// post-submit callback // post-submit callback
function showResponsePopup(responseText, statusText, xhr, $form) { function showResponsePopup(responseText, statusText, xhr, $form) {
$('.errors-reg_popup').html('');
if (responseText.errors){ if (responseText.errors){
$.each(responseText.errors, function(key,value) { $.each(responseText.errors, function(key,value) {
$('.errors-reg_popup').append(value+'<br>'); $('.errors-reg_popup').append(value+'<br>');
...@@ -721,6 +720,7 @@ function showResponsePopup(responseText, statusText, xhr, $form) { ...@@ -721,6 +720,7 @@ function showResponsePopup(responseText, statusText, xhr, $form) {
} }
// post-submit callback // post-submit callback
function showResponseLogin(responseText, statusText, xhr, $form) { function showResponseLogin(responseText, statusText, xhr, $form) {
$('.errors_login').html('');
if (responseText.errors){ if (responseText.errors){
$.each(responseText.errors, function(key,value) { $.each(responseText.errors, function(key,value) {
$('.errors_login').append(value+'<br>'); $('.errors_login').append(value+'<br>');
...@@ -731,6 +731,7 @@ function showResponseLogin(responseText, statusText, xhr, $form) { ...@@ -731,6 +731,7 @@ function showResponseLogin(responseText, statusText, xhr, $form) {
// post-submit callback // post-submit callback
function showResponseLoginPopup(responseText, statusText, xhr, $form) { function showResponseLoginPopup(responseText, statusText, xhr, $form) {
$('.errors_login_popup').html('');
if (responseText.errors){ if (responseText.errors){
$.each(responseText.errors, function(key,value) { $.each(responseText.errors, function(key,value) {
$('.errors_login_popup').append(value+'<br>'); $('.errors_login_popup').append(value+'<br>');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment