Commit a9d3c164 authored by Aster's avatar Aster Committed by waltermazza
Browse files

General Bug Fixes and Improvements

parent d8f42441
......@@ -11,13 +11,13 @@ Installation
Either run
```bash
composer require elitedivision/amos-social-auth
composer require arter/amos-social-auth
```
or add
```
"elitedivision/amos-social-auth": "~1.0"
"arter/amos-social-auth": "~1.0"
```
to the require section of your `composer.json` file.
......@@ -28,7 +28,7 @@ Installation
<?php
'modules' => [
'socialauth' => [
'class' => 'elitedivision\amos\socialauth\Module'
'class' => 'arter\amos\socialauth\Module'
],
],
```
......@@ -36,7 +36,7 @@ Installation
3. Apply migrations
```bash
php yii migrate/up --migrationPath=@vendor/elitedivision/amos-social-auth/src/migrations
php yii migrate/up --migrationPath=@vendor/arter/amos-social-auth/src/migrations
```
......@@ -49,7 +49,7 @@ Configuration
<?php
'modules' => [
'socialauth' => [
'class' => 'elitedivision\amos\socialauth\Module',
'class' => 'arter\amos\socialauth\Module',
'enableLogin' => true,
'enableLink' => false,
'enableRegister' => false,
......@@ -98,7 +98,7 @@ To enable social links check in admin configuraion the visibility for box social
```php
$modules['admin'] = [
'class' => 'elitedivision\amos\admin\AmosAdmin',
'class' => 'arter\amos\admin\AmosAdmin',
'enableRegister' => true,
'fieldsConfigurations' => [
'boxes' => [
......
{
"name": "elitedivision/amos-social-auth",
"name": "arter/amos-social-auth",
"description": "Social Auth",
"keywords": ["amos", "auth", "social", "yii2"],
"homepage": "https://bitbucket.org/elite_division/amos-social-auth",
"homepage": "https://bitbucket.org/arter/amos-social-auth",
"type": "component",
"require": {
"php": ">=5.4.0",
"elitedivision/amos-admin":"^2.0.18",
"elitedivision/amos-core":"^1.9.52",
"elitedivision/amos-attachments":"^1.0",
"arter/amos-admin":"^2.0.18",
"arter/amos-core":"^1.9.52",
"arter/amos-attachments":"^1.0",
"hybridauth/hybridauth": "~2.9",
"google/apiclient": "^2.0",
"yiisoft/yii2-authclient": "^2.1.0",
......@@ -16,7 +16,7 @@
},
"autoload": {
"psr-4": {
"elitedivision\\amos\\socialauth\\": "src"
"arter\\amos\\socialauth\\": "src"
}
}
}
\ No newline at end of file
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\socialauth;
namespace arter\amos\socialauth;
use elitedivision\amos\admin\AmosAdmin;
use elitedivision\amos\admin\models\UserProfile;
use elitedivision\amos\core\module\AmosModule;
use elitedivision\amos\socialauth\controllers\ShibbolethController;
use elitedivision\amos\socialauth\models\SocialAuthServices;
use elitedivision\amos\socialauth\utility\SocialAuthUtility;
use arter\amos\admin\AmosAdmin;
use arter\amos\admin\models\UserProfile;
use arter\amos\core\module\AmosModule;
use arter\amos\socialauth\controllers\ShibbolethController;
use arter\amos\socialauth\models\SocialAuthServices;
use arter\amos\socialauth\utility\SocialAuthUtility;
use Yii;
use yii\base\BootstrapInterface;
use yii\base\Event;
......@@ -28,7 +24,7 @@ use yii\helpers\ArrayHelper;
/**
* Class Module
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
*/
class Module extends AmosModule implements BootstrapInterface
{
......@@ -94,7 +90,7 @@ class Module extends AmosModule implements BootstrapInterface
/**
* @inheritdoc
*/
public $controllerNamespace = 'elitedivision\amos\socialauth\controllers';
public $controllerNamespace = 'arter\amos\socialauth\controllers';
public $timeout = 180;
......@@ -121,7 +117,7 @@ class Module extends AmosModule implements BootstrapInterface
public function init()
{
parent::init(); // TODO: Change the autogenerated stub
\Yii::setAlias('@elitedivision/amos/' . static::getModuleName() . '/controllers', __DIR__ . '/controllers');
\Yii::setAlias('@arter/amos/' . static::getModuleName() . '/controllers', __DIR__ . '/controllers');
//Configuration
$config = require(__DIR__ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php');
......@@ -307,7 +303,7 @@ class Module extends AmosModule implements BootstrapInterface
//Init a new shibboleth controller to link user
$shibbolethController = new ShibbolethController('shibboleth', $this);
Event::on(AmosAdmin::instance()->model('UserProfile'), UserProfile::EVENT_AFTER_INSERT, ['elitedivision\amos\socialauth\utility\SocialAuthUtility', 'createIdmUser']);
Event::on(AmosAdmin::instance()->model('UserProfile'), UserProfile::EVENT_AFTER_INSERT, ['arter\amos\socialauth\utility\SocialAuthUtility', 'createIdmUser']);
//Get Session IDM datas (copy of headers)
$sessionIDM = \Yii::$app->session->get('IDM');
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\socialauth\components;
namespace arter\amos\socialauth\components;
use elitedivision\amos\core\icons\AmosIcons;
use elitedivision\amos\socialauth\Module;
use arter\amos\core\icons\AmosIcons;
use arter\amos\socialauth\Module;
use Yii;
use yii\base\Component;
use yii\base\Widget;
......@@ -25,7 +21,7 @@ use yii\helpers\Html;
/**
* Class FileImport
* @package elitedivision\amos\socialauth\components
* @package arter\amos\socialauth\components
*/
class SocialAuthBar extends Widget
{
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\socialauth\components;
namespace arter\amos\socialauth\components;
use elitedivision\amos\core\icons\AmosIcons;
use elitedivision\amos\socialauth\models\SocialAuthUsers;
use elitedivision\amos\socialauth\Module;
use arter\amos\core\icons\AmosIcons;
use arter\amos\socialauth\models\SocialAuthUsers;
use arter\amos\socialauth\Module;
use Yii;
use yii\base\Component;
use yii\base\Widget;
......@@ -26,7 +22,7 @@ use yii\helpers\Html;
/**
* Class FileImport
* @package elitedivision\amos\socialauth\components
* @package arter\amos\socialauth\components
*/
class SocialLinkBar extends Widget
{
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth\components
* @package arter\amos\socialauth\components
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\socialauth\components;
namespace arter\amos\socialauth\components;
use elitedivision\amos\socialauth\Module;
use arter\amos\socialauth\Module;
use Yii;
use yii\base\Widget;
/**
* Class SocialLinkTable
* @package elitedivision\amos\socialauth\components
* @package arter\amos\socialauth\components
*/
class SocialLinkTable extends Widget
{
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\socialauth\components;
namespace arter\amos\socialauth\components;
use elitedivision\amos\core\icons\AmosIcons;
use elitedivision\amos\socialauth\Module;
use arter\amos\core\icons\AmosIcons;
use arter\amos\socialauth\Module;
use Yii;
use yii\base\Component;
use yii\base\Widget;
......@@ -25,7 +21,7 @@ use yii\helpers\Html;
/**
* Class FileImport
* @package elitedivision\amos\socialauth\components
* @package arter\amos\socialauth\components
*/
class SocialSignUpBar extends Widget
{
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
use yii\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons;
use arter\amos\core\icons\AmosIcons;
?>
<div class="social-auth-bar">
<?php
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
use yii\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons;
use elitedivision\amos\socialauth\Module;
use arter\amos\core\icons\AmosIcons;
use arter\amos\socialauth\Module;
?>
<div class="social-auth-bar">
<?php
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
use yii\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons;
use arter\amos\core\icons\AmosIcons;
?>
<div class="social-auth-bar">
<?php
......@@ -47,7 +43,7 @@ use elitedivision\amos\core\icons\AmosIcons;
<button type="button" class="btn btn-social collega-social" data-type="<?= $lowCaseName ?>">
<span class="fa fa-<?= $lowCaseName ?>"></span>
<span>
<?= \elitedivision\amos\socialauth\Module::t('amossocialauth', 'Collega il tuo profilo') ?>
<?= \arter\amos\socialauth\Module::t('amossocialauth', 'Collega il tuo profilo') ?>
</span>
</button>
<?php endif; ?>
......@@ -72,14 +68,14 @@ use elitedivision\amos\core\icons\AmosIcons;
</div>
<div class="field-media">
<label>Email</label>
<span>damian.gomez@elitedivision.it</span>
<span>damian.gomez@arter.it</span>
</div>
</div>
</div>
<?php else: ?>
<div class="validatore_container checkws">
<br>
<?= \elitedivision\amos\socialauth\Module::t('amossocialauth', 'Nessun profilo collegato.') ?>
<?= \arter\amos\socialauth\Module::t('amossocialauth', 'Nessun profilo collegato.') ?>
</div>
<?php endif; ?>
</div>
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
use yii\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons;
use arter\amos\core\icons\AmosIcons;
?>
<div class="social-auth-bar">
<?php
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
return [
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\socialauth\controllers;
namespace arter\amos\socialauth\controllers;
use conquer\oauth2\models\Client;
use elitedivision\amos\admin\models\LoginForm;
use elitedivision\amos\admin\models\UserProfile;
use elitedivision\amos\core\controllers\CrudController;
use elitedivision\amos\core\helpers\Html;
use elitedivision\amos\core\icons\AmosIcons;
use elitedivision\amos\socialauth\models\search\ClientSearch;
use elitedivision\amos\socialauth\Module;
use arter\amos\admin\models\LoginForm;
use arter\amos\admin\models\UserProfile;
use arter\amos\core\controllers\CrudController;
use arter\amos\core\helpers\Html;
use arter\amos\core\icons\AmosIcons;
use arter\amos\socialauth\models\search\ClientSearch;
use arter\amos\socialauth\Module;
use Yii;
use yii\filters\AccessControl;
use yii\web\Response;
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\socialauth\controllers;
namespace arter\amos\socialauth\controllers;
use elitedivision\amos\admin\AmosAdmin;
use elitedivision\amos\admin\models\UserProfile;
use elitedivision\amos\core\controllers\BackendController;
use elitedivision\amos\core\user\User;
use elitedivision\amos\socialauth\models\SocialIdmUser;
use elitedivision\amos\socialauth\Module;
use elitedivision\amos\socialauth\utility\SocialAuthUtility;
use arter\amos\admin\AmosAdmin;
use arter\amos\admin\models\UserProfile;
use arter\amos\core\controllers\BackendController;
use arter\amos\core\user\User;
use arter\amos\socialauth\models\SocialIdmUser;
use arter\amos\socialauth\Module;
use arter\amos\socialauth\utility\SocialAuthUtility;
use Yii;
use yii\base\Action;
use yii\filters\AccessControl;
......@@ -29,7 +25,7 @@ use yii\helpers\Url;
/**
* Class ShibbolethController
* @package elitedivision\amos\socialauth\controllers
* @package arter\amos\socialauth\controllers
*/
class ShibbolethController extends BackendController
{
......@@ -114,7 +110,7 @@ class ShibbolethController extends BackendController
$result = $this->tryIdmLink(false, true, false);
if (is_array($result) && isset($result['status'])) {
$user = \elitedivision\amos\mobile\bridge\modules\v1\models\User::findOne(Yii::$app->user->id);
$user = \arter\amos\mobile\bridge\modules\v1\models\User::findOne(Yii::$app->user->id);
$user->refreshAccessToken('', '');
return $this->redirect(['/socialauth/social-auth/land', 'token' => $user->getAccessToken()]);
......
<?php
/**
* Lombardia Informatica S.p.A.
* OPEN 2.0
* Emilia Romagna Open Innovation
* Arter
*
* @see http://example.com Developers'community
* @license GPLv3
* @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
*
* @package elitedivision\amos\socialauth
* @package arter\amos\socialauth
* @category CategoryName
* @author Lombardia Informatica S.p.A.
*/
namespace elitedivision\amos\socialauth\controllers;
namespace arter\amos\socialauth\controllers;
use elitedivision\amos\admin\AmosAdmin;
use elitedivision\amos\admin\models\UserProfile;
use elitedivision\amos\attachments\components\FileImport;
use elitedivision\amos\core\controllers\BackendController;
use elitedivision\amos\core\user\User;
use elitedivision\amos\mobile\bridge\modules\v1\models\AccessTokens;
use elitedivision\amos\socialauth\models\SocialAuthUsers;
use elitedivision\amos\socialauth\Module;
use arter\amos\admin\AmosAdmin;
use arter\amos\admin\models\UserProfile;
use arter\amos\attachments\components\FileImport;
use arter\amos\core\controllers\BackendController;
use arter\amos\core\user\User;
use arter\amos\mobile\bridge\modules\v1\models\AccessTokens;
use arter\amos\socialauth\models\SocialAuthUsers;
use arter\amos\socialauth\Module;
use Yii;
use yii\base\Exception;
use yii\filters\AccessControl;
......@@ -30,7 +26,7 @@ use yii\helpers\Url;
/**
* Class FileController
* @package elitedivision\amos\socialauth\controllers
* @package arter\amos\socialauth\controllers
*/
class SocialAuthController extends BackendController
{
......@@ -186,7 +182,7 @@ class SocialAuthController extends BackendController
/**
* If the user is already logged in go to home
*/
if (!\elitedivision\amos\core\utilities\CurrentUser::isPlatformGuest() && $redirects) {
if (!\arter\amos\core\utilities\CurrentUser::isPlatformGuest() && $redirects) {
Yii::$app->session->addFlash('danger', Module::t('amossocialauth', 'Already Logged In'));
return $this->goHome();
......@@ -323,7 +319,7 @@ class SocialAuthController extends BackendController
return $this->redirect(['/socialauth/social-auth/land', 'error' => true, 'errorMessage' => Yii::t('socialauth', 'Accesso Social Non Disponibile')]);
}
$q = \elitedivision\amos\mobile\bridge\modules\v1\models\User::find();
$q = \arter\amos\mobile\bridge\modules\v1\models\User::find();
$q->where(['email' => $userProfile->email]);
$q->orWhere(['username' => $userProfile->email]);
......@@ -363,7 +359,7 @@ class SocialAuthController extends BackendController
$community_id = \Yii::$app->request->get('community');
$urlToCommunity = \Yii::$app->getUrlManager()->createUrl(['/community/join', 'id' => $community_id, 'subscribe' => 1]);
if (!\elitedivision\amos\core\utilities\CurrentUser::isPlatformGuest()) {
if (!\arter\amos\core\utilities\CurrentUser::isPlatformGuest()) {
Yii::$app->session->addFlash('danger', Module::t('amossocialauth', 'Already Logged In'));
return $this->goHome();
......@@ -744,7 +740,7 @@ class SocialAuthController extends BackendController
/**
* If the user is already logged in go to home
*/
if (\elitedivision\amos\core\utilities\CurrentUser::isPlatformGuest()) {
if (\arter\amos\core\utilities\CurrentUser::isPlatformGuest()) {