documentation update + code fixes
25
.php_cs.dist
@ -11,11 +11,26 @@ $finder = PhpCsFixer\Finder::create()
|
||||
->in(__DIR__);
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRules([
|
||||
->setRules(array(
|
||||
'@PSR1' => true,
|
||||
'@PSR2' => true,
|
||||
'@Symfony' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'phpdoc_no_alias_tag' => [],
|
||||
])
|
||||
'array_syntax' => array('syntax' => 'short'),
|
||||
'combine_consecutive_unsets' => true,
|
||||
'no_extra_consecutive_blank_lines' => array(
|
||||
'break',
|
||||
'continue',
|
||||
'extra',
|
||||
'return',
|
||||
'throw',
|
||||
'use',
|
||||
'parenthesis_brace_block',
|
||||
'square_brace_block',
|
||||
'curly_brace_block'
|
||||
),
|
||||
'no_useless_else' => true,
|
||||
'no_useless_return' => true,
|
||||
'ordered_class_elements' => true,
|
||||
'ordered_imports' => true,
|
||||
'phpdoc_add_missing_param_annotation' => true
|
||||
))
|
||||
->setFinder($finder);
|
||||
|
||||
@ -38,11 +38,13 @@
|
||||
},
|
||||
{
|
||||
"name": "Timur Ruziev",
|
||||
"email": "resurtm@gmail.com",
|
||||
"email": "resurtm@2amigos.us",
|
||||
"homepage": "http://resurtm.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=5.5",
|
||||
"2amigos/yii2-selectize-widget": "~1.0",
|
||||
@ -70,6 +72,14 @@
|
||||
"Da\\User\\": "./src/User"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"fxp-asset": {
|
||||
"installer-paths": {
|
||||
"npm-asset-library": "vendor/npm",
|
||||
"bower-asset-library": "vendor/bower"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"bootstrap": "Da\\User\\Bootstrap"
|
||||
}
|
||||
|
||||
1258
composer.lock
generated
@ -1 +0,0 @@
|
||||
**[Documentation index is here!](index.md)**
|
||||
60
docs/contributing/clean-code.md
Normal file
@ -0,0 +1,60 @@
|
||||
Clean Code
|
||||
==========
|
||||
|
||||
We have added some development tools for you to contribute to the library with clean code:
|
||||
|
||||
- **PHP mess detector**: Takes a given PHP source code base and look for several potential problems within that source.
|
||||
- **PHP code sniffer**: Tokenizes PHP, Javascript and CSS files and detectes violations of a defined set of coding
|
||||
standards.
|
||||
- **PHP code fixer**: Analyzes some PHP source code and tries to fix coding standards issues.
|
||||
- **Tests**: Well, everybody knows why tests exists.
|
||||
|
||||
Using PHP mess detector
|
||||
-----------------------
|
||||
|
||||
PHP mess detector takes a given PHP source code base and look for several potential problems within that source. The
|
||||
following is a sample usage with all options available:
|
||||
|
||||
```bash
|
||||
./vendor/bin/phpmd ./src text codesize,unusedcode,naming,design,controversial,cleancode
|
||||
```
|
||||
|
||||
For further information, please visit [PHP mess detector documentation](https://phpmd.org/)
|
||||
|
||||
Using PHP code sniffer
|
||||
----------------------
|
||||
|
||||
Global settings file: `phpcs.xml.dist` (added into Git)
|
||||
Local settings file (you can add it locally): `phpcs.xml` (ignored by Git)
|
||||
|
||||
- Run checking by `PHP_CodeSniffer`: `./vendor/bin/phpcs`
|
||||
- Show check report in patch form: `./vendor/bin/phpcs --report=diff`
|
||||
- Automatically fix all fixable issues: `./vendor/bin/phpcbf`
|
||||
|
||||
For further information, please visit [squizlabs/PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
|
||||
|
||||
Using PHP code fixer
|
||||
--------------------
|
||||
|
||||
Global settings file: `.php_cs.dist` (added into Git)
|
||||
Local settings file (you can add it locally): `.php_cs` (ignored by Git)
|
||||
|
||||
- Run checking by `PHP-CS-Fixer`: `./vendor/bin/php-cs-fixer --config=.php_cs.dist fix ./src --dry-run`
|
||||
- Automatically fix all fixable issues: ` ./vendor/bin/php-cs-fixer --config=.php_cs.dist fix ./src`
|
||||
|
||||
For further information, please visit [FriendsOfPHP/PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
|
||||
|
||||
Running Tests
|
||||
-------------
|
||||
|
||||
We are using `Codeception` for testing the module. Do the following:
|
||||
|
||||
- Create a `yii2-usuario-test` database.
|
||||
- Add database access configuration `tests/_app/config/db.php`
|
||||
- Run `./vendor/bin/codecept build`
|
||||
- Run `./vendor/bin/codecept functional`
|
||||
|
||||
We still need to add `unit` tests to the module. Feel free to add your tests to it as long as it makes use of
|
||||
`Codeception`.
|
||||
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
30
docs/contributing/how-to.md
Normal file
@ -0,0 +1,30 @@
|
||||
# How to contribute
|
||||
|
||||
Contributions are **welcome** and will be fully **credited**.
|
||||
|
||||
We accept contributions via Pull Requests on [Github](https://github.com/2amigos/yii2-usuario).
|
||||
|
||||
|
||||
## Pull Requests
|
||||
|
||||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
|
||||
|
||||
- **Add tests!** - Your new features won't be accepted if it doesn't have tests.
|
||||
|
||||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
|
||||
|
||||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
|
||||
|
||||
- **Create feature branches** - Don't ask us to pull from your master branch.
|
||||
|
||||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
|
||||
|
||||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
|
||||
|
||||
|
||||
## Clean Code
|
||||
|
||||
- Follow the guidelines at [Clean Code](clean-code.md)
|
||||
|
||||
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
@ -73,3 +73,5 @@ class ProfileController extends Controller
|
||||
|
||||
> This is absolutely good way to extend almost any class of the extension. For more information you could
|
||||
> check `Da\User\Bootstrap` class file to see what you have in your control.
|
||||
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
|
||||
106
docs/enhancing-and-overriding/overriding-classes.md
Normal file
@ -0,0 +1,106 @@
|
||||
Overriding Classes
|
||||
==================
|
||||
|
||||
This module makes extensive use of the Yii2's Dependency Injection Container. The module has a special attribute
|
||||
named `classMap` where it allows you to override specific classes.
|
||||
|
||||
The following are the classes that you can override throughout that attribute:
|
||||
|
||||
- Model Classes (AR)
|
||||
- User
|
||||
- SocialNetworkAccount
|
||||
- Profile
|
||||
- Token
|
||||
- Assignment
|
||||
- Permission
|
||||
- Role
|
||||
- Search Classes
|
||||
- UserSearch
|
||||
- PermissionSearch
|
||||
- RoleSearch
|
||||
- Form Classes
|
||||
- RegistrationForm
|
||||
- ResendForm
|
||||
- LoginForm
|
||||
- SettingsForm
|
||||
- RecoveryForm
|
||||
|
||||
|
||||
How to Override
|
||||
---------------
|
||||
|
||||
The `classMap` contains an easy to recognize name and their correspondent definition. The default configuration can be
|
||||
seen at the `Bootstrap` class:
|
||||
|
||||
```php
|
||||
$defaults = [
|
||||
// --- models
|
||||
'User' => 'Da\User\Model\User',
|
||||
'SocialNetworkAccount' => 'Da\User\Model\SocialNetworkAccount',
|
||||
'Profile' => 'Da\User\Model\Profile',
|
||||
'Token' => 'Da\User\Model\Token',
|
||||
'Assignment' => 'Da\User\Model\Assignment',
|
||||
'Permission' => 'Da\User\Model\Permission',
|
||||
'Role' => 'Da\User\Model\Role',
|
||||
// --- search
|
||||
'UserSearch' => 'Da\User\Search\UserSearch',
|
||||
'PermissionSearch' => 'Da\User\Search\PermissionSearch',
|
||||
'RoleSearch' => 'Da\User\Search\RoleSearch',
|
||||
// --- forms
|
||||
'RegistrationForm' => 'Da\User\Form\RegistrationForm',
|
||||
'ResendForm' => 'Da\User\Form\ResendForm',
|
||||
'LoginForm' => 'Da\User\Form\LoginForm',
|
||||
'SettingsForm' => 'Da\User\Form\SettingsForm',
|
||||
'RecoveryForm' => 'Da\User\Form\RecoveryForm',
|
||||
];
|
||||
```
|
||||
|
||||
As you can see, the only thing we need to do is actually modify its definition. For example, the following configuration
|
||||
will override the `RegistrationForm` class:
|
||||
|
||||
```php
|
||||
namespace app\forms;
|
||||
|
||||
use Da\User\Form\RegistrationForm as BaseForm;
|
||||
|
||||
|
||||
class RegistrationForm extends BaseForm {
|
||||
|
||||
/**
|
||||
* Override from parent
|
||||
*/
|
||||
public function rules() {
|
||||
// your logic
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
Now, to tell the module to use your class instead, you simply need to update the definition of that class into the
|
||||
the `Module::classMap` attribute.
|
||||
|
||||
```php
|
||||
\\ ...
|
||||
'modules' => [
|
||||
'user' => [
|
||||
'class' => Da\User\Module::class,
|
||||
'classMap' => [
|
||||
'RegistrationForm' => 'app\forms\RegistrationForm'
|
||||
]
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
The definition can be any of the following (from Yii2's DI container):
|
||||
|
||||
- a **PHP callable**: The callable will be executed when `Container::get()]]` is invoked. The signature of the callable
|
||||
should be `function ($container, $params, $config)`, where `$params` stands for the list of constructor
|
||||
parameters, `$config` the object configuration, and `$container` the container object. The return value
|
||||
of the callable will be returned by `Container::get()]]` as the object instance requested.
|
||||
- a **configuration array**: the array contains name-value pairs that will be used to initialize the property
|
||||
values of the newly created object when `Container::get()]]` is called. The `class` element stands for the
|
||||
the class of the object to be created. If `class` is not specified, `$class` will be used as the class name.
|
||||
- a **string**: a class name, an interface name or an alias name.
|
||||
|
||||
|
||||
|
||||
> See [how to enhance a User model](how-to-enhance-a-user-model.md) guide to see a practical example.
|
||||
103
docs/index.md
@ -1,5 +1,4 @@
|
||||
Yii2 Usuario Extension Documentation
|
||||
====================================
|
||||
# Yii2 Usuario Extension
|
||||
|
||||
[](https://travis-ci.org/2amigos/yii2-usuario)
|
||||
[](http://yii2-usuario.readthedocs.io/en/latest/?badge=latest)
|
||||
@ -10,17 +9,93 @@ Yii2 Usuario Extension Documentation
|
||||
[](https://scrutinizer-ci.com/g/2amigos/yii2-usuario/?branch=master)
|
||||
[](https://scrutinizer-ci.com/g/2amigos/yii2-usuario/?branch=master)
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
## Getting Started
|
||||
|
||||
Installation
|
||||
------------
|
||||
This extension has been built to be working `out of the box`, that is, after you install its migrations and configure
|
||||
the module on your application structure, you should be set to go.
|
||||
|
||||
#### Step 1 - Download
|
||||
|
||||
You can download it and place it on your third party libraries folder but we highly recommend that you install it
|
||||
through [composer](http://getcomposer.org/download/).
|
||||
|
||||
Either run
|
||||
|
||||
```bash
|
||||
$ composer require 2amigos/yii2-usuario:~1.0
|
||||
```
|
||||
|
||||
or add
|
||||
|
||||
```
|
||||
"2amigos/yii2-usuario": "~1.0"
|
||||
```
|
||||
|
||||
to the `require` section of your `composer.json` file.
|
||||
|
||||
#### Step 2 - Apply database schema migrations
|
||||
|
||||
This is obvious extension like our which deals with users, roles, permissions, etc. have to use some database.
|
||||
Our migrations are namespaced and available in `Da\User\Migration` namespace.
|
||||
|
||||
Before starting to work with database, please ensure you have deleted `m130524_201442_init.php` migration file
|
||||
which comes from the default installation of the Advanced Application Template. It's located at
|
||||
`%PROJECT_DIR%/console/migrations/m130524_201442_init.php` path.
|
||||
|
||||
There are two ways to apply migrations of this extension, the first one:
|
||||
|
||||
```php
|
||||
./yii migrate --migrationPath="@Da/User/Migration"
|
||||
./yii migrate
|
||||
```
|
||||
|
||||
First command applies migration set of the user module, and the second one is for application migrations.
|
||||
|
||||
> Note, you cannot mix two ways: choose one of them, and stick with it.
|
||||
|
||||
The second way is more comfortable, and you don't have to remember to launch first command every time you obtain
|
||||
new version of our extension. First of all add the following lines to the file
|
||||
`%PROJECT_DIR%/console/config/main.php`:
|
||||
|
||||
```php
|
||||
return [
|
||||
// ...
|
||||
'controllerMap' => [
|
||||
'migrate' => [
|
||||
'class' => \yii\console\controllers\MigrateController::class,
|
||||
'migrationNamespaces' => [
|
||||
'Da\User\Migration',
|
||||
],
|
||||
],
|
||||
],
|
||||
// ...
|
||||
];
|
||||
```
|
||||
|
||||
This basically instructs your application to always try to use migrations from the given namespace. Which again
|
||||
is very convenient way to track new migration classes coming from this and possibly other extensions and sources.
|
||||
|
||||
> Namespaced migrations were introduced in Yii 2.0.10, so before using them consider updating your framework
|
||||
> installation version.
|
||||
|
||||
#### Step 3 - Configure
|
||||
|
||||
Once we have it installed, we have to configure it on your `config.php` file.
|
||||
|
||||
|
||||
```php
|
||||
'modules' => [
|
||||
'user' => [
|
||||
'class' => Da\User\Module::class,
|
||||
]
|
||||
]
|
||||
```
|
||||
|
||||
Configuration may differ from template to template, the following are some guidelines for sidekit app template and
|
||||
the official Yii2 advanced application template:
|
||||
|
||||
- [Sidekit Application Template](installation/sidekit-application-template.md)
|
||||
- [Advanced Application Template](installation/advanced-application-template.md)
|
||||
- [Basic Application Template](installation/basic-application-template.md)
|
||||
|
||||
Enhancing and Overriding
|
||||
------------------------
|
||||
@ -32,10 +107,10 @@ Helpful Guides
|
||||
|
||||
- [Separate Frontend and Backend Sessions](helpful-guides/separate-frontend-and-backend-sessions.md)
|
||||
|
||||
Other
|
||||
-----
|
||||
Contributing
|
||||
------------
|
||||
|
||||
- [Contriburing to Documentation](other/contriburing-to-documentation.md)
|
||||
- [Other for Developers](other/other-for-developers.md)
|
||||
- [How to Contribute](contributing/how-to.md)
|
||||
- [Clean Code](contributing/clean-code.md)
|
||||
|
||||
© [2amigos](http://www.2amigos.us/) 2016
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
|
||||
@ -6,7 +6,7 @@ This page is dedicated for those who prefer to use more or less default
|
||||
check [their readme](https://github.com/yiisoft/yii2-app-advanced#readme) file on why and when you should use it,
|
||||
for now we're going to explain on how Yii2 User Module extension could be used for the case if you prefer it.
|
||||
|
||||
> We highly recommend you to use [Sidekit Application Template](http://www.2amigos.us/) which has sensible default
|
||||
> We highly recommend you to use [Sidekit Application Template](https://github.com/sidekit/yii2-app-template) which has sensible default
|
||||
packages, and everything you need to start project in no time with batteries included! ;-)
|
||||
>
|
||||
> [Check this manual page](sidekit-application-template.md) if you decided to use it.
|
||||
@ -107,9 +107,5 @@ is very convenient way to track new migration classes coming from this and possi
|
||||
> Namespaced migrations were introduced in Yii 2.0.10, so before using them consider updating your framework
|
||||
> installation version.
|
||||
|
||||
What can I do now?
|
||||
------------------
|
||||
|
||||
Now you're ready to go and build something nice with help of our module extension. Perhaps you could check
|
||||
[how to use login and sign up forms]() gracefully built for your needs, or you can check out how you could
|
||||
[customize login form]() look'n'feel.
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
Basic Application Template
|
||||
==========================
|
||||
|
||||
TODO:
|
||||
@ -1,4 +1,83 @@
|
||||
Sidekit Application Template
|
||||
============================
|
||||
|
||||
TODO: promote our own application template first of all, and do it here ;-)
|
||||
Sidekit Application Template is our proposed structure for your Yii2 applications. It makes use
|
||||
of a special library named `SideKit`
|
||||
|
||||
> For further information regarding the use of this template, please visit its
|
||||
[README file](https://github.com/sidekit/yii2-app-template).
|
||||
|
||||
Step 1 - Install SideKit Application template
|
||||
----------------------------------------------
|
||||
|
||||
We will assume that you have composer installed globally on your computer and also the
|
||||
`fxp/composer-asset/plugin:^1.3` that is required for all Yii2 apps.
|
||||
|
||||
```bash
|
||||
composer create-project --prefer-dist --stability=dev sidekit/yii2-app-template your-site-name
|
||||
```
|
||||
|
||||
Step 2 - Configure your application
|
||||
-----------------------------------
|
||||
|
||||
Go to the `config/web/modules` folder and create a new PHP file named `user.php`. Then on in its
|
||||
contents write the configuration for the module:
|
||||
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
return [
|
||||
'class' => Da\User\Module::class
|
||||
];
|
||||
```
|
||||
|
||||
Step 3 - Apply database schema migrations
|
||||
-----------------------------------------
|
||||
|
||||
This is obvious extension like our which deals with users, roles, permissions, etc. have to use some database.
|
||||
Our migrations are namespaced and available in `Da\User\Migration` namespace.
|
||||
|
||||
Before starting to work with database, please ensure you have deleted `m130524_201442_init.php` migration file
|
||||
which comes from the default installation of the Advanced Application Template. It's located at
|
||||
`%PROJECT_DIR%/console/migrations/m130524_201442_init.php` path.
|
||||
|
||||
There are two ways to apply migrations of this extension, the first one:
|
||||
|
||||
```php
|
||||
./yii migrate --migrationPath="@Da/User/Migration"
|
||||
./yii migrate
|
||||
```
|
||||
|
||||
First command applies migration set of the user module, and the second one is for application migrations.
|
||||
|
||||
> Note, you cannot mix two ways: choose one of them, and stick with it.
|
||||
|
||||
The second way is more comfortable, and you don't have to remember to launch first command every time you obtain
|
||||
new version of our extension. First of all add the following lines to the file
|
||||
`%PROJECT_DIR%/console/config/main.php`:
|
||||
|
||||
```php
|
||||
return [
|
||||
// ...
|
||||
'controllerMap' => [
|
||||
'migrate' => [
|
||||
'class' => \yii\console\controllers\MigrateController::class,
|
||||
'migrationNamespaces' => [
|
||||
'Da\User\Migration',
|
||||
],
|
||||
],
|
||||
],
|
||||
// ...
|
||||
];
|
||||
```
|
||||
|
||||
This basically instructs your application to always try to use migrations from the given namespace. Which again
|
||||
is very convenient way to track new migration classes coming from this and possibly other extensions and sources.
|
||||
|
||||
> Namespaced migrations were introduced in Yii 2.0.10, so before using them consider updating your framework
|
||||
> installation version.
|
||||
|
||||
© [2amigos](http://www.2amigos.us/) 2013-2017
|
||||
|
||||
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
Yii Logo
|
||||
========
|
||||
|
||||
File `yii-logo.svg`:
|
||||
[Yii Framework logo download](http://www.yiiframework.com/logo/)
|
||||

|
||||
|
||||
Font Awesome icons
|
||||
==================
|
||||
|
||||
File `cogs.svg`:
|
||||
[Github project: encharm/Font-Awesome-SVG-PNG](https://github.com/encharm/Font-Awesome-SVG-PNG/blob/master/black/svg/cogs.svg)
|
||||

|
||||
|
||||
File `user-secret.svg:
|
||||
[Github project: encharm/Font-Awesome-SVG-PNG](https://github.com/encharm/Font-Awesome-SVG-PNG/blob/master/black/svg/user-secret.svg)
|
||||

|
||||
|
||||
File `wrench.svg`:
|
||||
[Github project: encharm/Font-Awesome-SVG-PNG](https://github.com/encharm/Font-Awesome-SVG-PNG/blob/master/black/svg/wrench.svg)
|
||||

|
||||
|
Before Width: | Height: | Size: 994 B |
@ -1 +0,0 @@
|
||||
<svg width="36" height="36" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M832 896q0-106-75-181t-181-75-181 75-75 181 75 181 181 75 181-75 75-181zm768 512q0-52-38-90t-90-38-90 38-38 90q0 53 37.5 90.5t90.5 37.5 90.5-37.5 37.5-90.5zm0-1024q0-52-38-90t-90-38-90 38-38 90q0 53 37.5 90.5t90.5 37.5 90.5-37.5 37.5-90.5zm-384 421v185q0 10-7 19.5t-16 10.5l-155 24q-11 35-32 76 34 48 90 115 7 10 7 20 0 12-7 19-23 30-82.5 89.5t-78.5 59.5q-11 0-21-7l-115-90q-37 19-77 31-11 108-23 155-7 24-30 24h-186q-11 0-20-7.5t-10-17.5l-23-153q-34-10-75-31l-118 89q-7 7-20 7-11 0-21-8-144-133-144-160 0-9 7-19 10-14 41-53t47-61q-23-44-35-82l-152-24q-10-1-17-9.5t-7-19.5v-185q0-10 7-19.5t16-10.5l155-24q11-35 32-76-34-48-90-115-7-11-7-20 0-12 7-20 22-30 82-89t79-59q11 0 21 7l115 90q34-18 77-32 11-108 23-154 7-24 30-24h186q11 0 20 7.5t10 17.5l23 153q34 10 75 31l118-89q8-7 20-7 11 0 21 8 144 133 144 160 0 9-7 19-12 16-42 54t-45 60q23 48 34 82l152 23q10 2 17 10.5t7 19.5zm640 533v140q0 16-149 31-12 27-30 52 51 113 51 138 0 4-4 7-122 71-124 71-8 0-46-47t-52-68q-20 2-30 2t-30-2q-14 21-52 68t-46 47q-2 0-124-71-4-3-4-7 0-25 51-138-18-25-30-52-149-15-149-31v-140q0-16 149-31 13-29 30-52-51-113-51-138 0-4 4-7 4-2 35-20t59-34 30-16q8 0 46 46.5t52 67.5q20-2 30-2t30 2q51-71 92-112l6-2q4 0 124 70 4 3 4 7 0 25-51 138 17 23 30 52 149 15 149 31zm0-1024v140q0 16-149 31-12 27-30 52 51 113 51 138 0 4-4 7-122 71-124 71-8 0-46-47t-52-68q-20 2-30 2t-30-2q-14 21-52 68t-46 47q-2 0-124-71-4-3-4-7 0-25 51-138-18-25-30-52-149-15-149-31v-140q0-16 149-31 13-29 30-52-51-113-51-138 0-4 4-7 4-2 35-20t59-34 30-16q8 0 46 46.5t52 67.5q20-2 30-2t30 2q51-71 92-112l6-2q4 0 124 70 4 3 4 7 0 25-51 138 17 23 30 52 149 15 149 31z"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 784 B |
@ -1 +0,0 @@
|
||||
<svg width="36" height="36" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M704 1536l96-448-96-128-128-64zm256 0l128-640-128 64-96 128zm160-1010q-2-4-4-6-10-8-96-8-70 0-167 19-7 2-21 2t-21-2q-97-19-167-19-86 0-96 8-2 2-4 6 2 18 4 27 2 3 7.5 6.5t7.5 10.5q2 4 7.5 20.5t7 20.5 7.5 17 8.5 17 9 14 12 13.5 14 9.5 17.5 8 20.5 4 24.5 2q36 0 59-12.5t32.5-30 14.5-34.5 11.5-29.5 17.5-12.5h12q11 0 17.5 12.5t11.5 29.5 14.5 34.5 32.5 30 59 12.5q13 0 24.5-2t20.5-4 17.5-8 14-9.5 12-13.5 9-14 8.5-17 7.5-17 7-20.5 7.5-20.5q2-7 7.5-10.5t7.5-6.5q2-9 4-27zm416 879q0 121-73 190t-194 69h-874q-121 0-194-69t-73-190q0-61 4.5-118t19-125.5 37.5-123.5 63.5-103.5 93.5-74.5l-90-220h214q-22-64-22-128 0-12 2-32-194-40-194-96 0-57 210-99 17-62 51.5-134t70.5-114q32-37 76-37 30 0 84 31t84 31 84-31 84-31q44 0 76 37 36 42 70.5 114t51.5 134q210 42 210 99 0 56-194 96 7 81-20 160h214l-82 225q63 33 107.5 96.5t65.5 143.5 29 151.5 8 148.5z"/></svg>
|
||||
|
Before Width: | Height: | Size: 938 B |
|
Before Width: | Height: | Size: 579 B |
@ -1 +0,0 @@
|
||||
<svg width="36" height="36" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M448 1472q0-26-19-45t-45-19-45 19-19 45 19 45 45 19 45-19 19-45zm644-420l-682 682q-37 37-90 37-52 0-91-37l-106-108q-38-36-38-90 0-53 38-91l681-681q39 98 114.5 173.5t173.5 114.5zm634-435q0 39-23 106-47 134-164.5 217.5t-258.5 83.5q-185 0-316.5-131.5t-131.5-316.5 131.5-316.5 316.5-131.5q58 0 121.5 16.5t107.5 46.5q16 11 16 28t-16 28l-293 169v224l193 107q5-3 79-48.5t135.5-81 70.5-35.5q15 0 23.5 10t8.5 25z"/></svg>
|
||||
|
Before Width: | Height: | Size: 508 B |
|
Before Width: | Height: | Size: 1.5 KiB |
@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="34px" height="36px" viewBox="0 0 256 274" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
|
||||
<defs>
|
||||
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-1">
|
||||
<stop stop-color="#73B723" offset="0%"></stop>
|
||||
<stop stop-color="#D8EE61" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient x1="84.857945%" y1="26.2510333%" x2="13.5844148%" y2="100%" id="linearGradient-2">
|
||||
<stop stop-color="#98C9EA" offset="0%"></stop>
|
||||
<stop stop-color="#026FB2" offset="68.8649011%"></stop>
|
||||
<stop stop-color="#086EB6" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient x1="0%" y1="6.32032406%" x2="85.8842047%" y2="69.934521%" id="linearGradient-3">
|
||||
<stop stop-color="#D73721" offset="0%"></stop>
|
||||
<stop stop-color="#F7D768" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient x1="30.9607463%" y1="30.9929036%" x2="86.77032%" y2="81.7463136%" id="linearGradient-4">
|
||||
<stop stop-color="#D4C883" offset="0%"></stop>
|
||||
<stop stop-color="#A1D1A7" offset="100%"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g>
|
||||
<path d="M221.82887,0.00412799194 C240.429601,9.48199748 256.40493,34.3531489 255.6041,68.103611 C253.172713,109.689002 223.021859,145.528228 190.216707,178.548035 C188.379751,138.279474 179.62428,112.615748 165.952371,76.5288425 C153.04414,40.1612336 190.782242,1.16822172 221.82887,0.00412799194 Z"
|
||||
fill="url(#linearGradient-1)"></path>
|
||||
<path d="M121.217322,177.132134 C131.204902,164.708201 138.283655,153.644222 143.224024,143.647838 C177.064816,161.34127 169.079363,158.037037 185.400361,176.888462 C185.455453,177.47466 185.507406,178.05952 185.556205,178.642979 C186.910186,204.781424 167.842991,265.20697 92.7630738,273.487722 C87.565932,232.884793 104.461803,198.250941 121.217322,177.132134 Z"
|
||||
fill="url(#linearGradient-2)"></path>
|
||||
<path d="M0.390998236,25.2467987 C53.8856458,4.07845603 111.458749,25.7627977 144.69734,70.9436694 C147.91259,75.3134465 150.962016,79.8532119 153.837952,84.5259347 C159.03175,117.680556 155.071433,136.093913 144.962268,145.854571 C138.315284,142.501051 131.223373,139.526824 123.652837,136.776885 C106.05108,130.382625 89.8074316,126.151434 66.6081169,119.282455 C11.5200645,104.248308 -2.06515697,57.0116966 0.390998236,25.2467987 Z"
|
||||
fill="url(#linearGradient-3)"></path>
|
||||
<path d="M151.793359,81.2801612 C152.144238,81.8250562 152.490989,82.3658231 152.833612,82.9148461 L153.254668,83.5918367 C154.11329,84.970586 154.9554,86.3575913 155.785127,87.7611086 L155.925478,87.9964041 L156.14839,88.3761794 L156.350662,88.7270587 L156.945092,89.7466727 L156.986372,89.8209766 L157.791331,91.2327498 L157.816099,91.2740297 C158.398146,92.3018997 158.971937,93.3338977 159.537471,94.3741517 L159.607647,94.5062474 L160.235102,95.6703411 L160.251614,95.6992371 L160.940989,96.9954266 L161.139132,97.3752018 L161.523036,98.1141124 L161.993627,99.0263986 L162.447706,99.9097889 C162.910041,100.826203 163.368248,101.742617 163.818199,102.659031 L163.933783,102.886071 C164.746997,104.549652 165.535444,106.217361 166.307378,107.897453 L166.893553,109.181259 L166.951345,109.309227 L167.326992,110.143081 L167.764559,111.129671 L168.012239,111.699334 L168.408526,112.61162 L168.693358,113.267971 L169.291916,114.679744 L169.333196,114.778816 L169.973035,116.314429 L170.051467,116.500188 C170.732586,118.159641 171.393064,119.819094 172.032903,121.490931 L172.094823,121.643666 L172.623206,123.043056 L172.65623,123.121488 L172.961701,123.947086 C173.300197,124.8635 173.634564,125.779914 173.964803,126.700457 L174.092771,127.059592 C174.456034,128.087462 174.81517,129.11946 175.161921,130.14733 L175.273377,130.473441 C175.599488,131.439391 175.913215,132.405341 176.226943,133.371292 L176.379679,133.846011 L176.41683,133.957466 L176.912189,135.521975 L176.932829,135.592151 L177.391037,137.086484 L177.849244,138.626225 L177.861628,138.659249 L178.241403,139.959567 L178.361115,140.380622 L178.592282,141.18558 C178.852346,142.114378 179.108281,143.039049 179.355961,143.967847 L179.54172,144.661349 L179.900856,146.031843 L179.917368,146.097891 C180.354935,147.782111 180.767734,149.466332 181.159893,151.146425 L181.197045,151.3198 L181.238325,151.497304 C181.750196,153.714036 182.220787,155.922511 182.654226,158.122731 L182.695506,158.341515 C183.364241,161.76362 183.938032,165.165085 184.412751,168.537655 L184.421007,168.583063 C184.569615,169.623317 184.705838,170.659443 184.833806,171.695569 L184.88747,172.141392 L185.060846,173.623341 L185.060846,173.627469 L185.209453,174.997962 L185.258989,175.452041 L185.366317,176.537703 L185.407597,176.97527 L185.424109,177.152774 L185.556205,178.642979 C173.737764,163.423073 159.620031,152.933845 142.678752,144.727397 C156.350662,117.697306 154.431145,98.4360957 151.793359,81.2801612"
|
||||
fill="url(#linearGradient-4)"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.0 KiB |
@ -1,32 +0,0 @@
|
||||
Other for Developers
|
||||
====================
|
||||
|
||||
Tests
|
||||
-----
|
||||
|
||||
1. First of all
|
||||
2. Running tests: `./vendor`
|
||||
|
||||
Code Style Checkers and Mess Detectors
|
||||
--------------------------------------
|
||||
|
||||
## [squizlabs/PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
|
||||
|
||||
Global settings file: `phpcs.xml.dist` (added into Git)
|
||||
Local settings file (you can add it locally): `phpcs.xml` (ignored by Git)
|
||||
|
||||
Run checking by `PHP_CodeSniffer`: `./vendor/bin/phpcs`
|
||||
Show check report in patch form: `./vendor/bin/phpcs --report=diff`
|
||||
Automatically fix all fixable issues: `./vendor/bin/phpcbf`
|
||||
|
||||
## [FriendsOfPHP/PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
|
||||
|
||||
Global settings file: `.php_cs.dist` (added into Git)
|
||||
Local settings file (you can add it locally): `.php_cs` (ignored by Git)
|
||||
|
||||
Run checking by `PHP-CS-Fixer`: `./vendor/bin/php-cs-fixer fix --dry-run`
|
||||
Automatically fix all fixable issues: `./vendor/bin/php-cs-fixer fix`
|
||||
|
||||
## [phpmd/phpmd](https://github.com/phpmd/phpmd)
|
||||
|
||||
TODO:
|
||||
@ -28,9 +28,9 @@ class Yandex extends BaseYandex implements AuthClientInterface
|
||||
|
||||
if ($emails !== null && isset($emails[0])) {
|
||||
return $emails[0];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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'));
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -249,12 +249,15 @@ class RegistrationController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
return $this->render('/shared/message', [
|
||||
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(
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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,15 +38,15 @@ class SettingsController extends Controller
|
||||
{
|
||||
use ContainerAwareTrait;
|
||||
|
||||
protected $profileQuery;
|
||||
protected $userQuery;
|
||||
protected $socialNetworkAccountQuery;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public $defaultAction = 'profile';
|
||||
|
||||
protected $profileQuery;
|
||||
protected $userQuery;
|
||||
protected $socialNetworkAccountQuery;
|
||||
|
||||
/**
|
||||
* SettingsController constructor.
|
||||
*
|
||||
@ -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();
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
|
||||
namespace Da\User\Factory;
|
||||
|
||||
use Exception;
|
||||
use Yii;
|
||||
use yii\rbac\Item;
|
||||
use Exception;
|
||||
|
||||
class AuthItemFactory
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -35,7 +35,6 @@ class AccessRuleFilter extends AccessRule
|
||||
return true;
|
||||
}
|
||||
} elseif ($role === 'admin') {
|
||||
|
||||
/** @var User $identity */
|
||||
$identity = $user->getIdentity();
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
|
||||
namespace Da\User\Helper;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use DateTime;
|
||||
|
||||
class TimezoneHelper
|
||||
{
|
||||
|
||||
@ -17,7 +17,9 @@ class m000000_000001_create_user_table extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->createTable('{{%user}}', [
|
||||
$this->createTable(
|
||||
'{{%user}}',
|
||||
[
|
||||
'id' => $this->primaryKey(),
|
||||
'username' => $this->string(255)->notNull(),
|
||||
'email' => $this->string(255)->notNull(),
|
||||
@ -30,7 +32,8 @@ class m000000_000001_create_user_table extends Migration
|
||||
'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);
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
namespace Da\User;
|
||||
|
||||
use Da\User\Contracts\MailChangeStrategyInterface;
|
||||
use Da\User\Service\MailService;
|
||||
use yii\base\Module as BaseModule;
|
||||
|
||||
/**
|
||||
|
||||
@ -84,9 +84,11 @@ class UserSearch extends Model
|
||||
{
|
||||
$query = $this->query;
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
$dataProvider = new ActiveDataProvider(
|
||||
[
|
||||
'query' => $query,
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
if (!($this->load($params) && $this->validate())) {
|
||||
return $dataProvider;
|
||||
|
||||
@ -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])) {
|
||||
|
||||
@ -41,7 +41,7 @@ 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'));
|
||||
@ -79,7 +79,7 @@ class EmailChangeService implements ServiceInterface
|
||||
|
||||
return $this->model->save(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -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')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -57,10 +57,13 @@ class AssignmentsWidget extends Widget
|
||||
$this->make(UpdateAuthAssignmentsService::class, [$model])->run();
|
||||
}
|
||||
|
||||
return $this->render('/widgets/assignments/form', [
|
||||
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 ArrayHelper::map(
|
||||
$this->getAuthManager()->getItems(),
|
||||
'name',
|
||||
function ($item) {
|
||||
return empty($item->description)
|
||||
? $item->name
|
||||
: $item->name . ' (' . $item->description . ')';
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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(
|
||||
[
|
||||
|
||||
@ -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);
|
||||
},
|
||||
],
|
||||
[
|
||||
@ -62,7 +62,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
return '<div class="text-center">
|
||||
<span class="text-success">' . Yii::t('usuario', 'Confirmed') . '</span>
|
||||
</div>';
|
||||
} else {
|
||||
}
|
||||
|
||||
return Html::a(
|
||||
Yii::t('usuario', 'Confirm'),
|
||||
['confirm', 'id' => $model->id],
|
||||
@ -72,7 +73,6 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'data-confirm' => Yii::t('usuario', 'Are you sure you want to confirm this user?'),
|
||||
]
|
||||
);
|
||||
}
|
||||
},
|
||||
'format' => 'raw',
|
||||
'visible' => Yii::$app->getModule('user')->enableEmailConfirmation,
|
||||
@ -90,7 +90,8 @@ $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],
|
||||
@ -100,7 +101,6 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'data-confirm' => Yii::t('usuario', 'Are you sure you want to block this user?'),
|
||||
]
|
||||
);
|
||||
}
|
||||
},
|
||||
'format' => 'raw',
|
||||
],
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"/>
|
||||
<?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,12 +49,19 @@
|
||||
<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;">
|
||||
<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 align="center" 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>
|
||||
|
||||
@ -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;">
|
||||
|
||||
@ -21,10 +21,12 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
?>
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
<?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, [
|
||||
<?= $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']) ?>
|
||||
|
||||
|
||||
@ -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), [
|
||||
<?= 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; ?>
|
||||
|
||||
@ -35,13 +35,16 @@ $unassignedItems = Yii::$container->get(AuthHelper::class)->getUnassignedItems($
|
||||
|
||||
<?= $form->field($model, 'rule') ?>
|
||||
|
||||
<?= $form->field($model, 'children')->widget(SelectizeDropDownList::class, [
|
||||
<?= $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']) ?>
|
||||
|
||||
|
||||
@ -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): ?>
|
||||
|
||||
@ -35,7 +35,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
<h3 class="panel-title"><?= Html::encode($this->title) ?></h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<?php $form = ActiveForm::begin([
|
||||
<?php $form = ActiveForm::begin(
|
||||
[
|
||||
'id' => $model->formName(),
|
||||
'options' => ['class' => 'form-horizontal'],
|
||||
'fieldConfig' => [
|
||||
@ -44,7 +45,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
],
|
||||
'enableAjaxValidation' => true,
|
||||
'enableClientValidation' => false,
|
||||
]); ?>
|
||||
]
|
||||
); ?>
|
||||
|
||||
<?= $form->field($model, 'email') ?>
|
||||
|
||||
@ -58,7 +60,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
<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'], [
|
||||
<?= 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 ?>
|
||||
|
||||
@ -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(
|
||||
[
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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([
|
||||
<?= Alert::widget(
|
||||
[
|
||||
'options' => ['class' => 'alert-dismissible alert-' . $type],
|
||||
'body' => $message,
|
||||
]) ?>
|
||||
]
|
||||
) ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
|
||||
@ -24,29 +24,36 @@ use yii\widgets\ActiveForm;
|
||||
|
||||
<?php if ($model->updated): ?>
|
||||
|
||||
<?= Alert::widget([
|
||||
<?= Alert::widget(
|
||||
[
|
||||
'options' => [
|
||||
'class' => 'alert-success',
|
||||
],
|
||||
'body' => Yii::t('usuario', 'Assignments have been updated'),
|
||||
]) ?>
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?php endif ?>
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
<?php $form = ActiveForm::begin(
|
||||
[
|
||||
'enableClientValidation' => false,
|
||||
'enableAjaxValidation' => false,
|
||||
]) ?>
|
||||
]
|
||||
) ?>
|
||||
|
||||
<?= Html::activeHiddenInput($model, 'user_id') ?>
|
||||
|
||||
<?= $form->field($model, 'items')->widget(SelectizeDropDownList::class, [
|
||||
<?= $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']) ?>
|
||||
|
||||
|
||||
@ -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,7 +23,8 @@ use yii\helpers\Html;
|
||||
?>
|
||||
|
||||
<?php if (Yii::$app->user->isGuest): ?>
|
||||
<?php $form = ActiveForm::begin([
|
||||
<?php $form = ActiveForm::begin(
|
||||
[
|
||||
'id' => 'login-widget-form',
|
||||
'action' => Url::to(['/user/security/login']),
|
||||
'enableAjaxValidation' => true,
|
||||
@ -31,7 +32,8 @@ use yii\helpers\Html;
|
||||
'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'], [
|
||||
<?= Html::a(
|
||||
Yii::t('usuario', 'Logout'),
|
||||
['/user/security/logout'],
|
||||
[
|
||||
'class' => 'btn btn-danger btn-block',
|
||||
'data-method' => 'post',
|
||||
]) ?>
|
||||
]
|
||||
) ?>
|
||||
<?php endif ?>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
$db = [
|
||||
'class' => 'yii\db\Connection',
|
||||
'dsn' => 'mysql:host=localhost;dbname=yii2-usuario-test',
|
||||
'dsn' => 'mysql:host=127.0.0.1;dbname=yii2-usuario-test',
|
||||
'username' => 'root',
|
||||
'password' => '',
|
||||
'charset' => 'utf8',
|
||||
|
||||