documentation update + code fixes

This commit is contained in:
Antonio Ramirez
2017-06-11 23:25:51 +02:00
parent 4dedf111a1
commit 7344ad31df
91 changed files with 1699 additions and 827 deletions

View File

@ -28,9 +28,9 @@ class Yandex extends BaseYandex implements AuthClientInterface
if ($emails !== null && isset($emails[0])) {
return $emails[0];
} else {
return null;
}
return null;
}
/**

View File

@ -59,7 +59,7 @@ class Bootstrap implements BootstrapInterface
* Initialize container with module classes.
*
* @param \yii\base\Application $app
* @param array $map the previously built class map list
* @param array $map the previously built class map list
*/
protected function initContainer($app, $map)
{
@ -165,7 +165,7 @@ class Bootstrap implements BootstrapInterface
if (!isset($app->get('i18n')->translations['usuario*'])) {
$app->get('i18n')->translations['usuario*'] = [
'class' => PhpMessageSource::class,
'basePath' => __DIR__.'/resources/i18n',
'basePath' => __DIR__ . '/resources/i18n',
'sourceLanguage' => 'en-US',
];
}
@ -214,7 +214,7 @@ class Bootstrap implements BootstrapInterface
/**
* Ensures required mail parameters needed for the mail service.
*
* @param Application $app
* @param Application $app
* @param Module|\yii\base\Module $module
*/
protected function initMailServiceConfiguration(Application $app, Module $module)
@ -331,7 +331,7 @@ class Bootstrap implements BootstrapInterface
/**
* Returns the parent class name route of a short class name.
*
* @param array $routes class name routes
* @param array $routes class name routes
* @param string $name
*
* @return int|string

View File

@ -36,12 +36,12 @@ class ConfirmController extends Controller
{
$user = $this->userQuery->whereUsernameOrEmail($usernameOrEmail)->one();
if ($user === null) {
$this->stdout(Yii::t('usuario', 'User is not found')."\n", Console::FG_RED);
$this->stdout(Yii::t('usuario', 'User is not found') . "\n", Console::FG_RED);
} else {
if ($this->make(UserConfirmationService::class, [$user])->run()) {
$this->stdout(Yii::t('usuario', 'User has been confirmed')."\n", Console::FG_GREEN);
$this->stdout(Yii::t('usuario', 'User has been confirmed') . "\n", Console::FG_GREEN);
} else {
$this->stdout(Yii::t('usuario', 'Error occurred while confirming user')."\n", Console::FG_RED);
$this->stdout(Yii::t('usuario', 'Error occurred while confirming user') . "\n", Console::FG_RED);
}
}
}

View File

@ -32,12 +32,12 @@ class CreateController extends Controller
$mailService = MailFactory::makeWelcomeMailerService($user);
if ($this->make(UserCreateService::class, [$user, $mailService])->run()) {
$this->stdout(Yii::t('usuario', 'User has been created')."!\n", Console::FG_GREEN);
$this->stdout(Yii::t('usuario', 'User has been created') . "!\n", Console::FG_GREEN);
} else {
$this->stdout(Yii::t('usuario', 'Please fix following errors:')."\n", Console::FG_RED);
$this->stdout(Yii::t('usuario', 'Please fix following errors:') . "\n", Console::FG_RED);
foreach ($user->errors as $errors) {
foreach ($errors as $error) {
$this->stdout(' - '.$error."\n", Console::FG_RED);
$this->stdout(' - ' . $error . "\n", Console::FG_RED);
}
}
}

View File

@ -32,12 +32,12 @@ class DeleteController extends Controller
if ($this->confirm(Yii::t('usuario', 'Are you sure? Deleted user can not be restored'))) {
$user = $this->userQuery->whereUsernameOrEmail($usernameOrEmail)->one();
if ($user === null) {
$this->stdout(Yii::t('usuario', 'User is not found')."\n", Console::FG_RED);
$this->stdout(Yii::t('usuario', 'User is not found') . "\n", Console::FG_RED);
} else {
if ($user->delete()) {
$this->stdout(Yii::t('usuario', 'User has been deleted')."\n", Console::FG_GREEN);
$this->stdout(Yii::t('usuario', 'User has been deleted') . "\n", Console::FG_GREEN);
} else {
$this->stdout(Yii::t('usuario', 'Error occurred while deleting user')."\n", Console::FG_RED);
$this->stdout(Yii::t('usuario', 'Error occurred while deleting user') . "\n", Console::FG_RED);
}
}
}

View File

@ -38,12 +38,12 @@ class PasswordController extends Controller
$user = $this->userQuery->whereUsernameOrEmail($usernameOrEmail)->one();
if ($user === null) {
$this->stdout(Yii::t('usuario', 'User is not found')."\n", Console::FG_RED);
$this->stdout(Yii::t('usuario', 'User is not found') . "\n", Console::FG_RED);
} else {
if ($this->make(ResetPasswordService::class, [$password, $user])->run()) {
$this->stdout(Yii::t('usuario', 'Password has been changed')."\n", Console::FG_GREEN);
$this->stdout(Yii::t('usuario', 'Password has been changed') . "\n", Console::FG_GREEN);
} else {
$this->stdout(Yii::t('usuario', 'Error occurred while changing password')."\n", Console::FG_RED);
$this->stdout(Yii::t('usuario', 'Error occurred while changing password') . "\n", Console::FG_RED);
}
}
}

View File

@ -18,8 +18,8 @@ use yii\rbac\DbManager;
class AuthDbManagerComponent extends DbManager implements AuthManagerInterface
{
/**
* @param int|null $type If null will return all auth items
* @param array $excludeItems Items that should be excluded from result array
* @param int|null $type If null will return all auth items
* @param array $excludeItems Items that should be excluded from result array
*
* @return array
*/
@ -63,7 +63,7 @@ class AuthDbManagerComponent extends DbManager implements AuthManagerInterface
->select('b.*')
->from(['a' => $this->assignmentTable, 'b' => $this->itemTable])
->where('{{a}}.[[item_name]]={{b}}.[[name]]')
->andWhere(['a.user_id' => (string) $userId]);
->andWhere(['a.user_id' => (string)$userId]);
$roles = [];
foreach ($query->all($this->db) as $row) {

View File

@ -17,7 +17,7 @@ interface AuthManagerInterface extends ManagerInterface
{
/**
* @param int|null $type
* @param array $excludeItems
* @param array $excludeItems
*
* @return mixed
*/

View File

@ -33,10 +33,10 @@ abstract class AbstractAuthItemController extends Controller
/**
* AbstractAuthItemController constructor.
*
* @param string $id
* @param Module $module
* @param string $id
* @param Module $module
* @param AuthHelper $authHelper
* @param array $config
* @param array $config
*/
public function __construct($id, Module $module, AuthHelper $authHelper, array $config = [])
{
@ -92,9 +92,8 @@ abstract class AbstractAuthItemController extends Controller
->setFlash('success', Yii::t('usuario', 'Authorization item successfully created.'));
return $this->redirect(['index']);
} else {
Yii::$app->getSession()->setFlash('danger', Yii::t('usuario', 'Unable to create authorization item.'));
}
Yii::$app->getSession()->setFlash('danger', Yii::t('usuario', 'Unable to create authorization item.'));
}
return $this->render(
@ -122,9 +121,8 @@ abstract class AbstractAuthItemController extends Controller
->setFlash('success', Yii::t('usuario', 'Authorization item successfully updated.'));
return $this->redirect(['index']);
} else {
Yii::$app->getSession()->setFlash('danger', Yii::t('usuario', 'Unable to update authorization item.'));
}
Yii::$app->getSession()->setFlash('danger', Yii::t('usuario', 'Unable to update authorization item.'));
}
return $this->render(

View File

@ -43,10 +43,10 @@ class AdminController extends Controller
/**
* AdminController constructor.
*
* @param string $id
* @param Module $module
* @param string $id
* @param Module $module
* @param UserQuery $userQuery
* @param array $config
* @param array $config
*/
public function __construct($id, Module $module, UserQuery $userQuery, array $config = [])
{
@ -233,7 +233,10 @@ class AdminController extends Controller
Yii::$app->getSession()->setFlash('success', Yii::t('usuario', 'User has been confirmed'));
$this->trigger(UserEvent::EVENT_AFTER_CONFIRMATION, $event);
} else {
Yii::$app->getSession()->setFlash('warning', Yii::t('usuario', 'Unable to confirm user. Please, try again.'));
Yii::$app->getSession()->setFlash(
'warning',
Yii::t('usuario', 'Unable to confirm user. Please, try again.')
);
}
return $this->redirect(Url::previous('actions-redirect'));

View File

@ -12,10 +12,10 @@
namespace Da\User\Controller;
use Da\User\Query\ProfileQuery;
use Yii;
use yii\base\Module;
use yii\filters\AccessControl;
use yii\web\Controller;
use Yii;
use yii\web\NotFoundHttpException;
class ProfileController extends Controller
@ -25,10 +25,10 @@ class ProfileController extends Controller
/**
* ProfileController constructor.
*
* @param string $id
* @param Module $module
* @param string $id
* @param Module $module
* @param ProfileQuery $profileQuery
* @param array $config
* @param array $config
*/
public function __construct($id, Module $module, ProfileQuery $profileQuery, array $config = [])
{

View File

@ -16,6 +16,7 @@ use Da\User\Event\ResetPasswordEvent;
use Da\User\Factory\MailFactory;
use Da\User\Form\RecoveryForm;
use Da\User\Model\Token;
use Da\User\Module;
use Da\User\Query\TokenQuery;
use Da\User\Query\UserQuery;
use Da\User\Service\PasswordRecoveryService;
@ -23,7 +24,6 @@ use Da\User\Service\ResetPasswordService;
use Da\User\Traits\ContainerAwareTrait;
use Da\User\Validator\AjaxRequestModelValidator;
use Yii;
use Da\User\Module;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
@ -38,11 +38,11 @@ class RecoveryController extends Controller
/**
* RecoveryController constructor.
*
* @param string $id
* @param Module $module
* @param UserQuery $userQuery
* @param string $id
* @param Module $module
* @param UserQuery $userQuery
* @param TokenQuery $tokenQuery
* @param array $config
* @param array $config
*/
public function __construct($id, Module $module, UserQuery $userQuery, TokenQuery $tokenQuery, array $config = [])
{

View File

@ -44,11 +44,11 @@ class RegistrationController extends Controller
/**
* RegistrationController constructor.
*
* @param string $id
* @param Module $module
* @param UserQuery $userQuery
* @param string $id
* @param Module $module
* @param UserQuery $userQuery
* @param SocialNetworkAccountQuery $socialNetworkAccountQuery
* @param array $config
* @param array $config
*/
public function __construct(
$id,
@ -232,7 +232,7 @@ class RegistrationController extends Controller
'info',
Yii::t(
'usuario',
'A message has been sent to your email address. '.
'A message has been sent to your email address. ' .
'It contains a confirmation link that you must click to complete registration.'
)
);
@ -243,18 +243,21 @@ class RegistrationController extends Controller
'danger',
Yii::t(
'usuario',
'We couldn\'t re-send the mail to confirm your address. '.
'We couldn\'t re-send the mail to confirm your address. ' .
'Please, verify is the correct email or if it has been confirmed already.'
)
);
}
return $this->render('/shared/message', [
'title' => $success
? Yii::t('usuario', 'A new confirmation link has been sent')
: Yii::t('usuario', 'Unable to send confirmation link'),
'module' => $this->module,
]);
return $this->render(
'/shared/message',
[
'title' => $success
? Yii::t('usuario', 'A new confirmation link has been sent')
: Yii::t('usuario', 'Unable to send confirmation link'),
'module' => $this->module,
]
);
}
return $this->render(

View File

@ -37,10 +37,10 @@ class SecurityController extends Controller
/**
* SecurityController constructor.
*
* @param string $id
* @param Module $module
* @param string $id
* @param Module $module
* @param SocialNetworkAccountQuery $socialNetworkAccountQuery
* @param array $config
* @param array $config
*/
public function __construct(
$id,
@ -116,6 +116,7 @@ class SecurityController extends Controller
if (Yii::$app->request->isAjax && $form->load(Yii::$app->request->post())) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($form);
}

View File

@ -27,10 +27,10 @@ use Da\User\Query\UserQuery;
use Da\User\Service\EmailChangeService;
use Da\User\Traits\ContainerAwareTrait;
use Da\User\Validator\AjaxRequestModelValidator;
use Yii;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\web\Controller;
use Yii;
use yii\web\ForbiddenHttpException;
use yii\web\NotFoundHttpException;
@ -38,24 +38,24 @@ class SettingsController extends Controller
{
use ContainerAwareTrait;
protected $profileQuery;
protected $userQuery;
protected $socialNetworkAccountQuery;
/**
* {@inheritdoc}
*/
public $defaultAction = 'profile';
protected $profileQuery;
protected $userQuery;
protected $socialNetworkAccountQuery;
/**
* SettingsController constructor.
*
* @param string $id
* @param Module $module
* @param ProfileQuery $profileQuery
* @param UserQuery $userQuery
* @param string $id
* @param Module $module
* @param ProfileQuery $profileQuery
* @param UserQuery $userQuery
* @param SocialNetworkAccountQuery $socialNetworkAccountQuery
* @param array $config
* @param array $config
*/
public function __construct(
$id,
@ -145,7 +145,10 @@ class SettingsController extends Controller
$this->trigger(UserEvent::EVENT_BEFORE_ACCOUNT_UPDATE, $event);
if ($form->save()) {
Yii::$app->getSession()->setFlash('success', Yii::t('usuario', 'Your account details have been updated'));
Yii::$app->getSession()->setFlash(
'success',
Yii::t('usuario', 'Your account details have been updated')
);
$this->trigger(UserEvent::EVENT_AFTER_ACCOUNT_UPDATE, $event);
return $this->refresh();

View File

@ -11,9 +11,9 @@
namespace Da\User\Factory;
use Exception;
use Yii;
use yii\rbac\Item;
use Exception;
class AuthItemFactory
{

View File

@ -16,8 +16,8 @@ use Da\User\Form\SettingsForm;
use Da\User\Strategy\DefaultEmailChangeStrategy;
use Da\User\Strategy\InsecureEmailChangeStrategy;
use Da\User\Strategy\SecureEmailChangeStrategy;
use Yii;
use Exception;
use Yii;
class EmailChangeStrategyFactory
{

View File

@ -43,7 +43,7 @@ class MailFactory
/**
* @param string $email
* @param Token $token
* @param Token $token
*
* @return MailService
*/
@ -63,7 +63,7 @@ class MailFactory
}
/**
* @param User $user
* @param User $user
* @param Token|null $token
*
* @return MailService
@ -84,7 +84,7 @@ class MailFactory
}
/**
* @param User $user
* @param User $user
* @param Token $token
*
* @return MailService
@ -114,7 +114,7 @@ class MailFactory
* @param string $to
* @param string $subject
* @param string $view
* @param array $params
* @param array $params
*
* @return MailService
*/

View File

@ -35,7 +35,6 @@ class AccessRuleFilter extends AccessRule
return true;
}
} elseif ($role === 'admin') {
/** @var User $identity */
$identity = $user->getIdentity();

View File

@ -48,9 +48,9 @@ class LoginForm extends Model
protected $securityHelper;
/**
* @param UserQuery $query
* @param UserQuery $query
* @param SecurityHelper $securityHelper
* @param array $config
* @param array $config
*/
public function __construct(UserQuery $query, SecurityHelper $securityHelper, $config = [])
{
@ -119,9 +119,9 @@ class LoginForm extends Model
$duration = $this->rememberMe ? $this->module->rememberLoginLifespan : 0;
return Yii::$app->getUser()->login($this->user, $duration);
} else {
return false;
}
return false;
}
/**

View File

@ -38,7 +38,7 @@ class RecoveryForm extends Model
/**
* @param UserQuery $query
* @param array $config
* @param array $config
*/
public function __construct(UserQuery $query, array $config = [])
{

View File

@ -28,7 +28,7 @@ class ResendForm extends Model
/**
* @param UserQuery $userQuery
* @param array $config
* @param array $config
*/
public function __construct(UserQuery $userQuery, $config = [])
{

View File

@ -54,6 +54,6 @@ class ClassMapHelper
if (array_key_exists($key, $this->map)) {
return $this->map[$key];
}
throw new \Exception('Unknown model map key: '.$key);
throw new \Exception('Unknown model map key: ' . $key);
}
}

View File

@ -20,6 +20,6 @@ class GravatarHelper
public function getUrl($id, $size = 200)
{
return '//gravatar.com/avatar/'.$id.'?s='.$size;
return '//gravatar.com/avatar/' . $id . '?s=' . $size;
}
}

View File

@ -28,7 +28,7 @@ class SecurityHelper
/**
* Generates a secure hash from a password and a random salt.
*
* @param string $password
* @param string $password
* @param null|int $cost
*
* @return string

View File

@ -11,9 +11,9 @@
namespace Da\User\Helper;
use DateTime;
use DateTimeZone;
use yii\helpers\ArrayHelper;
use DateTime;
class TimezoneHelper
{
@ -32,7 +32,7 @@ class TimezoneHelper
$offset = $date->getOffset() / 60 / 60;
$timeZones[] = [
'timezone' => $timeZone,
'name' => "{$timeZone} (UTC ".($offset > 0 ? '+' : '')."{$offset})",
'name' => "{$timeZone} (UTC " . ($offset > 0 ? '+' : '') . "{$offset})",
'offset' => $offset,
];
}

View File

@ -17,20 +17,23 @@ class m000000_000001_create_user_table extends Migration
{
public function up()
{
$this->createTable('{{%user}}', [
'id' => $this->primaryKey(),
'username' => $this->string(255)->notNull(),
'email' => $this->string(255)->notNull(),
'password_hash' => $this->string(60)->notNull(),
'auth_key' => $this->string(32)->notNull(),
'unconfirmed_email' => $this->string(255),
'registration_ip' => $this->string(45),
'flags' => $this->integer()->notNull()->defaultValue('0'),
'confirmed_at' => $this->integer(),
'blocked_at' => $this->integer(),
'updated_at' => $this->integer()->notNull(),
'created_at' => $this->integer()->notNull(),
]);
$this->createTable(
'{{%user}}',
[
'id' => $this->primaryKey(),
'username' => $this->string(255)->notNull(),
'email' => $this->string(255)->notNull(),
'password_hash' => $this->string(60)->notNull(),
'auth_key' => $this->string(32)->notNull(),
'unconfirmed_email' => $this->string(255),
'registration_ip' => $this->string(45),
'flags' => $this->integer()->notNull()->defaultValue('0'),
'confirmed_at' => $this->integer(),
'blocked_at' => $this->integer(),
'updated_at' => $this->integer()->notNull(),
'created_at' => $this->integer()->notNull(),
]
);
$this->createIndex('idx_user_username', '{{%user}}', 'username', true);
$this->createIndex('idx_user_email', '{{%user}}', 'email', true);

View File

@ -14,9 +14,9 @@ namespace Da\User\Model;
use Da\User\Traits\AuthManagerAwareTrait;
use Da\User\Validator\RbacItemsValidator;
use Da\User\Validator\RbacRuleValidator;
use Yii;
use yii\base\Model;
use yii\rbac\Item;
use Yii;
abstract class AbstractAuthItem extends Model
{

View File

@ -13,9 +13,9 @@ namespace Da\User\Model;
use Da\User\Traits\AuthManagerAwareTrait;
use Da\User\Validator\RbacItemsValidator;
use Yii;
use yii\base\InvalidConfigException;
use yii\base\Model;
use Yii;
class Assignment extends Model
{

View File

@ -16,11 +16,11 @@ use Da\User\Query\ProfileQuery;
use Da\User\Traits\ContainerAwareTrait;
use Da\User\Traits\ModuleAwareTrait;
use Da\User\Validator\TimeZoneValidator;
use DateTime;
use DateTimeZone;
use Exception;
use Yii;
use yii\db\ActiveRecord;
use Exception;
use DateTimeZone;
use DateTime;
/**
* @property int $user_id

View File

@ -259,8 +259,11 @@ class User extends ActiveRecord implements IdentityInterface
{
if ($this->connectedAccounts == null) {
/** @var SocialNetworkAccount[] $accounts */
$accounts = $this->hasMany($this->getClassMap()
->get(SocialNetworkAccount::class), ['user_id' => 'id'])
$accounts = $this->hasMany(
$this->getClassMap()
->get(SocialNetworkAccount::class),
['user_id' => 'id']
)
->all();
foreach ($accounts as $account) {
@ -284,6 +287,6 @@ class User extends ActiveRecord implements IdentityInterface
*/
public static function findIdentityByAccessToken($token, $type = null)
{
throw new NotSupportedException('Method "'.__CLASS__.'::'.__METHOD__.'" is not implemented.');
throw new NotSupportedException('Method "' . __CLASS__ . '::' . __METHOD__ . '" is not implemented.');
}
}

View File

@ -12,7 +12,6 @@
namespace Da\User;
use Da\User\Contracts\MailChangeStrategyInterface;
use Da\User\Service\MailService;
use yii\base\Module as BaseModule;
/**

View File

@ -43,7 +43,7 @@ class UserSearch extends Model
* UserSearch constructor.
*
* @param UserQuery $query
* @param array $config
* @param array $config
*/
public function __construct(UserQuery $query, $config = [])
{
@ -84,9 +84,11 @@ class UserSearch extends Model
{
$query = $this->query;
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$dataProvider = new ActiveDataProvider(
[
'query' => $query,
]
);
if (!($this->load($params) && $this->validate())) {
return $dataProvider;

View File

@ -81,7 +81,6 @@ class AuthItemEditionService implements ServiceInterface
$childrenNames = array_keys($children);
if (is_array($this->model->children)) {
// remove those not linked anymore
foreach (array_diff($childrenNames, $this->model->children) as $item) {
if (!$this->getAuthManager()->removeChild($this->model->item, $children[$item])) {

View File

@ -41,45 +41,45 @@ class EmailChangeService implements ServiceInterface
Yii::$app->session->setFlash('danger', Yii::t('usuario', 'Your confirmation token is invalid or expired'));
return false;
} else {
$token->delete();
if (empty($this->model->unconfirmed_email)) {
Yii::$app->session->setFlash('danger', Yii::t('usuario', 'An error occurred processing your request'));
} elseif ($this->userQuery->whereEmail($this->model->unconfirmed_email)->exists() === false) {
if ($this->getModule()->emailChangeStrategy === MailChangeStrategyInterface::TYPE_SECURE) {
if ($token->type === Token::TYPE_CONFIRM_NEW_EMAIL) {
$this->model->flags |= User::NEW_EMAIL_CONFIRMED;
Yii::$app->session->setFlash(
'success',
Yii::t(
'usuario',
'Awesome, almost there. '.
'Now you need to click the confirmation link sent to your old email address.'
)
);
} elseif ($token->type === Token::TYPE_CONFIRM_OLD_EMAIL) {
$this->model->flags |= User::OLD_EMAIL_CONFIRMED;
Yii::$app->session->setFlash(
'success',
Yii::t(
'usuario',
'Awesome, almost there. '.
'Now you need to click the confirmation link sent to your new email address.'
)
);
}
}
if ($this->getModule()->emailChangeStrategy === MailChangeStrategyInterface::TYPE_DEFAULT
|| ($this->model->flags & User::NEW_EMAIL_CONFIRMED & $this->model->flags & User::OLD_EMAIL_CONFIRMED)
) {
$this->model->email = $this->model->unconfirmed_email;
$this->model->unconfirmed_email = null;
Yii::$app->session->setFlash('success', Yii::t('usuario', 'Your email address has been changed'));
}
return $this->model->save(false);
}
}
$token->delete();
if (empty($this->model->unconfirmed_email)) {
Yii::$app->session->setFlash('danger', Yii::t('usuario', 'An error occurred processing your request'));
} elseif ($this->userQuery->whereEmail($this->model->unconfirmed_email)->exists() === false) {
if ($this->getModule()->emailChangeStrategy === MailChangeStrategyInterface::TYPE_SECURE) {
if ($token->type === Token::TYPE_CONFIRM_NEW_EMAIL) {
$this->model->flags |= User::NEW_EMAIL_CONFIRMED;
Yii::$app->session->setFlash(
'success',
Yii::t(
'usuario',
'Awesome, almost there. ' .
'Now you need to click the confirmation link sent to your old email address.'
)
);
} elseif ($token->type === Token::TYPE_CONFIRM_OLD_EMAIL) {
$this->model->flags |= User::OLD_EMAIL_CONFIRMED;
Yii::$app->session->setFlash(
'success',
Yii::t(
'usuario',
'Awesome, almost there. ' .
'Now you need to click the confirmation link sent to your new email address.'
)
);
}
}
if ($this->getModule()->emailChangeStrategy === MailChangeStrategyInterface::TYPE_DEFAULT
|| ($this->model->flags & User::NEW_EMAIL_CONFIRMED & $this->model->flags & User::OLD_EMAIL_CONFIRMED)
) {
$this->model->email = $this->model->unconfirmed_email;
$this->model->unconfirmed_email = null;
Yii::$app->session->setFlash('success', Yii::t('usuario', 'Your email address has been changed'));
}
return $this->model->save(false);
}
return false;
}

View File

@ -20,11 +20,11 @@ class MailService implements ServiceInterface
/**
* MailService constructor.
*
* @param string $from
* @param string $to
* @param string $subject
* @param string $view
* @param array $params
* @param string $from
* @param string $to
* @param string $subject
* @param string $view
* @param array $params
* @param MailerInterface $mailer
*/
public function __construct($from, $to, $subject, $view, array $params, BaseMailer $mailer)

View File

@ -30,7 +30,7 @@ class ResetPasswordService implements ServiceInterface
public function run()
{
return $this->model && (bool) $this->model->updateAttributes(
return $this->model && (bool)$this->model->updateAttributes(
[
'password_hash' => $this->securityHelper->generatePasswordHash($this->password),
]

View File

@ -32,8 +32,8 @@ class SocialNetworkAccountConnectService implements ServiceInterface
/**
* SocialNetworkAccountUserLinkService constructor.
*
* @param SecurityController $controller
* @param AuthClientInterface $client
* @param SecurityController $controller
* @param AuthClientInterface $client
* @param SocialNetworkAccountQuery $socialNetworkAccountQuery
*/
public function __construct(
@ -62,12 +62,12 @@ class SocialNetworkAccountConnectService implements ServiceInterface
$this->controller->trigger(SocialNetworkAuthEvent::EVENT_AFTER_CONNECT, $event);
return true;
} else {
Yii::$app->session->setFlash(
'danger',
Yii::t('usuario', 'This account has already been connected to another user')
);
}
Yii::$app->session->setFlash(
'danger',
Yii::t('usuario', 'This account has already been connected to another user')
);
return false;
}

View File

@ -40,11 +40,11 @@ class UserBlockService implements ServiceInterface
{
if ($this->model->getIsBlocked()) {
$this->controller->trigger(UserEvent::EVENT_BEFORE_UNBLOCK, $this->event);
$result = (bool) $this->model->updateAttributes(['blocked_at' => null]);
$result = (bool)$this->model->updateAttributes(['blocked_at' => null]);
$this->controller->trigger(UserEvent::EVENT_AFTER_UNBLOCK, $this->event);
} else {
$this->controller->trigger(UserEvent::EVENT_BEFORE_BLOCK, $this->event);
$result = (bool) $this->model->updateAttributes(
$result = (bool)$this->model->updateAttributes(
['blocked_at' => time(), 'auth_key' => $this->securityHelper->generateRandomString()]
);
$this->controller->trigger(UserEvent::EVENT_AFTER_BLOCK, $this->event);

View File

@ -27,7 +27,7 @@ class UserConfirmationService implements ServiceInterface
public function run()
{
$this->model->trigger(UserEvent::EVENT_BEFORE_CONFIRMATION);
if ((bool) $this->model->updateAttributes(['confirmed_at' => time()])) {
if ((bool)$this->model->updateAttributes(['confirmed_at' => time()])) {
$this->model->trigger(UserEvent::EVENT_AFTER_CONFIRMATION);
return true;

View File

@ -15,8 +15,8 @@ use Da\User\Contracts\ServiceInterface;
use Da\User\Event\UserEvent;
use Da\User\Helper\SecurityHelper;
use Da\User\Model\User;
use yii\base\InvalidCallException;
use Exception;
use yii\base\InvalidCallException;
use yii\log\Logger;
class UserCreateService implements ServiceInterface

View File

@ -47,7 +47,7 @@ class SecureEmailChangeStrategy implements MailChangeStrategyInterface
'info',
Yii::t(
'usuario',
'We have sent confirmation links to both old and new email addresses. '.
'We have sent confirmation links to both old and new email addresses. ' .
'You must click both links to complete your request.'
)
);

View File

@ -34,10 +34,10 @@ trait ContainerAwareTrait
/**
* Gets a class from the container.
*
* @param string $class he class name or an alias name (e.g. `foo`) that was previously registered via [[set()]]
* or [[setSingleton()]]
* @param array $params constructor parameters
* @param array $config attributes
* @param string $class he class name or an alias name (e.g. `foo`) that was previously registered via [[set()]]
* or [[setSingleton()]]
* @param array $params constructor parameters
* @param array $config attributes
*
* @return object
*/
@ -47,7 +47,7 @@ trait ContainerAwareTrait
}
/**
* @return \Da\User\Helper\AuthHelper
* @return \Da\User\Helper\AuthHelper|object
*/
public function getAuth()
{
@ -55,7 +55,7 @@ trait ContainerAwareTrait
}
/**
* @return \Da\User\Helper\ClassMapHelper
* @return \Da\User\Helper\ClassMapHelper|object
*/
public function getClassMap()
{

View File

@ -12,8 +12,8 @@
namespace Da\User\Validator;
use Da\User\Contracts\ValidatorInterface;
use yii\base\Model;
use Yii;
use yii\base\Model;
use yii\bootstrap\ActiveForm;
use yii\web\Response;

View File

@ -11,10 +11,10 @@
namespace Da\User\Validator;
use ReflectionClass;
use Exception;
use yii\validators\Validator;
use ReflectionClass;
use Yii;
use yii\validators\Validator;
class RbacRuleValidator extends Validator
{

View File

@ -42,7 +42,7 @@ class AssignmentsWidget extends Widget
{
parent::init();
if ($this->userId === null) {
throw new InvalidConfigException(__CLASS__.'::$userId is required');
throw new InvalidConfigException(__CLASS__ . '::$userId is required');
}
}
@ -57,10 +57,13 @@ class AssignmentsWidget extends Widget
$this->make(UpdateAuthAssignmentsService::class, [$model])->run();
}
return $this->render('/widgets/assignments/form', [
'model' => $model,
'availableItems' => $this->getAvailableItems(),
]);
return $this->render(
'/widgets/assignments/form',
[
'model' => $model,
'availableItems' => $this->getAvailableItems(),
]
);
}
/**
@ -70,10 +73,14 @@ class AssignmentsWidget extends Widget
*/
protected function getAvailableItems()
{
return ArrayHelper::map($this->getAuthManager()->getItems(), 'name', function ($item) {
return empty($item->description)
? $item->name
: $item->name.' ('.$item->description.')';
});
return ArrayHelper::map(
$this->getAuthManager()->getItems(),
'name',
function ($item) {
return empty($item->description)
? $item->name
: $item->name . ' (' . $item->description . ')';
}
);
}
}

View File

@ -32,7 +32,7 @@ class ConnectWidget extends AuthChoice
{
AuthChoiceAsset::register(Yii::$app->view);
if ($this->popupMode) {
Yii::$app->view->registerJs("\$('#".$this->getId()."').authchoice();");
Yii::$app->view->registerJs("\$('#" . $this->getId() . "').authchoice();");
}
$this->options['id'] = $this->getId();
echo Html::beginTag('div', $this->options);
@ -45,9 +45,9 @@ class ConnectWidget extends AuthChoice
{
if ($this->isConnected($provider)) {
return Url::to(['/user/settings/disconnect', 'id' => $this->accounts[$provider->getId()]->id]);
} else {
return parent::createClientUrl($provider);
}
return parent::createClientUrl($provider);
}
/**

View File

@ -11,7 +11,7 @@
/**
* @var yii\widgets\ActiveForm
* @var \Da\User\Model\User $user
* @var \Da\User\Model\User $user
*/
?>

View File

@ -78,7 +78,10 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="panel-body">
<div class="alert alert-info">
<?= Yii::t('usuario', 'Credentials will be sent to the user by email') ?>.
<?= Yii::t('usuario', 'A password will be generated automatically if not provided') ?>.
<?= Yii::t(
'usuario',
'A password will be generated automatically if not provided'
) ?>.
</div>
<?php $form = ActiveForm::begin(
[

View File

@ -40,7 +40,7 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'registration_ip',
'value' => function ($model) {
return $model->registration_ip == null
? '<span class="not-set">'.Yii::t('usuario', '(not set)').'</span>'
? '<span class="not-set">' . Yii::t('usuario', '(not set)') . '</span>'
: $model->registration_ip;
},
'format' => 'html',
@ -50,9 +50,9 @@ $this->params['breadcrumbs'][] = $this->title;
'value' => function ($model) {
if (extension_loaded('intl')) {
return Yii::t('usuario', '{0, date, MMMM dd, YYYY HH:mm}', [$model->created_at]);
} else {
return date('Y-m-d G:i:s', $model->created_at);
}
return date('Y-m-d G:i:s', $model->created_at);
},
],
[
@ -60,19 +60,19 @@ $this->params['breadcrumbs'][] = $this->title;
'value' => function ($model) {
if ($model->isConfirmed) {
return '<div class="text-center">
<span class="text-success">' .Yii::t('usuario', 'Confirmed').'</span>
<span class="text-success">' . Yii::t('usuario', 'Confirmed') . '</span>
</div>';
} else {
return Html::a(
Yii::t('usuario', 'Confirm'),
['confirm', 'id' => $model->id],
[
'class' => 'btn btn-xs btn-success btn-block',
'data-method' => 'post',
'data-confirm' => Yii::t('usuario', 'Are you sure you want to confirm this user?'),
]
);
}
return Html::a(
Yii::t('usuario', 'Confirm'),
['confirm', 'id' => $model->id],
[
'class' => 'btn btn-xs btn-success btn-block',
'data-method' => 'post',
'data-confirm' => Yii::t('usuario', 'Are you sure you want to confirm this user?'),
]
);
},
'format' => 'raw',
'visible' => Yii::$app->getModule('user')->enableEmailConfirmation,
@ -90,17 +90,17 @@ $this->params['breadcrumbs'][] = $this->title;
'data-confirm' => Yii::t('usuario', 'Are you sure you want to unblock this user?'),
]
);
} else {
return Html::a(
Yii::t('usuario', 'Block'),
['block', 'id' => $model->id],
[
'class' => 'btn btn-xs btn-danger btn-block',
'data-method' => 'post',
'data-confirm' => Yii::t('usuario', 'Are you sure you want to block this user?'),
]
);
}
return Html::a(
Yii::t('usuario', 'Block'),
['block', 'id' => $model->id],
[
'class' => 'btn btn-xs btn-danger btn-block',
'data-method' => 'post',
'data-confirm' => Yii::t('usuario', 'Are you sure you want to block this user?'),
]
);
},
'format' => 'raw',
],

View File

@ -11,8 +11,8 @@
use Da\User\Model\User;
use yii\bootstrap\Nav;
use yii\web\View;
use yii\helpers\Html;
use yii\web\View;
/*
* @var View $this

View File

@ -15,20 +15,27 @@
*/
?>
<?php $this->beginPage() ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<?php $this->head() ?>
</head>
<body bgcolor="#f6f6f6" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; margin: 0; padding: 0;">
<table class="body-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; margin: 0; padding: 20px;">
<body bgcolor="#f6f6f6"
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; margin: 0; padding: 0;">
<table class="body-wrap"
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; margin: 0; padding: 20px;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
<td class="container" bgcolor="#FFFFFF" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0; border: 1px solid #f0f0f0;">
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
<table style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; margin: 0; padding: 0;">
<td class="container" bgcolor="#FFFFFF"
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0; border: 1px solid #f0f0f0;">
<div class="content"
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
<table
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<?php $this->beginBody() ?>
@ -42,21 +49,28 @@
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
</tr>
</table>
<table class="footer-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; clear: both !important; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
<td class="container" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;">
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
<table style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<td align="center" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 1.6; color: #666; font-weight: normal; margin: 0 0 10px; padding: 0;">
© <?= Yii::$app->name ?> <?= date('Y') ?>.
</p>
</td>
</tr>
</table>
</div>
</td>
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
<table class="footer-wrap"
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; clear: both !important; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
<td class="container"
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;">
<div class="content"
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
<table
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; width: 100%; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<td align="center"
style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;">
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 1.6; color: #666; font-weight: normal; margin: 0 0 10px; padding: 0;">
© <?= Yii::$app->name ?> <?= date('Y') ?>.
</p>
</td>
</tr>
</table>
</div>
</td>
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 100%; line-height: 1.6; margin: 0; padding: 0;"></td>
</tr>
</table>
</body>

View File

@ -20,7 +20,11 @@ use yii\helpers\Html;
<?= Yii::t('usuario', 'Hello') ?>,
</p>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">
<?= Yii::t('usuario', 'We have received a request to reset the password for your account on {0}', Yii::$app->name) ?>.
<?= Yii::t(
'usuario',
'We have received a request to reset the password for your account on {0}',
Yii::$app->name
) ?>.
<?= Yii::t('usuario', 'Please click the link below to complete your password reset') ?>.
</p>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.6; font-weight: normal; margin: 0 0 10px; padding: 0;">

View File

@ -12,7 +12,7 @@
/**
* @var \Da\User\Model\User
* @var \Da\User\Model\Token $token
* @var \Da\User\Module $module
* @var \Da\User\Module $module
*/
?>
<?= Yii::t('usuario', 'Hello') ?>,

View File

@ -21,10 +21,12 @@ use yii\widgets\ActiveForm;
?>
<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
'enableAjaxValidation' => true,
]) ?>
<?php $form = ActiveForm::begin(
[
'enableClientValidation' => false,
'enableAjaxValidation' => true,
]
) ?>
<?= $form->field($model, 'name') ?>
@ -32,13 +34,16 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'rule') ?>
<?= $form->field($model, 'children')->widget(SelectizeDropDownList::class, [
'items' => $unassignedItems,
'options' => [
'id' => 'children',
'multiple' => true,
],
]) ?>
<?= $form->field($model, 'children')->widget(
SelectizeDropDownList::class,
[
'items' => $unassignedItems,
'options' => [
'id' => 'children',
'multiple' => true,
],
]
) ?>
<?= Html::submitButton(Yii::t('usuario', 'Save'), ['class' => 'btn btn-success btn-block']) ?>

View File

@ -56,7 +56,7 @@ $this->params['breadcrumbs'][] = $this->title;
'class' => ActionColumn::className(),
'template' => '{update} {delete}',
'urlCreator' => function ($action, $model) {
return Url::to(['/user/permission/'.$action, 'name' => $model['name']]);
return Url::to(['/user/permission/' . $action, 'name' => $model['name']]);
},
'options' => [
'style' => 'width: 5%',

View File

@ -23,10 +23,13 @@ $this->params['breadcrumbs'][] = $this->title;
<div class="col-xs-12 col-sm-6 col-md-6">
<div class="row">
<div class="col-sm-6 col-md-4">
<?= Html::img($profile->getAvatarUrl(230), [
'class' => 'img-rounded img-responsive',
'alt' => $profile->user->username,
]) ?>
<?= Html::img(
$profile->getAvatarUrl(230),
[
'class' => 'img-rounded img-responsive',
'alt' => $profile->user->username,
]
) ?>
</div>
<div class="col-sm-6 col-md-8">
<h4><?= $this->title ?></h4>
@ -46,8 +49,11 @@ $this->params['breadcrumbs'][] = $this->title;
<?php if (!empty($profile->public_email)): ?>
<li>
<i class="glyphicon glyphicon-envelope text-muted"></i>
<?= Html::a(Html::encode($profile->public_email), 'mailto:'.
Html::encode($profile->public_email))
<?= Html::a(
Html::encode($profile->public_email),
'mailto:' .
Html::encode($profile->public_email)
)
?>
</li>
<?php endif; ?>

View File

@ -35,13 +35,16 @@ $unassignedItems = Yii::$container->get(AuthHelper::class)->getUnassignedItems($
<?= $form->field($model, 'rule') ?>
<?= $form->field($model, 'children')->widget(SelectizeDropDownList::class, [
'items' => $unassignedItems,
'options' => [
'id' => 'children',
'multiple' => true,
],
]) ?>
<?= $form->field($model, 'children')->widget(
SelectizeDropDownList::class,
[
'items' => $unassignedItems,
'options' => [
'id' => 'children',
'multiple' => true,
],
]
) ?>
<?= Html::submitButton(Yii::t('usuario', 'Save'), ['class' => 'btn btn-success btn-block']) ?>

View File

@ -57,7 +57,7 @@ $this->params['breadcrumbs'][] = $this->title;
'class' => ActionColumn::className(),
'template' => '{update} {delete}',
'urlCreator' => function ($action, $model) {
return Url::to(['/user/role/'.$action, 'name' => $model['name']]);
return Url::to(['/user/role/' . $action, 'name' => $model['name']]);
},
'options' => [
'style' => 'width: 5%',

View File

@ -58,13 +58,13 @@ $this->params['breadcrumbs'][] = $this->title;
->passwordInput()
->label(
Yii::t('usuario', 'Password')
.($module->allowPasswordRecovery ?
' ('.Html::a(
. ($module->allowPasswordRecovery ?
' (' . Html::a(
Yii::t('usuario', 'Forgot password?'),
['/user/recovery/request'],
['tabindex' => '5']
)
.')' : '')
. ')' : '')
) ?>
<?= $form->field($model, 'rememberMe')->checkbox(['tabindex' => '4']) ?>
@ -79,7 +79,10 @@ $this->params['breadcrumbs'][] = $this->title;
</div>
<?php if ($module->enableEmailConfirmation): ?>
<p class="text-center">
<?= Html::a(Yii::t('usuario', 'Didn\'t receive confirmation message?'), ['/user/registration/resend']) ?>
<?= Html::a(
Yii::t('usuario', 'Didn\'t receive confirmation message?'),
['/user/registration/resend']
) ?>
</p>
<?php endif ?>
<?php if ($module->enableRegistration): ?>

View File

@ -35,16 +35,18 @@ $this->params['breadcrumbs'][] = $this->title;
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
</div>
<div class="panel-body">
<?php $form = ActiveForm::begin([
'id' => $model->formName(),
'options' => ['class' => 'form-horizontal'],
'fieldConfig' => [
'template' => "{label}\n<div class=\"col-lg-9\">{input}</div>\n<div class=\"col-sm-offset-3 col-lg-9\">{error}\n{hint}</div>",
'labelOptions' => ['class' => 'col-lg-3 control-label'],
],
'enableAjaxValidation' => true,
'enableClientValidation' => false,
]); ?>
<?php $form = ActiveForm::begin(
[
'id' => $model->formName(),
'options' => ['class' => 'form-horizontal'],
'fieldConfig' => [
'template' => "{label}\n<div class=\"col-lg-9\">{input}</div>\n<div class=\"col-sm-offset-3 col-lg-9\">{error}\n{hint}</div>",
'labelOptions' => ['class' => 'col-lg-3 control-label'],
],
'enableAjaxValidation' => true,
'enableClientValidation' => false,
]
); ?>
<?= $form->field($model, 'email') ?>
@ -52,13 +54,14 @@ $this->params['breadcrumbs'][] = $this->title;
<?= $form->field($model, 'new_password')->passwordInput() ?>
<hr />
<hr/>
<?= $form->field($model, 'current_password')->passwordInput() ?>
<div class="form-group">
<div class="col-lg-offset-3 col-lg-9">
<?= Html::submitButton(Yii::t('usuario', 'Save'), ['class' => 'btn btn-block btn-success']) ?><br>
<?= Html::submitButton(Yii::t('usuario', 'Save'), ['class' => 'btn btn-block btn-success']) ?>
<br>
</div>
</div>
@ -77,11 +80,15 @@ $this->params['breadcrumbs'][] = $this->title;
<?= Yii::t('usuario', 'It will be deleted forever') ?>.
<?= Yii::t('usuario', 'Please be certain') ?>.
</p>
<?= Html::a(Yii::t('usuario', 'Delete account'), ['delete'], [
'class' => 'btn btn-danger',
'data-method' => 'post',
'data-confirm' => Yii::t('usuario', 'Are you sure? There is no going back'),
]) ?>
<?= Html::a(
Yii::t('usuario', 'Delete account'),
['delete'],
[
'class' => 'btn btn-danger',
'data-method' => 'post',
'data-confirm' => Yii::t('usuario', 'Are you sure? There is no going back'),
]
) ?>
</div>
</div>
<?php endif ?>

View File

@ -37,7 +37,8 @@ $this->params['breadcrumbs'][] = $this->title;
</div>
<div class="panel-body">
<div class="alert alert-info">
<p><?= Yii::t('usuario', 'You can connect multiple accounts to be able to log in using them') ?>.</p>
<p><?= Yii::t('usuario', 'You can connect multiple accounts to be able to log in using them') ?>
.</p>
</div>
<?php $auth = ConnectWidget::begin(
[
@ -51,7 +52,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?php foreach ($auth->getClients() as $client): ?>
<tr>
<td style="width: 32px; vertical-align: middle">
<?= Html::tag('span', '', ['class' => 'auth-icon '.$client->getName()]) ?>
<?= Html::tag('span', '', ['class' => 'auth-icon ' . $client->getName()]) ?>
</td>
<td style="vertical-align: middle">
<strong><?= $client->getTitle() ?></strong>

View File

@ -9,10 +9,10 @@
* the LICENSE file that was distributed with this source code.
*/
use Da\User\Helper\TimezoneHelper;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use Da\User\Helper\TimezoneHelper;
/*
* @var yii\web\View $this

View File

@ -21,10 +21,12 @@ use yii\bootstrap\Alert;
<div class="col-xs-12">
<?php foreach (Yii::$app->session->getAllFlashes() as $type => $message): ?>
<?php if (in_array($type, ['success', 'danger', 'warning', 'info'], true)): ?>
<?= Alert::widget([
'options' => ['class' => 'alert-dismissible alert-'.$type],
<?= Alert::widget(
[
'options' => ['class' => 'alert-dismissible alert-' . $type],
'body' => $message,
]) ?>
]
) ?>
<?php endif ?>
<?php endforeach ?>
</div>

View File

@ -12,7 +12,7 @@
/**
* @var yii\web\View
* @var \Da\User\Module $module
* @var string $title
* @var string $title
*/
$this->title = $title;

View File

@ -24,29 +24,36 @@ use yii\widgets\ActiveForm;
<?php if ($model->updated): ?>
<?= Alert::widget([
'options' => [
'class' => 'alert-success',
],
'body' => Yii::t('usuario', 'Assignments have been updated'),
]) ?>
<?= Alert::widget(
[
'options' => [
'class' => 'alert-success',
],
'body' => Yii::t('usuario', 'Assignments have been updated'),
]
) ?>
<?php endif ?>
<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
'enableAjaxValidation' => false,
]) ?>
<?php $form = ActiveForm::begin(
[
'enableClientValidation' => false,
'enableAjaxValidation' => false,
]
) ?>
<?= Html::activeHiddenInput($model, 'user_id') ?>
<?= $form->field($model, 'items')->widget(SelectizeDropDownList::class, [
'items' => $availableItems,
'options' => [
'id' => 'children',
'multiple' => true,
],
]) ?>
<?= $form->field($model, 'items')->widget(
SelectizeDropDownList::class,
[
'items' => $availableItems,
'options' => [
'id' => 'children',
'multiple' => true,
],
]
) ?>
<?= Html::submitButton(Yii::t('usuario', 'Update assignments'), ['class' => 'btn btn-success btn-block']) ?>

View File

@ -9,9 +9,9 @@
* the LICENSE file that was distributed with this source code.
*/
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\helpers\Html;
/*
* @var yii\web\View $this
@ -23,15 +23,17 @@ use yii\helpers\Html;
?>
<?php if (Yii::$app->user->isGuest): ?>
<?php $form = ActiveForm::begin([
'id' => 'login-widget-form',
'action' => Url::to(['/user/security/login']),
'enableAjaxValidation' => true,
'enableClientValidation' => false,
'validateOnBlur' => false,
'validateOnType' => false,
'validateOnChange' => false,
]) ?>
<?php $form = ActiveForm::begin(
[
'id' => 'login-widget-form',
'action' => Url::to(['/user/security/login']),
'enableAjaxValidation' => true,
'enableClientValidation' => false,
'validateOnBlur' => false,
'validateOnType' => false,
'validateOnChange' => false,
]
) ?>
<?= $form->field($model, 'login')->textInput(['placeholder' => 'Login']) ?>
@ -43,8 +45,12 @@ use yii\helpers\Html;
<?php ActiveForm::end(); ?>
<?php else: ?>
<?= Html::a(Yii::t('usuario', 'Logout'), ['/user/security/logout'], [
'class' => 'btn btn-danger btn-block',
'data-method' => 'post',
]) ?>
<?= Html::a(
Yii::t('usuario', 'Logout'),
['/user/security/logout'],
[
'class' => 'btn btn-danger btn-block',
'data-method' => 'post',
]
) ?>
<?php endif ?>