mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
@@ -46,6 +46,8 @@ rewrite ^/prod/notifications/.*$ /prod/router.php last;
|
|||||||
|
|
||||||
rewrite ^/robots.txt$ /index.php last;
|
rewrite ^/robots.txt$ /index.php last;
|
||||||
rewrite ^/feeds/.*$ /index.php last;
|
rewrite ^/feeds/.*$ /index.php last;
|
||||||
|
rewrite ^/account/.*$ /index.php last;
|
||||||
|
rewrite ^/developers/.*$ /index.php last;
|
||||||
|
|
||||||
rewrite ^/lightbox/.*$ /lightbox/index.php last;
|
rewrite ^/lightbox/.*$ /lightbox/index.php last;
|
||||||
rewrite ^/api/v1/.*$ /api/v1/index.php last;
|
rewrite ^/api/v1/.*$ /api/v1/index.php last;
|
||||||
|
@@ -203,206 +203,6 @@ return call_user_func(function() {
|
|||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
/* ****************************************************************
|
|
||||||
* MANAGEMENT APPS
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* list of all authorized apps by logged user
|
|
||||||
*/
|
|
||||||
$route = '/applications';
|
|
||||||
$app->get($route, function() use ($app) {
|
|
||||||
$apps = \API_OAuth2_Application::load_app_by_user($app['appbox'], $app['Core']->getAuthenticatedUser());
|
|
||||||
|
|
||||||
return $app['response']('api/auth/applications.twig', array("apps" => $apps, 'user' => $app['Core']->getAuthenticatedUser()));
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* list of apps created by user
|
|
||||||
*/
|
|
||||||
$route = "/applications/dev";
|
|
||||||
$app->get($route, function() use ($app) {
|
|
||||||
$rs = \API_OAuth2_Application::load_dev_app_by_user($app['appbox'], $app['Core']->getAuthenticatedUser());
|
|
||||||
|
|
||||||
return $app['response']('api/auth/application_dev.twig', array("apps" => $rs));
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* display a new app form
|
|
||||||
*/
|
|
||||||
$route = "/applications/dev/new";
|
|
||||||
$app->get($route, function() use ($app) {
|
|
||||||
$var = array("violations" => null, 'form' => null, 'request' => $app['request']);
|
|
||||||
|
|
||||||
return $app['response']('api/auth/application_dev_new.twig', $var);
|
|
||||||
});
|
|
||||||
|
|
||||||
$route = "/applications/dev/create";
|
|
||||||
$app->post($route, function() use ($app) {
|
|
||||||
$submit = false;
|
|
||||||
if ($app['request']->get("type") == "desktop") {
|
|
||||||
$post = new \API_OAuth2_Form_DevAppDesktop($app['request']);
|
|
||||||
} else {
|
|
||||||
$post = new \API_OAuth2_Form_DevAppInternet($app['request']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$violations = $app['validator']->validate($post);
|
|
||||||
|
|
||||||
if ($violations->count() == 0)
|
|
||||||
$submit = true;
|
|
||||||
|
|
||||||
$request = $app['request'];
|
|
||||||
|
|
||||||
if ($submit) {
|
|
||||||
$application = \API_OAuth2_Application::create($app['appbox'], $app['Core']->getAuthenticatedUser(), $post->getName());
|
|
||||||
$application->set_description($post->getDescription())
|
|
||||||
->set_redirect_uri($post->getSchemeCallback() . $post->getCallback())
|
|
||||||
->set_type($post->getType())
|
|
||||||
->set_website($post->getSchemeWebsite() . $post->getWebsite());
|
|
||||||
|
|
||||||
return $app->redirect("/api/oauthv2/applications/dev/" . $application->get_id() . "/show");
|
|
||||||
}
|
|
||||||
|
|
||||||
$var = array(
|
|
||||||
"violations" => $violations,
|
|
||||||
"form" => $post
|
|
||||||
);
|
|
||||||
return $app['response']('api/auth/application_dev_new.twig', $var);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* show details of app identified by its id
|
|
||||||
*/
|
|
||||||
$route = "/applications/dev/{id}/show";
|
|
||||||
$app->get($route, function($id) use ($app) {
|
|
||||||
$client = new \API_OAuth2_Application($app['appbox'], $id);
|
|
||||||
$token = $client->get_user_account($app['Core']->getAuthenticatedUser())->get_token()->get_value();
|
|
||||||
$var = array("app" => $client, "user" => $app['Core']->getAuthenticatedUser(), "token" => $token);
|
|
||||||
|
|
||||||
return $app['response']('api/auth/application_dev_show.twig', $var);
|
|
||||||
})->assert('id', '\d+');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* revoke access from a user to the app
|
|
||||||
* identified by account id
|
|
||||||
*/
|
|
||||||
$route = "/applications/revoke_access/";
|
|
||||||
$app->post($route, function() use ($app) {
|
|
||||||
$result = array("ok" => false);
|
|
||||||
try {
|
|
||||||
$account = new \API_OAuth2_Account($app['appbox'], $app['request']->get('account_id'));
|
|
||||||
$account->set_revoked((bool) $app['request']->get('revoke'));
|
|
||||||
$result['ok'] = true;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$Serializer = $app['Core']['Serializer'];
|
|
||||||
|
|
||||||
return new Response(
|
|
||||||
$Serializer->serialize($result, 'json')
|
|
||||||
, 200
|
|
||||||
, array("content-type" => "application/json")
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* revoke access from a user to the app
|
|
||||||
* identified by account id
|
|
||||||
*/
|
|
||||||
$route = "/applications/{appId}/grant_password/";
|
|
||||||
$app->post($route, function($appId) use ($app) {
|
|
||||||
$result = array("ok" => false);
|
|
||||||
try {
|
|
||||||
$client = new \API_OAuth2_Application($app['appbox'], $appId);
|
|
||||||
$client->set_grant_password((bool) $app['request']->get('grant'));
|
|
||||||
$result['ok'] = true;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$Serializer = $app['Core']['Serializer'];
|
|
||||||
|
|
||||||
return new Response(
|
|
||||||
$Serializer->serialize($result, 'json')
|
|
||||||
, 200
|
|
||||||
, array("content-type" => "application/json")
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$route = "/applications/{id}/generate_access_token/";
|
|
||||||
$app->post($route, function($id) use ($app) {
|
|
||||||
$result = array("ok" => false);
|
|
||||||
try {
|
|
||||||
$client = new \API_OAuth2_Application($app['appbox'], $id);
|
|
||||||
$account = $client->get_user_account($app['Core']->getAuthenticatedUser());
|
|
||||||
|
|
||||||
$token = $account->get_token();
|
|
||||||
|
|
||||||
if ($token instanceof API_OAuth2_Token)
|
|
||||||
$token->renew();
|
|
||||||
else
|
|
||||||
$token = \API_OAuth2_Token::create($app['appbox'], $account);
|
|
||||||
|
|
||||||
$result = array(
|
|
||||||
"ok" => true
|
|
||||||
, 'token' => $token->get_value()
|
|
||||||
);
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$Serializer = $app['Core']['Serializer'];
|
|
||||||
|
|
||||||
return new Response(
|
|
||||||
$Serializer->serialize($result, 'json')
|
|
||||||
, 200
|
|
||||||
, array("content-type" => "application/json")
|
|
||||||
);
|
|
||||||
})->assert('id', '\d+');
|
|
||||||
|
|
||||||
$route = "/applications/oauth_callback";
|
|
||||||
$app->post($route, function() use ($app) {
|
|
||||||
$app_id = $app['request']->request->get("app_id");
|
|
||||||
$app_callback = $app["request"]->request->get("callback");
|
|
||||||
$result = array("success" => false);
|
|
||||||
try {
|
|
||||||
$client = new \API_OAuth2_Application($app['appbox'], $app_id);
|
|
||||||
$client->set_redirect_uri($app_callback);
|
|
||||||
$result['success'] = true;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$Serializer = $app['Core']['Serializer'];
|
|
||||||
|
|
||||||
return new Response(
|
|
||||||
$Serializer->serialize($result, 'json')
|
|
||||||
, 200
|
|
||||||
, array("content-type" => "application/json")
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
$route = "/applications/{id}";
|
|
||||||
$app->delete($route, function($id) use ($app) {
|
|
||||||
$result = array("success" => false);
|
|
||||||
try {
|
|
||||||
$client = new \API_OAuth2_Application($app['appbox'], $id);
|
|
||||||
$client->delete();
|
|
||||||
$result['success'] = true;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$Serializer = $app['Core']['Serializer'];
|
|
||||||
|
|
||||||
return new Response(
|
|
||||||
$Serializer->serialize($result, 'json')
|
|
||||||
, 200
|
|
||||||
, array("content-type" => "application/json")
|
|
||||||
);
|
|
||||||
})->assert('id', '\d+');
|
|
||||||
/**
|
/**
|
||||||
* *******************************************************************
|
* *******************************************************************
|
||||||
*
|
*
|
||||||
|
@@ -11,8 +11,10 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea\Application;
|
namespace Alchemy\Phrasea\Application;
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Alchemy\Phrasea\Controller\Root as Controller;
|
use Alchemy\Phrasea\Controller\Root as Controller;
|
||||||
|
use Silex\Application as SilexApp;
|
||||||
|
use Silex\Provider\ValidatorServiceProvider;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -20,17 +22,18 @@ use Alchemy\Phrasea\Controller\Root as Controller;
|
|||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
*/
|
*/
|
||||||
return call_user_func(function() {
|
return call_user_func(function() {
|
||||||
$app = new \Silex\Application();
|
$app = new SilexApp();
|
||||||
|
|
||||||
$app['Core'] = \bootstrap::getCore();
|
$app['Core'] = \bootstrap::getCore();
|
||||||
|
$app['debug'] = true;
|
||||||
|
|
||||||
if ( ! \setup::is_installed()) {
|
$app->register(new ValidatorServiceProvider());
|
||||||
$response = new \Symfony\Component\HttpFoundation\RedirectResponse('/setup/');
|
|
||||||
|
|
||||||
return $response->send();
|
$app->before(function () use ($app) {
|
||||||
}
|
$app['Core']['Firewall']->requireSetup($app);
|
||||||
|
});
|
||||||
|
|
||||||
$app->get('/', function() use ($app) {
|
$app->get('/', function(SilexApp $app) {
|
||||||
$browser = \Browser::getInstance();
|
$browser = \Browser::getInstance();
|
||||||
if ($browser->isMobile()) {
|
if ($browser->isMobile()) {
|
||||||
return $app->redirect("/login/?redirect=/lightbox");
|
return $app->redirect("/login/?redirect=/lightbox");
|
||||||
@@ -41,17 +44,12 @@ return call_user_func(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$app->get('/robots.txt', function() use ($app) {
|
$app->get('/robots.txt', function(SilexApp $app) {
|
||||||
$appbox = \appbox::get_instance($app['Core']);
|
|
||||||
|
|
||||||
$registry = $appbox->get_registry();
|
if ($app['Core']['Registry']->get('GV_allow_search_engine') === true) {
|
||||||
|
$buffer = "User-Agent: *\n" . "Allow: /\n";
|
||||||
if ($registry->get('GV_allow_search_engine') === true) {
|
|
||||||
$buffer = "User-Agent: *\n"
|
|
||||||
. "Allow: /\n";
|
|
||||||
} else {
|
} else {
|
||||||
$buffer = "User-Agent: *\n"
|
$buffer = "User-Agent: *\n" . "Disallow: /\n";
|
||||||
. "Disallow: /\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($buffer, 200, array('Content-Type' => 'text/plain'));
|
$response = new Response($buffer, 200, array('Content-Type' => 'text/plain'));
|
||||||
@@ -61,6 +59,8 @@ return call_user_func(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$app->mount('/feeds/', new Controller\RSSFeeds());
|
$app->mount('/feeds/', new Controller\RSSFeeds());
|
||||||
|
$app->mount('/account/', new Controller\Account());
|
||||||
|
$app->mount('/developers/', new Controller\Developers());
|
||||||
|
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
|
646
lib/Alchemy/Phrasea/Controller/Root/Account.php
Normal file
646
lib/Alchemy/Phrasea/Controller/Root/Account.php
Normal file
@@ -0,0 +1,646 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2012 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Controller\Root;
|
||||||
|
|
||||||
|
use Silex\Application;
|
||||||
|
use Silex\ControllerProviderInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
class Account implements ControllerProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function connect(Application $app)
|
||||||
|
{
|
||||||
|
$controllers = $app['controllers_factory'];
|
||||||
|
|
||||||
|
$controllers->before(function() use ($app) {
|
||||||
|
$app['Core']['Firewall']->requireAuthentication($app);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New account route
|
||||||
|
*
|
||||||
|
* name : get_account
|
||||||
|
*
|
||||||
|
* description : Display form to create a new account
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/', $this->call('displayAccount'))
|
||||||
|
->bind('get_account');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create account route
|
||||||
|
*
|
||||||
|
* name : create_account
|
||||||
|
*
|
||||||
|
* description : update your account informations
|
||||||
|
*
|
||||||
|
* method : POST
|
||||||
|
*
|
||||||
|
* parameters :
|
||||||
|
* 'gender'
|
||||||
|
* 'lastname'
|
||||||
|
* 'firstname'
|
||||||
|
* 'job'
|
||||||
|
* 'lastname'
|
||||||
|
* 'company'
|
||||||
|
* 'function'
|
||||||
|
* 'activity'
|
||||||
|
* 'phone'
|
||||||
|
* 'fax'
|
||||||
|
* 'address'
|
||||||
|
* 'zip_code'
|
||||||
|
* 'geoname_id'
|
||||||
|
* 'dest_ftp'
|
||||||
|
* 'default_data_ftp'
|
||||||
|
* 'prefix_ftp_folder'
|
||||||
|
* 'notice'
|
||||||
|
* 'bases'
|
||||||
|
* 'mail_notifications'
|
||||||
|
* 'request_notifications'
|
||||||
|
* 'demand'
|
||||||
|
* 'notifications'
|
||||||
|
* 'active_ftp'
|
||||||
|
* 'address_ftp'
|
||||||
|
* 'login_ftp'
|
||||||
|
* 'password_ftp'
|
||||||
|
* 'pass_if_ftp'
|
||||||
|
* 'retry_ftp'
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->post('/', $this->call('updateAccount'))
|
||||||
|
->bind('create_account');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forgot password
|
||||||
|
*
|
||||||
|
* name : account_forgot_password
|
||||||
|
*
|
||||||
|
* description : Display form to renew password
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/forgot-password/', $this->call('displayForgotPasswordForm'))
|
||||||
|
->bind('account_forgot_password');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renew password
|
||||||
|
*
|
||||||
|
* name : account_renew_password
|
||||||
|
*
|
||||||
|
* description : Register the new user password
|
||||||
|
*
|
||||||
|
* method : POST
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->post('/forgot-password/', $this->call('renewPassword'))
|
||||||
|
->bind('post_account_forgot_password');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Give account access
|
||||||
|
*
|
||||||
|
* name : account_access
|
||||||
|
*
|
||||||
|
* description : Display form to create a new account
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/access/', $this->call('accountAccess'))
|
||||||
|
->bind('account_access');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset user email
|
||||||
|
*
|
||||||
|
* name : account_reset_email
|
||||||
|
*
|
||||||
|
* description : Reset User email
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/register/', $this->call('registerAccount'))
|
||||||
|
->bind('account_register');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset user email
|
||||||
|
*
|
||||||
|
* name : account_reset_email
|
||||||
|
*
|
||||||
|
* description : Reset User email
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/reset-email/', $this->call('resetEmail'))
|
||||||
|
->bind('account_reset_email');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset user password
|
||||||
|
*
|
||||||
|
* name : account_reset_password
|
||||||
|
*
|
||||||
|
* description : Reset user password
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/reset-password/', $this->call('resetPassword'))
|
||||||
|
->bind('account_reset_password');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Give account open sessions
|
||||||
|
*
|
||||||
|
* name : account_security_sessions
|
||||||
|
*
|
||||||
|
* description : Display form to create a new account
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/security/sessions/', $this->call('accountSessionsAccess'))
|
||||||
|
->bind('account_security_sessions');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Give authorized applications that can access user informations
|
||||||
|
*
|
||||||
|
* name : account_security_applications
|
||||||
|
*
|
||||||
|
* description : Display form to create a new account
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/security/applications/', $this->call('accountAuthorizedApps'))
|
||||||
|
->bind('account_security_applications');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grant access to an authorized app
|
||||||
|
*
|
||||||
|
* name : account_security_applications_grant
|
||||||
|
*
|
||||||
|
* description : Display form to create a new account
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/security/application/{application_id}/grant/', $this->call('grantAccess'))
|
||||||
|
->assert('application_id', '\d+')
|
||||||
|
->bind('account_security_applications_grant');
|
||||||
|
|
||||||
|
return $controllers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function registerAccount(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
return new Response($app['Core']['Twig']->render('account/register.html.twig'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resetPassword(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
return new Response($app['Core']['Twig']->render('account/reset-password.html.twig'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resetEmail(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
return new Response($app['Core']['Twig']->render('account/reset-email.html.twig'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit the new password
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function renewPassword(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
$appbox = \appbox::get_instance($app['Core']);
|
||||||
|
|
||||||
|
// send mail
|
||||||
|
if ('' !== $mail = trim($request->get('mail', ''))) {
|
||||||
|
if ( ! \PHPMailer::ValidateAddress($mail)) {
|
||||||
|
return $app->redirect('/account/forgot-password/?error=invalidmail');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$user = \User_Adapter::getInstance(\User_Adapter::get_usr_id_from_email($mail), $appbox);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $app->redirect('/account/forgot-password/?error=noaccount');
|
||||||
|
}
|
||||||
|
|
||||||
|
$token = \random::getUrlToken(\random::TYPE_PASSWORD, $user->get_id(), new \DateTime('+1 day'));
|
||||||
|
|
||||||
|
if ($token) {
|
||||||
|
$url = sprintf('%saccount/forgot-password/?token=%s', $app['Registry']->get('GV_ServerName'), $token);
|
||||||
|
|
||||||
|
if (\mail::forgot_passord($email, $user->get_login(), $url)) {
|
||||||
|
return $app->redirect('/account/forgot-password/?sent=ok');
|
||||||
|
} else {
|
||||||
|
return $app->redirect('/account/forgot-password/?error=mailserver');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $app->redirect('/account/forgot-password/?error=noaccount');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $token = $request->get('token')
|
||||||
|
&& null !== $password = $request->get('form_password')
|
||||||
|
&& null !== $passwordConfirm = $request->get('form_password_confirm')) {
|
||||||
|
|
||||||
|
if ($password !== $passwordConfirm) {
|
||||||
|
|
||||||
|
return $app->redirect('/account/forgot-password/?pass-error=pass-match');
|
||||||
|
} elseif (strlen(trim($password)) < 5) {
|
||||||
|
|
||||||
|
return $app->redirect('/account/forgot-password/?pass-error=pass-short');
|
||||||
|
} elseif (trim($password) != str_replace(array("\r\n", "\n", "\r", "\t", " "), "_", $password)) {
|
||||||
|
|
||||||
|
return $app->redirect('/account/forgot-password/?pass-error=pass-invalid');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$datas = \random::helloToken($token);
|
||||||
|
|
||||||
|
$user = \User_Adapter::getInstance($datas['usr_id'], $appbox);
|
||||||
|
$user->set_password($passwordConfirm);
|
||||||
|
|
||||||
|
\random::removeToken($token);
|
||||||
|
|
||||||
|
return $app->redirect('/login/?confirm=password-update-ok');
|
||||||
|
} catch (\Exception_NotFound $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the fogot password form
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function displayForgotPasswordForm(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
$tokenize = false;
|
||||||
|
$errorMsg = $request->get('error');
|
||||||
|
|
||||||
|
if (null !== $token = $request->get('token')) {
|
||||||
|
try {
|
||||||
|
\random::helloToken($token);
|
||||||
|
$tokenize = true;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$errorMsg = 'token';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $errorMsg) {
|
||||||
|
switch ($errorMsg) {
|
||||||
|
case 'invalidmail':
|
||||||
|
$errorMsg = _('Invalid email address');
|
||||||
|
break;
|
||||||
|
case 'mailserver':
|
||||||
|
$errorMsg = _('phraseanet::erreur: Echec du serveur mail');
|
||||||
|
break;
|
||||||
|
case 'noaccount':
|
||||||
|
$errorMsg = _('phraseanet::erreur: Le compte n\'a pas ete trouve');
|
||||||
|
break;
|
||||||
|
case 'mail':
|
||||||
|
$errorMsg = _('phraseanet::erreur: Echec du serveur mail');
|
||||||
|
break;
|
||||||
|
case 'token':
|
||||||
|
$errorMsg = _('phraseanet::erreur: l\'url n\'est plus valide');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $sentMsg = $request->get('sent')) {
|
||||||
|
switch ($sentMsg) {
|
||||||
|
case 'ok':
|
||||||
|
$sentMsg = _('phraseanet:: Un email vient de vous etre envoye');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null !== $passwordMsg = $request->get('pass-error')) {
|
||||||
|
switch ($sentMsg) {
|
||||||
|
case 'pass-match':
|
||||||
|
$sentMsg = _('forms::les mots de passe ne correspondent pas');
|
||||||
|
break;
|
||||||
|
case 'pass-short':
|
||||||
|
$sentMsg = _('forms::la valeur donnee est trop courte');
|
||||||
|
break;
|
||||||
|
case 'pass-invalid':
|
||||||
|
$sentMsg = _('forms::la valeur donnee contient des caracteres invalides');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response($app['Core']['Twig']->render('account/forgot-password.html.twig', array(
|
||||||
|
'needed' => array(),
|
||||||
|
'tokenize' => $tokenize,
|
||||||
|
'passwordMsg' => $passwordMsg,
|
||||||
|
'errorMsg' => $errorMsg,
|
||||||
|
'sentMsg' => $sentMsg
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display authorized applications that can access user informations
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function grantAccess(Application $app, Request $request, $application_id)
|
||||||
|
{
|
||||||
|
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||||
|
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance($app['Core']);
|
||||||
|
$error = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$account = \API_OAuth2_Account::load_with_user(
|
||||||
|
$appbox
|
||||||
|
, new \API_OAuth2_Application($appbox, $application_id)
|
||||||
|
, $app['Core']->getAuthenticatedUser()
|
||||||
|
);
|
||||||
|
} catch (\Exception_NotFound $e) {
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$account->set_revoked((bool) $request->get('revoke'), false);
|
||||||
|
|
||||||
|
return new JsonResponse(array('success' => ! $error));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display authorized applications that can access user informations
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function accountAuthorizedApps(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
|
||||||
|
return $app['Core']['Twig']->render('account/authorized_apps.html.twig', array(
|
||||||
|
"apps" => \API_OAuth2_Application::load_app_by_user(\appbox::get_instance($app['Core']), $user),
|
||||||
|
'user' => $user
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display account session accesss
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function accountSessionsAccess(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
return new Response($app['Core']['Twig']->render('account/sessions.html.twig'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display account base access
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function accountAccess(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
require_once $app['Core']['Registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php';
|
||||||
|
|
||||||
|
return new Response($app['Core']['Twig']->render('account/access.html.twig', array(
|
||||||
|
'inscriptions' => giveMeBases($app['Core']->getAuthenticatedUser()->get_id())
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display account form
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function displayAccount(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
$appbox = \appbox::get_instance($app['Core']);
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
$evtMngr = \eventsmanager_broker::getInstance($appbox, $app['Core']);
|
||||||
|
|
||||||
|
switch ($notice = $request->get('notice', '')) {
|
||||||
|
case 'password-update-ok':
|
||||||
|
$notice = _('login::notification: Mise a jour du mot de passe avec succes');
|
||||||
|
break;
|
||||||
|
case 'account-update-ok':
|
||||||
|
$notice = _('login::notification: Changements enregistres');
|
||||||
|
break;
|
||||||
|
case 'account-update-bad':
|
||||||
|
$notice = _('forms::erreurs lors de l\'enregistrement des modifications');
|
||||||
|
break;
|
||||||
|
case 'demand-ok':
|
||||||
|
$notice = _('login::notification: Vos demandes ont ete prises en compte');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response($app['Core']['Twig']->render('account/account.html.twig', array(
|
||||||
|
'geonames' => new \geonames(),
|
||||||
|
'user' => $user,
|
||||||
|
'notice' => $notice,
|
||||||
|
'evt_mngr' => $evtMngr,
|
||||||
|
'notifications' => $evtMngr->list_notifications_available($user->get_id()),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update account informations
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function updateAccount(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
$appbox = \appbox::get_instance($app['Core']);
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
$evtMngr = \eventsmanager_broker::getInstance($appbox, $app['Core']);
|
||||||
|
$notice = 'account-update-bad';
|
||||||
|
|
||||||
|
$demands = (array) $request->get('demand', array());
|
||||||
|
|
||||||
|
if (0 === count($demands)) {
|
||||||
|
$register = new \appbox_register($appbox);
|
||||||
|
|
||||||
|
foreach ($demands as $baseId) {
|
||||||
|
try {
|
||||||
|
$register->add_request($user, \collection::get_from_base_id($baseId));
|
||||||
|
$notice = 'demand-ok';
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$accountFields = array(
|
||||||
|
'form_gender',
|
||||||
|
'form_firstname',
|
||||||
|
'form_lastname',
|
||||||
|
'form_address',
|
||||||
|
'form_zip',
|
||||||
|
'form_phone',
|
||||||
|
'form_fax',
|
||||||
|
'form_function',
|
||||||
|
'form_company',
|
||||||
|
'form_activity',
|
||||||
|
'form_geonameid',
|
||||||
|
'form_addrFTP',
|
||||||
|
'form_loginFTP',
|
||||||
|
'form_pwdFTP',
|
||||||
|
'form_destFTP',
|
||||||
|
'form_prefixFTPfolder'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (0 === count(array_diff($accountFields, array_keys($request->request->all())))) {
|
||||||
|
$defaultDatas = 0;
|
||||||
|
|
||||||
|
if ($datas = (array) $request->get("form_defaultdataFTP", array())) {
|
||||||
|
if (in_array('document', $datas)) {
|
||||||
|
$defaultDatas += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('preview', $datas)) {
|
||||||
|
$defaultDatas += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array('caption', $datas)) {
|
||||||
|
$defaultDatas += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$appbox->get_connection()->beginTransaction();
|
||||||
|
|
||||||
|
$user->set_gender($request->get("form_gender"))
|
||||||
|
->set_firstname($request->get("form_firstname"))
|
||||||
|
->set_lastname($request->get("form_lastname"))
|
||||||
|
->set_address($request->get("form_address"))
|
||||||
|
->set_zip($request->get("form_zip"))
|
||||||
|
->set_tel($request->get("form_phone"))
|
||||||
|
->set_fax($request->get("form_fax"))
|
||||||
|
->set_job($request->get("form_activity"))
|
||||||
|
->set_company($request->get("form_company"))
|
||||||
|
->set_position($request->get("form_function"))
|
||||||
|
->set_geonameid($request->get("form_geonameid"))
|
||||||
|
->set_mail_notifications((bool) $request->get("mail_notifications"))
|
||||||
|
->set_activeftp($request->get("form_activeFTP"))
|
||||||
|
->set_ftp_address($request->get("form_addrFTP"))
|
||||||
|
->set_ftp_login($request->get("form_loginFTP"))
|
||||||
|
->set_ftp_password($request->get("form_pwdFTP"))
|
||||||
|
->set_ftp_passif($request->get("form_passifFTP"))
|
||||||
|
->set_ftp_dir($request->get("form_destFTP"))
|
||||||
|
->set_ftp_dir_prefix($request->get("form_prefixFTPfolder"))
|
||||||
|
->set_defaultftpdatas($defaultDatas);
|
||||||
|
|
||||||
|
$appbox->get_connection()->commit();
|
||||||
|
|
||||||
|
$notice = 'account-update-ok';
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$appbox->get_connection()->rollBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$requestedNotifications = (array) $request->get('notifications', array());
|
||||||
|
|
||||||
|
foreach ($evtMngr->list_notifications_available($user->get_id()) as $notifications) {
|
||||||
|
foreach ($notifications as $notification) {
|
||||||
|
$notifId = (int) $notification['id'];
|
||||||
|
$notifName = sprintf('notification_%d', $notifId);
|
||||||
|
|
||||||
|
if (isset($requestedNotifications[$notifId])) {
|
||||||
|
$user->setPrefs($notifName, '1');
|
||||||
|
} else {
|
||||||
|
$user->setPrefs($notifName, '0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $app->redirect(sprintf('/account/?notice=%s', $notice), 201);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix the method to call with the controller class name
|
||||||
|
*
|
||||||
|
* @param string $method The method to call
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function call($method)
|
||||||
|
{
|
||||||
|
return sprintf('%s::%s', __CLASS__, $method);
|
||||||
|
}
|
||||||
|
}
|
416
lib/Alchemy/Phrasea/Controller/Root/Developers.php
Normal file
416
lib/Alchemy/Phrasea/Controller/Root/Developers.php
Normal file
@@ -0,0 +1,416 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2012 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Controller\Root;
|
||||||
|
|
||||||
|
use Silex\Application;
|
||||||
|
use Silex\ControllerProviderInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
|
* @link www.phraseanet.com
|
||||||
|
*/
|
||||||
|
class Developers implements ControllerProviderInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
public function connect(Application $app)
|
||||||
|
{
|
||||||
|
$controllers = $app['controllers_factory'];
|
||||||
|
|
||||||
|
$controllers->before(function() use ($app) {
|
||||||
|
$app['Core']['Firewall']->requireAuthentication($app);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of apps created by the user
|
||||||
|
*
|
||||||
|
* name : developers_applications
|
||||||
|
*
|
||||||
|
* description : List all user applications
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/applications/', $this->call('listApps'))
|
||||||
|
->bind('developers_applications');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the form to create a new application
|
||||||
|
*
|
||||||
|
* name : developers_application_new
|
||||||
|
*
|
||||||
|
* description : Display form to create a new user application
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/application/new/', $this->call('displayFormApp'))
|
||||||
|
->bind('developers_application_new');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new app
|
||||||
|
*
|
||||||
|
* name : developers_application
|
||||||
|
*
|
||||||
|
* description : POST request to create a new user app
|
||||||
|
*
|
||||||
|
* method : POST
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->post('/application/', $this->call('newApp'))
|
||||||
|
->bind('developers_application');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get application information
|
||||||
|
*
|
||||||
|
* name : developers_application
|
||||||
|
*
|
||||||
|
* description : Get application information
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->get('/application/{id}/', $this->call('getApp'))
|
||||||
|
->assert('id', '\d+')
|
||||||
|
->bind('developers_application');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete application
|
||||||
|
*
|
||||||
|
* name : delete_developers_application
|
||||||
|
*
|
||||||
|
* description : Delete selected application
|
||||||
|
*
|
||||||
|
* method : GET
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->delete('/application/{id}/', $this->call('deleteApp'))
|
||||||
|
->assert('id', '\d+')
|
||||||
|
->bind('delete_developers_application');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allow authentification paswword grant method
|
||||||
|
*
|
||||||
|
* name : developers_application_authorize_grant_password
|
||||||
|
*
|
||||||
|
* description : Authorize application to use a grant password type, which allow end user to
|
||||||
|
* authenticate himself with their credentials (login/password)
|
||||||
|
*
|
||||||
|
* method : POST
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->post('/application/{id}/authorize_grant_password/', $this->call('authorizeGrantpassword'))
|
||||||
|
->assert('id', '\d+')
|
||||||
|
->bind('developers_application_authorize_grant_password');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renew access token
|
||||||
|
*
|
||||||
|
* name : developers_application_token
|
||||||
|
*
|
||||||
|
* description : Regenerate an access token for the current app linked to the authenticated user
|
||||||
|
*
|
||||||
|
* method : POST
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->post('/application/{id}/access_token/', $this->call('renewAccessToken'))
|
||||||
|
->assert('id', '\d+')
|
||||||
|
->bind('developers_application_token');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update application callback
|
||||||
|
*
|
||||||
|
* name : application_callback
|
||||||
|
*
|
||||||
|
* description : Change callback used by application
|
||||||
|
*
|
||||||
|
* method : POST
|
||||||
|
*
|
||||||
|
* parameters : none
|
||||||
|
*
|
||||||
|
* return : HTML Response
|
||||||
|
*/
|
||||||
|
$controllers->post('/application/{id}/callback/', $this->call('renewAppCallback'))
|
||||||
|
->assert('id', '\d+')
|
||||||
|
->bind('application_callback');
|
||||||
|
|
||||||
|
return $controllers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete application
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
* @param integer $id The application id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function deleteApp(Application $app, Request $request, $id)
|
||||||
|
{
|
||||||
|
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||||
|
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$error = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$clientApp = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
|
||||||
|
$clientApp->delete();
|
||||||
|
} catch (\Exception_NotFound $e) {
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new JsonResponse(array('success' => ! $error));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change application callback
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
* @param integer $id The application id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function renewAppCallback(Application $app, Request $request, $id)
|
||||||
|
{
|
||||||
|
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||||
|
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$error = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$clientApp = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
|
||||||
|
|
||||||
|
if ($callback = $request->get("callback")) {
|
||||||
|
$clientApp->set_redirect_uri($callback);
|
||||||
|
} else {
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
} catch (\Exception_NotFound $e) {
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new JsonResponse(array('success' => ! $error));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authorize application to use a grant password type
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
* @param integer $id The application id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function renewAccessToken(Application $app, Request $request, $id)
|
||||||
|
{
|
||||||
|
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||||
|
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$appbox = \appbox::get_instance($app['Core']);
|
||||||
|
$error = false;
|
||||||
|
$accessToken = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$clientApp = new \API_OAuth2_Application($appbox, $id);
|
||||||
|
$account = $clientApp->get_user_account($app['Core']->getAuthenticatedUser());
|
||||||
|
|
||||||
|
$token = $account->get_token();
|
||||||
|
|
||||||
|
if ($token instanceof \API_OAuth2_Token) {
|
||||||
|
$token->renew();
|
||||||
|
} else {
|
||||||
|
$token = \API_OAuth2_Token::create($appbox, $account);
|
||||||
|
}
|
||||||
|
|
||||||
|
$accessToken = $token->get_value();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new JsonResponse(array('success' => ! $error, 'token' => $accessToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authorize application to use a grant password type
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
* @param integer $id The application id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function authorizeGrantpassword(Application $app, Request $request, $id)
|
||||||
|
{
|
||||||
|
if ( ! $request->isXmlHttpRequest() || ! array_key_exists($request->getMimeType('json'), array_flip($request->getAcceptableContentTypes()))) {
|
||||||
|
$app->abort(400, _('Bad request format, only JSON is allowed'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$error = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$clientApp = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
|
||||||
|
} catch (\Exception_NotFound $e) {
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$clientApp->set_grant_password((bool) $request->get('grant', false));
|
||||||
|
|
||||||
|
return new JsonResponse(array('success' => ! $error));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new developer applications
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function newApp(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
$error = false;
|
||||||
|
|
||||||
|
if ($request->get("type") == "desktop") {
|
||||||
|
$form = new \API_OAuth2_Form_DevAppDesktop($app['request']);
|
||||||
|
} else {
|
||||||
|
$form = new \API_OAuth2_Form_DevAppInternet($app['request']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$violations = $app['validator']->validate($form);
|
||||||
|
|
||||||
|
if ($violations->count() == 0) {
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
$application = \API_OAuth2_Application::create(\appbox::get_instance($app['Core']), $app['Core']->getAuthenticatedUser(), $form->getName());
|
||||||
|
$application
|
||||||
|
->set_description($form->getDescription())
|
||||||
|
->set_redirect_uri($form->getSchemeCallback() . $form->getCallback())
|
||||||
|
->set_type($form->getType())
|
||||||
|
->set_website($form->getSchemeWebsite() . $form->getWebsite());
|
||||||
|
|
||||||
|
return $app->redirect(sprintf('/developers/application/%d/', $application->get_id()));
|
||||||
|
}
|
||||||
|
|
||||||
|
$var = array(
|
||||||
|
"violations" => $violations,
|
||||||
|
"form" => $form
|
||||||
|
);
|
||||||
|
|
||||||
|
return $app['Core']['Twig']->render('/developers/application.html.twig', $var);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of apps created by the user
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function listApps(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
return $app['Core']['Twig']->render('developers/applications.html.twig', array(
|
||||||
|
"apps" => \API_OAuth2_Application::load_dev_app_by_user(
|
||||||
|
\appbox::get_instance($app['Core']), $app['Core']->getAuthenticatedUser()
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display form application
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function displayFormApp(Application $app, Request $request)
|
||||||
|
{
|
||||||
|
return $app['Core']['Twig']->render('developers/application_form.html.twig', array(
|
||||||
|
"violations" => null,
|
||||||
|
'form' => null,
|
||||||
|
'request' => $request
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get application information
|
||||||
|
*
|
||||||
|
* @param Application $app A Silex application where the controller is mounted on
|
||||||
|
* @param Request $request The current request
|
||||||
|
* @param integer $id The application id
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function getApp(Application $app, Request $request, $id)
|
||||||
|
{
|
||||||
|
$user = $app['Core']->getAuthenticatedUser();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$client = new \API_OAuth2_Application(\appbox::get_instance($app['Core']), $id);
|
||||||
|
} catch (\Exception_NotFound $e) {
|
||||||
|
$app->abort(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$token = $client->get_user_account($user)->get_token()->get_value();
|
||||||
|
|
||||||
|
return $app['Core']['Twig']->render('developers/application.html.twig', array(
|
||||||
|
"app" => $client,
|
||||||
|
"user" => $user,
|
||||||
|
"token" => $token
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prefix the method to call with the controller class name
|
||||||
|
*
|
||||||
|
* @param string $method The method to call
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function call($method)
|
||||||
|
{
|
||||||
|
return sprintf('%s::%s', __CLASS__, $method);
|
||||||
|
}
|
||||||
|
}
|
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Alchemy\Phrasea;
|
namespace Alchemy\Phrasea;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Core\Configuration;
|
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\Serializer;
|
use Symfony\Component\Serializer;
|
||||||
@@ -102,6 +101,10 @@ class Core extends \Pimple
|
|||||||
return new \Alchemy\Phrasea\Cache\Manager($core, $file);
|
return new \Alchemy\Phrasea\Cache\Manager($core, $file);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$this['Firewall'] = $this->share(function() {
|
||||||
|
return new Security\Firewall();
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Entity Manager using configuration
|
* Set Entity Manager using configuration
|
||||||
*/
|
*/
|
||||||
|
@@ -138,6 +138,7 @@ class Twig extends ServiceAbstract
|
|||||||
$this->twig->addFilter('prettyDate', new \Twig_Filter_Function('phraseadate::getPrettyString'));
|
$this->twig->addFilter('prettyDate', new \Twig_Filter_Function('phraseadate::getPrettyString'));
|
||||||
$this->twig->addFilter('formatOctets', new \Twig_Filter_Function('p4string::format_octets'));
|
$this->twig->addFilter('formatOctets', new \Twig_Filter_Function('p4string::format_octets'));
|
||||||
$this->twig->addFilter('geoname_name_from_id', new \Twig_Filter_Function('geonames::name_from_id'));
|
$this->twig->addFilter('geoname_name_from_id', new \Twig_Filter_Function('geonames::name_from_id'));
|
||||||
|
$this->twig->addFilter('base_from_coll', new \Twig_Filter_Function('phrasea::baseFromColl'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDefaultTemplatePath()
|
private function getDefaultTemplatePath()
|
||||||
|
37
lib/Alchemy/Phrasea/Security/Firewall.php
Normal file
37
lib/Alchemy/Phrasea/Security/Firewall.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Alchemy\Phrasea\Security;
|
||||||
|
|
||||||
|
use Silex\Application;
|
||||||
|
|
||||||
|
class Firewall
|
||||||
|
{
|
||||||
|
|
||||||
|
public function requireSetUp(Application $app)
|
||||||
|
{
|
||||||
|
if ( ! \setup::is_installed()) {
|
||||||
|
return $app->redirect("/setup/");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function requireAuthentication(Application $app)
|
||||||
|
{
|
||||||
|
if ($app['Core']->isAuthenticated()) {
|
||||||
|
try {
|
||||||
|
$session = \appbox::get_instance($app['Core'])->get_session();
|
||||||
|
$session->open_phrasea_session();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
return $app->redirect('/login/logout.php');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return $app->redirect('/login/');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($app['Core']->getAuthenticatedUser()->is_guest()) {
|
||||||
|
|
||||||
|
return $app->redirect('/login/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -281,8 +281,9 @@ class API_OAuth2_Account
|
|||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
if ( ! $row)
|
if ( ! $row) {
|
||||||
throw new Exception_NotFound();
|
throw new Exception_NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
return new self($appbox, $row['api_account_id']);
|
return new self($appbox, $row['api_account_id']);
|
||||||
}
|
}
|
||||||
|
@@ -145,6 +145,11 @@ class API_OAuth2_Application
|
|||||||
|
|
||||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':application_id' => $this->id));
|
$stmt->execute(array(':application_id' => $this->id));
|
||||||
|
|
||||||
|
if (0 === $stmt->rowCount()) {
|
||||||
|
throw new \Exception_NotFound(sprintf('Application with id %d not found', $this->id));
|
||||||
|
}
|
||||||
|
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
$this->creator = ! $row['creator'] ? null : User_Adapter::getInstance($row['creator'], $this->appbox);
|
$this->creator = ! $row['creator'] ? null : User_Adapter::getInstance($row['creator'], $this->appbox);
|
||||||
|
@@ -594,6 +594,8 @@ class Session_Handler
|
|||||||
}
|
}
|
||||||
$rs[$k]['session_id'] = (int) $rs[$k]['session_id'];
|
$rs[$k]['session_id'] = (int) $rs[$k]['session_id'];
|
||||||
$rs[$k]['ip_infos'] = $infos;
|
$rs[$k]['ip_infos'] = $infos;
|
||||||
|
$rs[$k]['created_on'] = new \DateTime($row['created_on']);;
|
||||||
|
$rs[$k]['lastaccess'] = new \DateTime($row['lastaccess']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $rs;
|
return $rs;
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<ul data-role="listview">
|
<ul data-role="listview">
|
||||||
<li>
|
<li>
|
||||||
<a href="/login/forgotpwd.php" rel="external">
|
<a href="/account/forgot-password/" rel="external">
|
||||||
{% trans 'login:: Forgot your password' %}
|
{% trans 'login:: Forgot your password' %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
168
templates/web/account/access.html.twig
Normal file
168
templates/web/account/access.html.twig
Normal file
@@ -0,0 +1,168 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form name="updatingDemand" id="updatingDemand" action="/account/" method="post">
|
||||||
|
<table border="0" style="table-layout: fixed; font-size: 11px;" cellspacing=0 width="100%">
|
||||||
|
<tr>
|
||||||
|
<td style="width: 180px; text-align: right"> </td>
|
||||||
|
<td width="15px" style="width: 15px"> </td>
|
||||||
|
<td style="width: 180px;"> </td>
|
||||||
|
</tr>
|
||||||
|
{% for sbasId, baseInsc in inscriptions %}
|
||||||
|
{% if baseInsc['CollsRegistered'] or baseInsc['CollsRefuse'] or baseInsc['CollsWait'] or baseInsc['CollsIntime'] or baseInsc['CollsOuttime'] or baseInsc['CollsNonactif'] or baseInsc['CollsCGU'] or baseInsc['Colls'] %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;"><h3>{{ sbasId | sbas_names }}</h3></td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if baseInsc['CollsRegistered'] is not none %}
|
||||||
|
{% for base in baseInsc['CollsRegistered']%}
|
||||||
|
{% for collId, isTrue in base %}
|
||||||
|
{{ base_id == sbasId |base_from_coll(collId) }}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align:center;">
|
||||||
|
{% trans 'login::register: acces authorise sur la collection ' %}{{ sbasId |sbas_names }}
|
||||||
|
{% if isTrue | trim != '' %}
|
||||||
|
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
<tr style="height: 5px;">
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if baseInsc['CollsRefuse'] %}
|
||||||
|
{% for collId, isTrue in baseInsc['CollsRefuse'] %}
|
||||||
|
{{ base_id == sbasId |base_from_coll(collId) }}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">
|
||||||
|
<span style="color: red;">{% trans 'login::register: acces refuse sur la collection ' %}{{ sbasId |sbas_names }}</span>
|
||||||
|
{% if isTrue | trim != '' %}
|
||||||
|
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
<tr style="height: 5px;">
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if baseInsc['CollsWait'] %}
|
||||||
|
{% for collId, isTrue in baseInsc['CollsWait'] %}
|
||||||
|
{{ base_id == sbasId |base_from_coll(collId) }}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">
|
||||||
|
<span style="color: orange;">{% trans 'login::register: en attente d\'acces sur' %} {{ sbasId |sbas_names }}</span>
|
||||||
|
{% if isTrue | trim != '' %}
|
||||||
|
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
<tr style="height: 5px;"><td></td></tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if baseInsc['CollsIntime'] %}
|
||||||
|
{% for collId, isTrue in baseInsc['CollsIntime'] %}
|
||||||
|
{{ base_id == sbasId |base_from_coll(collId) }}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">
|
||||||
|
<span>{% trans 'login::register: acces temporaire sur' %} {{ sbasId |sbas_names }}</span>
|
||||||
|
{% if isTrue |trim != '' %}
|
||||||
|
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
<tr style="height: 5px;"><td></td></tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if baseInsc['CollsOuttime'] %}
|
||||||
|
{% for collId, isTrue in baseInsc['CollsOuttime'] %}
|
||||||
|
{{ base_id == sbasId |base_from_coll(collId) }}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">
|
||||||
|
<span style="color:red;">{% trans 'login::register: acces temporaire termine sur ' %}{{ sbasId |sbas_names }}</span>
|
||||||
|
{% if isTrue |trim != '' %}
|
||||||
|
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
<tr style="height: 5px;"><td></td></tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if baseInsc['CollsNonactif'] %}
|
||||||
|
{% for collId, isTrue in baseInsc['CollsNonactif'] %}
|
||||||
|
{{ base_id == (sbasId |base_from_coll(collId)) }}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">
|
||||||
|
<span style="color:red;">{% trans 'login::register: acces supendu sur' %} {{ sbasId |sbas_names }}</span>
|
||||||
|
{% if isTrue |trim != '' %}
|
||||||
|
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{sbasId}}&col='{{collId}}">{% trans 'login::register::CGU: lire les CGU' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
<tr style="height: 5px;"><td></td></tr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if (baseInsc['CollsCGU'] or baseInsc['Colls']) and baseInsc['inscript'] %}
|
||||||
|
{{ noDemand == false }}
|
||||||
|
{% if baseInsc['Colls'] %}
|
||||||
|
{% if baseInsc['CGU'] %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">{% trans 'login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes' %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;"><div style="width: 90%; height: 120px; text-align: left; overflow: auto;">{{ baseInsc['CGU'] }}</div></td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% for collId, collName in baseInsc['Colls'] %}
|
||||||
|
{{ base_id == sbasId |base_from_coll(collId) }}
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: right;">{{ collName }}</td>
|
||||||
|
<td></td>
|
||||||
|
<td class="TD_R" style="width: 200px;">
|
||||||
|
<input style="width: 15px;" class="checkbox" type="checkbox" name="demand[]" value="{{ base_id }}" />
|
||||||
|
<span>{% trans 'login::register: Faire une demande d\'acces' %}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% if baseInsc['CollsCGU'] %}
|
||||||
|
{% for collId, collDesc in baseInsc['CollsCGU'] %}
|
||||||
|
{{ base_id == sbasId |base_from_coll(collId) }}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;"><hr style="width: 80%"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">{% trans 'login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes' %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">
|
||||||
|
<div style="width: 90%; height: 120px; text-align: left; overflow: auto;">{{ collDesc['CGU'] }}</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: right;">{{ collDesc['name'] }}</td>
|
||||||
|
<td></td>
|
||||||
|
<td class="TD_R" style="width: 200px;">
|
||||||
|
<input style="width: 15px;" class="checkbox" type="checkbox" name="demand[]" value="{{ base_id }}" />
|
||||||
|
<span>{% trans 'login::register: Faire une demande d\'acces' %}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<input type="submit" class="btn btn-info" value="{% trans 'boutton::valider' %}"/>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
224
templates/web/account/account.html.twig
Normal file
224
templates/web/account/account.html.twig
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<script type="text/javascript" src="/login/geonames.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
initialize_geoname_field($('#form_geonameid'));
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans 'login:: Mon compte' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<table style="width: 100%">
|
||||||
|
<tr valign="top">
|
||||||
|
<td>
|
||||||
|
{% if notice | trim != '' %}
|
||||||
|
<div class="notice alert alert-error">{{ notice }}</div>
|
||||||
|
{% endif %}
|
||||||
|
<form name="account" id="account" class="form-horizontal" action="/account/" method="post">
|
||||||
|
<fieldset>
|
||||||
|
|
||||||
|
<legend>{% trans 'Informations personnelles' %}</legend>
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<p><a href="/account/reset-password/" target="_self">{% trans 'admin::compte-utilisateur changer mon mot de passe' %}</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_login">{% trans 'admin::compte-utilisateur identifiant' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<p>{{ user.get_login() }}</p>
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_gender">{% trans 'admin::compte-utilisateur sexe' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<select>
|
||||||
|
<option {% if user.get_gender() == "0" %}selected{% endif %} value="0" >
|
||||||
|
{% trans 'admin::compte-utilisateur:sexe: mademoiselle' %}
|
||||||
|
</option>
|
||||||
|
<option {% if user.get_gender() == "1" %}selected{% endif %} value="1" >
|
||||||
|
{% trans 'admin::compte-utilisateur:sexe: madame' %}
|
||||||
|
</option>
|
||||||
|
<option {% if user.get_gender() == "2" %}selected{% endif %} value="2" >
|
||||||
|
{% trans 'admin::compte-utilisateur:sexe: monsieur' %}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_lastname">{% trans 'admin::compte-utilisateur nom' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_lastname" id="form_lastname" value="{{ user.get_lastname() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_firstname">{% trans 'admin::compte-utilisateur prenom' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_firstname" id="form_firstname" value="{{ user.get_firstname() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_firstname">{% trans 'admin::compte-utilisateur email' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<p>{{ user.get_email() }} <a href="/account/reset-email/" target="_self">{% trans 'login:: Changer mon adresse email' %}</a></p>
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_address">{% trans 'admin::compte-utilisateur adresse' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_address" id="form_address" value="{{ user.get_address() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_zip">{% trans 'admin::compte-utilisateur code postal' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_zip" id="form_zip" value="{{ user.get_zipcode() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_city">{% trans 'admin::compte-utilisateur ville' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element geoname_field" type="text" name="form_geonameid" id="form_geonameid" geonameid="{{ user.get_geonameid() }}" value="{{ geonames.name_from_id(user.get_geonameid()) }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label"></label>
|
||||||
|
<div class="controls">
|
||||||
|
<div id="test_city" style="position: absolute; width: 200px; max-height: 200px; overflow-y: auto; z-index: 99999;"></div>
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_function">{% trans 'admin::compte-utilisateur poste' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_function" id="form_function" value="{{ user.get_position() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_company">{% trans 'admin::compte-utilisateur societe' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_company" id="form_company" value="{{ user.get_company() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_activity">{% trans 'admin::compte-utilisateur activite' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_activity" id="form_activity" value="{{ user.get_job() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_phone">{% trans 'admin::compte-utilisateur telephone' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_phone" id="form_phone" value="{{ user.get_tel() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_fax">{% trans 'admin::compte-utilisateur fax' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_fax" id="form_fax" value="{{ user.get_fax() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<legend>{% trans 'Notification par email' %}</legend>
|
||||||
|
{% for notification_group, nots in notifications%}
|
||||||
|
<p style="font-weight: bold;">{{ notification_group }}</p>
|
||||||
|
{% for notification in nots %}
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label"></label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="checkbox" for="notif_{{ notification['id'] }}">
|
||||||
|
<input type="checkbox" id="notif_{{ notification['id'] }}" name="notifications[{{ notification['id'] }}]" {% if not user.getPrefs('notification_' ~ notification['id']) == '0' %}checked{% endif %} value="1"/>
|
||||||
|
{{ notification['description'] }}
|
||||||
|
</label>
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<legend>{% trans 'FTP' %}</legend>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_activeFTP">{% trans 'admin::compte-utilisateur:ftp: Activer le compte FTP' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="checkbox" name="form_activeFTP" id="form_activeFTP" {% if user.get_activeftp() %}checked{% endif %} onchange="if(this.checked){$('#ftpinfos').slideDown();}else{$('#ftpinfos').slideUp();}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="ftpinfos" style="display: {% if user.get_activeftp() %}block{% else %}none{% endif %}">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_addrFTP">{% trans 'phraseanet:: adresse' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_addrFTP" id="form_addrFTP" value="{{ user.get_ftp_address() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_loginFTP">{% trans 'admin::compte-utilisateur identifiant' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_loginFTP" id="form_loginFTP" value="{{ user.get_ftp_login() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_pwdFTP">{% trans 'admin::compte-utilisateur mot de passe' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_pwdFTP" id="form_pwdFTP" value="{{ user.get_ftp_password() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_destFTP">{% trans 'admin::compte-utilisateur:ftp: repertoire de destination ftp' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_destFTP" id="form_destFTP" value="{{ user.get_ftp_dir() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_prefixFTPfolder">{% trans 'admin::compte-utilisateur:ftp: prefixe des noms de dossier ftp' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_prefixFTPfolder" id="form_prefixFTPfolder" value="{{ user.get_ftp_dir_prefix() }}" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_passifFTP">{% trans 'admin::compte-utilisateur:ftp: Utiliser le mode passif' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="checkbox" name="form_passifFTP" id="form_passifFTP" {% if user.get_ftp_passif() == "1" %}checked{% endif %} />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_retryFTP">{% trans 'admin::compte-utilisateur:ftp: Nombre d\'essais max' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input class="input_element" type="text" name="form_retryFTP" id="form_retryFTP" value="5" />
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-actions" style="background-color: transparent;">
|
||||||
|
<input type="submit" class="btn btn-primary" value="{% trans 'boutton::valider' %}">
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
108
templates/web/account/authorized_apps.html.twig
Normal file
108
templates/web/account/authorized_apps.html.twig
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".app-btn").live("click", function(){
|
||||||
|
var $this = $(this);
|
||||||
|
|
||||||
|
if (!$this.hasClass("authorize"))
|
||||||
|
{
|
||||||
|
var revoke = 1;
|
||||||
|
var button_class = "authorize";
|
||||||
|
var old_class ="revoke";
|
||||||
|
var string = "{% trans 'Authoriser l\'access' %}";
|
||||||
|
}
|
||||||
|
else ($this.hasClass("authorize"))
|
||||||
|
{
|
||||||
|
var revoke = 0;
|
||||||
|
var button_class = "revoke";
|
||||||
|
var old_class ="authorize";
|
||||||
|
var string = "{% trans 'Revoquer l\'access' %}";
|
||||||
|
}
|
||||||
|
|
||||||
|
var app_id = $this.attr("value");
|
||||||
|
|
||||||
|
var opts = {
|
||||||
|
type:"POST",
|
||||||
|
url : '/security/application/' + app_id + '/grant/',
|
||||||
|
dataType: 'json',
|
||||||
|
data : {
|
||||||
|
revoke : revoke
|
||||||
|
},
|
||||||
|
success : function(data){
|
||||||
|
if(data.success)
|
||||||
|
{
|
||||||
|
div = $this.closest("div");
|
||||||
|
current.removeClass(old_class).addClass(button_class);
|
||||||
|
current.attr("value", acc_id);
|
||||||
|
current.empty().append(string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.ajax(opts);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<table class='app-placement'>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style='width:600px;'>
|
||||||
|
<div id="content-apps">
|
||||||
|
<h3>{% trans 'Vous avez autorise ces applications a acceder a votre compte' %}</h3>
|
||||||
|
{% if apps|length > 0 %}
|
||||||
|
<ul class='app-list'>
|
||||||
|
{% for app in apps %}
|
||||||
|
<li id='app_{{app.get_id}}'>
|
||||||
|
<div>
|
||||||
|
{% set account = app.get_user_account(user) %}
|
||||||
|
{% if account.is_revoked() is empty %}
|
||||||
|
<button type='button' class='revoke app-btn' value='{{app.get_id()}}'>{% trans 'Revoquer l\'access' %}</button>
|
||||||
|
{% else %}
|
||||||
|
<button type='button' class='authorize app-btn' value='{{app.get_id()}}'>{% trans 'Authoriser l\'access' %}</button>
|
||||||
|
{% endif %}
|
||||||
|
<span class='app-row'>
|
||||||
|
<a href="{{app.get_website()}}" target="_blank">
|
||||||
|
<strong>{{app.get_name()}}</strong>
|
||||||
|
</a>
|
||||||
|
{% if user is not none %}
|
||||||
|
{% set user_name = app.get_creator().get_display_name() %}
|
||||||
|
{% trans %}
|
||||||
|
par {{user_name}}
|
||||||
|
{% endtrans %}
|
||||||
|
{% endif%}
|
||||||
|
</span>
|
||||||
|
<span class='app-row'>
|
||||||
|
<font size="1"><i>{{app.get_created_on()|prettyDate}}</i></font>
|
||||||
|
</span>
|
||||||
|
<span class='app-row'>{{app.get_description() }}</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{%endfor%}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
<div>
|
||||||
|
{% trans 'Aucune application n\'a accés à vos données.' %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td style="vertical-align:top;">
|
||||||
|
<div class="side-section" style="margin:10px;text-align:left;">
|
||||||
|
<h3>{% trans 'Applications' %}</h3>
|
||||||
|
<p>
|
||||||
|
{% trans 'Naviguez et gerez les applications que vous souhaitez autoriser a acceder a vos informations Phraseanet' %}
|
||||||
|
</p>
|
||||||
|
<h3>{% trans 'Developpeurs' %}</h3>
|
||||||
|
<p>
|
||||||
|
{% trans 'Les developpeurs peuvent editer l\'enregistrement de leurs application grace a l\'onglet "developpeurs" ci-dessus' %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
44
templates/web/account/base.html.twig
Normal file
44
templates/web/account/base.html.twig
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<html lang="{{ session.get_I18n() }}">
|
||||||
|
<head>
|
||||||
|
<title>{{ home_title }} {% block title %}{% endblock %}</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/include/minify/f=login/home.css,/login/geonames.css,/skins/html5/bootstrap/css/bootstrap.min.css,/skins/html5/bootstrap/css/bootstrap-responsive.min.css,/skins/login/css/main.css"/>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/skins/login/css/main.css"/>
|
||||||
|
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js"></script>
|
||||||
|
<script type="text/javascript" language="javascript" src="/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
|
||||||
|
{% block head %}{% endblock %}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div style="width: 950px; margin-left: auto; margin-right: auto;">
|
||||||
|
<div style="margin-top: 70px; height: 35px;">
|
||||||
|
<table style="width: 100%;">
|
||||||
|
<tr style="height: 35px;">
|
||||||
|
<td style="width: 580px;">
|
||||||
|
<span class="title-name">{{ home_title }}</span>
|
||||||
|
<span class="title-desc">{{ block('title') }}</span>
|
||||||
|
</td>
|
||||||
|
<td style="color: #b1b1b1; text-align: right;">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane">
|
||||||
|
<div id="id-main" class="tab-content" style="height: auto;display: block; overflow-y: auto; overflow-x: hidden;">
|
||||||
|
<ul class='account-menu'>
|
||||||
|
<li><a href="/account/">{% trans 'Informations' %}</a></li>
|
||||||
|
<li><a href="/account/access/">{% trans 'Acces' %}</a></li>
|
||||||
|
<li><a href="/account/security/sessions/">{% trans 'Sessions' %}</a></li>
|
||||||
|
<li><a href="/account/security/applications/">{% trans 'Applications' %}</a></li>
|
||||||
|
<li><a href="/developers/applications/">{% trans 'Developpeur' %}</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="text-align: right; position: relative; margin: 18px 10px 0 0; font-size: 10px; font-weight: normal;">
|
||||||
|
<span>© Copyright Alchemy 2005-{{ "now"|date("Y") }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
149
templates/web/account/forgot-password.html.twig
Normal file
149
templates/web/account/forgot-password.html.twig
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans 'admin::compte-utilisateur changer mon mot de passe' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
|
||||||
|
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.js"></script>
|
||||||
|
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.password.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript" >
|
||||||
|
{% if tokenize %}
|
||||||
|
$(document).ready(function() {
|
||||||
|
$.validator.passwordRating.messages = {
|
||||||
|
"similar-to-username": "{% trans 'forms::le mot de passe est trop similaire a l\'identifiant' %}",
|
||||||
|
"too-short": "{% trans 'forms::la valeur donnee est trop courte' %}",
|
||||||
|
"very-weak": "{% trans 'forms::le mot de passe est trop simple' %}",
|
||||||
|
"weak": "{% trans 'forms::le mot de passe est trop simple' %}",
|
||||||
|
"good": "{% trans 'forms::le mot de passe est bon' %}",
|
||||||
|
"strong": "{% trans 'forms::le mot de passe est tres bon' %}"
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#password-reset").validate(
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
form_password_confirm: {
|
||||||
|
required:true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
form_password_confirm : {
|
||||||
|
equalTo:'{% trans 'forms::les mots de passe ne correspondent pas' %}'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
errorPlacement: function(error, element) {
|
||||||
|
error.prependTo( element.parent().parent().next().find('.form_alert') );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#form_password').rules("add",{
|
||||||
|
password: "#form_login"
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#form_password_confirm').rules("add",{
|
||||||
|
equalTo: "#form_password"
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#form_password").valid();
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
{% if tokenize %}
|
||||||
|
|
||||||
|
{% if app.request.get('salt') %}
|
||||||
|
<div class="notice" style="text-align: center; margin: 20px 40px; padding: 10px; font-weight: bold; font-size: 14px;">
|
||||||
|
{% trans 'Pour ameliorer la securite de l\'application, vous devez mettre a jour votre mot de passe.' %}<br/>
|
||||||
|
{% trans 'Cette tache ne pouvant etre automatisee, merci de bien vouloir la realiser.' %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<form name="send" action="/account/forgot-password/" method="POST" id="password-reset" style="width: 600px; margin: 0 auto;">
|
||||||
|
<table cellspacing="0" cellpadding="0" border="0">
|
||||||
|
<tr style="height: 30px;">
|
||||||
|
<td style="width: 33%;"><label for="form_password">{% trans 'admin::compte-utilisateur nouveau mot de passe' %} :</label></td>
|
||||||
|
<td style="width: 33%;">
|
||||||
|
<div class="form_input">
|
||||||
|
<input autocomplete="off" type="password" value="" id="form_password" name="form_password"/>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td style="width: 33%;">
|
||||||
|
<div class="form_alert">
|
||||||
|
{% if passwordMsg is not none %}
|
||||||
|
{{ passwordMsg }}
|
||||||
|
{% endif %}
|
||||||
|
<div class="password-meter">
|
||||||
|
<div class="password-meter-message"> </div>
|
||||||
|
<div class="password-meter-bg">
|
||||||
|
<div class="password-meter-bar"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="height: 30px;">
|
||||||
|
<td>
|
||||||
|
<label for="form_password" >{% trans 'admin::compte-utilisateur confirmer le mot de passe' %} :</label></td>
|
||||||
|
<td>
|
||||||
|
<div class="form_input">
|
||||||
|
<input autocomplete="off" type="password" value="" id="form_password_confirm" name="form_password_confirm"/>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div class="form_alert">
|
||||||
|
{% if passwordMsg is not none %}
|
||||||
|
{{ passwordMsg }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="height: 30px;">
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<input type="hidden" value="{{ app.request.get('token') }}" name="token"/>
|
||||||
|
<input type="submit" value="valider"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a class="link" href="/" target="_self">{% trans 'login:: Retour a l\'accueil' %}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if not tokenize %}
|
||||||
|
<form name="send" action="/account/forgot-password/" method="POST" style="width: 600px; margin: 0 auto;">
|
||||||
|
{% if errorMsg is not none %}
|
||||||
|
<div style="background:#00a8FF;">{{ errorMsg }}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if sentMsg is not none %}
|
||||||
|
<div style="background:#00a8FF;">{{ sentMsg }}</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div style="margin-top: 20px; font-size: 16px; font-weight: bold;">
|
||||||
|
{% trans 'login:: Forgot your password' %}
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 20px;">
|
||||||
|
{% trans 'login:: Entrez votre adresse email' %}
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 20px;">
|
||||||
|
<input name="mail" type="text" style="width:100%">
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10px;">
|
||||||
|
<input type="submit" value="{% trans 'boutton::valider' %}"/>
|
||||||
|
<a style="margin-left: 120px;" class="link" href="/" target="_self">{% trans 'login:: Retour a l\'accueil' %}</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endblock %}
|
388
templates/web/account/register.html.twig
Normal file
388
templates/web/account/register.html.twig
Normal file
@@ -0,0 +1,388 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans 'login:: register' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<script type="text/javascript" language="javascript" src="include/jslibs/jquery.validate.js,include/jslibs/jquery.validate.password.js,include/jslibs/jquery.validate.login.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
{% set sep = msg = rules = '' %}
|
||||||
|
{% set message1 = 'forms::ce champ est requis' | trans %}
|
||||||
|
{% set message2 = 'forms::la valeur donnee est trop courte' | trans %}
|
||||||
|
{% set message3 = 'forms::les mots de passe ne correspondent pas' | trans %}
|
||||||
|
{% set message4 = 'forms::l\'email semble invalide' | trans | e('js') %}
|
||||||
|
{% set message5 = 'login invalide (5 caracteres sans accents ni espaces)' | trans | e('js') %}
|
||||||
|
|
||||||
|
{% for ar, ver in arrayVerif if ver is not false %}
|
||||||
|
{% if ar != 'form_password' %}
|
||||||
|
{% if loop.first %}
|
||||||
|
{% set sep = ',' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set rules = rules ~ sep ~ ar ~ ':{required:true}' %}
|
||||||
|
{% set msg = msg ~ sep ~ ar ~ ': {' %}
|
||||||
|
{% set msg = msg ~ 'required : "' ~ message1 ~ '"' %}
|
||||||
|
|
||||||
|
{% if ar == 'form_login' or ar == 'form_password' %}
|
||||||
|
{% set msg = msg ~ ' ,minlength: "' ~ message2 ~ '"' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if ar == 'form_password' %}
|
||||||
|
{% set msg = msg ~ ' ,minlength: "' ~ message2 ~ '"' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if ar == 'form_password_confirm' %}
|
||||||
|
{% set msg = msg ~ ' ,equalTo: "' ~ message3 ~ '"' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if ar == 'form_email' %}
|
||||||
|
{% set msg = msg ~ ',email:"' ~ message4 ~ '"' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% set msg = msg ~ ',login:"' ~ message5 ~ '"' %}
|
||||||
|
{% set msg = msg ~ '}' %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$.validator.passwordRating.messages = {
|
||||||
|
"similar-to-username": "{% trans 'forms::le mot de passe est trop similaire a l\'identifiant' %}",
|
||||||
|
"too-short": "{% trans 'forms::la valeur donnee est trop courte' %}",
|
||||||
|
"very-weak": "{% trans 'forms::le mot de passe est trop simple' %}",
|
||||||
|
"weak": "{% trans 'forms::le mot de passe est simple' %}",
|
||||||
|
"good": "{% trans 'forms::le mot de passe est bon' %}",
|
||||||
|
"strong": "{% trans 'forms::le mot de passe est tres bon' %}"
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#register").validate(
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
{{ rules }}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
{{ msg }}
|
||||||
|
},
|
||||||
|
errorPlacement: function(error, element) {
|
||||||
|
error.prependTo( element.parent().next() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$('#form_email').rules("add",{email:true});
|
||||||
|
|
||||||
|
$('#form_login').rules("add",{
|
||||||
|
minlength: 5
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#form_password').rules("add",{password: "#form_login"});
|
||||||
|
$('#form_password_confirm').rules("add",{equalTo: "#form_password"});
|
||||||
|
|
||||||
|
|
||||||
|
$("#form_password").valid();
|
||||||
|
|
||||||
|
initialize_geoname_field($('#form_geonameid'));
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form id="register" class="form-horizontal" name="creation" action="register.php" method="post">
|
||||||
|
<div id="form_register_table" style="font-size: 11px; margin: 0 auto;">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_login">
|
||||||
|
{% if arrayVerif['form_login'] is not none and arrayVerif['form_login'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur identifiant' %}<br/>
|
||||||
|
<span style="font-size: 10px;">{% trans '5 caracteres minimum' %}</span>
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_login" class="input_element" name="form_login" autocomplete="off" value="{{ parm['form_login'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_login']) ? $needed['form_login'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_password">
|
||||||
|
{% if arrayVerif['form_password'] is not none and arrayVerif['form_password'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur mot de passe' %}<br/>
|
||||||
|
<span style="font-size: 10px;">{% trans '8 caracteres minimum' %}</span>
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="password" id="form_password" class="input_element password" name="form_password" autocomplete="off" value="{{ parm['form_password'] }}" />
|
||||||
|
<p class="form_alert help-block">
|
||||||
|
<span style="color: #FFF;">{% trans 'Resistance du mot de passe' %}</span><br/>
|
||||||
|
{#<?php echo isset($needed['form_password']) ? $needed['form_password'] : '' ?>#}
|
||||||
|
<div class="password-meter">
|
||||||
|
<p class="password-meter-message"> </p>
|
||||||
|
<div class="password-meter-bg">
|
||||||
|
<div class="password-meter-bar"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_password_confirm">
|
||||||
|
{% if arrayVerif['form_password_confirm'] is not none and arrayVerif['form_password_confirm'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
<span style="font-size: 10px;">{% trans 'Confirmation' %}</span>
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="password" id="form_password_confirm" class="input_element" name="form_password_confirm" autocomplete="off" type="password" value="{{ parm['form_password_confirm'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_password_confirm']) ? $needed['form_password_confirm'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="margin: 20px 0;">
|
||||||
|
<a href="#" onclick="$('#password_infos').slideToggle();return false;" style="color: #FFF; font-size: 13px;">{% trans 'admin::compte-utilisateur A propos de la securite des mots de passe' %}</a>
|
||||||
|
<div id="password_infos" style="display: none;">
|
||||||
|
<p style="text-align: center; margin: 20px 0 0;">
|
||||||
|
{% trans 'admin::compte-utilisateur Les mots de passe doivent etre clairement distincts du login et contenir au moins deux types parmis les caracteres suivants :' %}
|
||||||
|
</p>
|
||||||
|
<ul style="text-align: left; width: 300px;">
|
||||||
|
<li>{% trans 'admin::compte-utilisateur::securite caracteres speciaux' %}</li>
|
||||||
|
<li>{% trans 'admin::compte-utilisateur::securite caracteres majuscules' %}</li>
|
||||||
|
<li>{% trans 'admin::compte-utilisateur::securite caracteres minuscules' %}</li>
|
||||||
|
<li>{% trans 'admin::compte-utilisateur::securite caracteres numeriques' %}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_email">
|
||||||
|
{% if arrayVerif['form_email'] is not none and arrayVerif['form_email'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur email' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_email" class="input_element" name="form_email" autocomplete="off" value="{{ parm['form_email'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_email']) ? $needed['form_email'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_city">
|
||||||
|
{% if arrayVerif['form_geonameid'] is not none and arrayVerif['form_geonameid'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur ville' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_geonameid" class="input_element geoname_field" name="form_geonameid" geonameid="{{ parm['form_geonameid'] }}" value="{{ geonames.name_from_id(parm['form_geonameid']) }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_geonameid']) ? $needed['form_geonameid'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label">
|
||||||
|
{% trans 'admin::compte-utilisateur sexe' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<label class="radio">
|
||||||
|
<input type="radio" class="radio" name="form_gender" style="width: 10px;"{% if parm["form_gender"] == 0 %}checked{% endif %} value="0" />
|
||||||
|
{% trans 'admin::compte-utilisateur:sexe: mademoiselle' %}
|
||||||
|
</label>
|
||||||
|
<label class="radio">
|
||||||
|
<input type="radio" class="radio" name="form_gender" style="width: 10px;"{% if parm["form_gender"] == 1 %}checked{% endif %} value="1" />
|
||||||
|
{% trans 'admin::compte-utilisateur:sexe: madame' %}
|
||||||
|
</label>
|
||||||
|
<label class="radio">
|
||||||
|
<input type="radio" class="radio" name="form_gender" style="width: 10px;"{% if parm["form_gender"] == 2 %}checked{% endif %} value="2" />
|
||||||
|
{% trans 'admin::compte-utilisateur:sexe: monsieur' %}
|
||||||
|
</label>
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_gender']) ? $needed['form_gender'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_lastname">
|
||||||
|
{% if arrayVerif['form_lastname'] is not none and arrayVerif['form_lastname'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur nom' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_lastname" class="input_element" name="form_lastname" autocomplete="off" value="{{ parm['form_lastname'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_lastname']) ? $needed['form_lastname'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_firstname">
|
||||||
|
{% if arrayVerif['form_firstname'] is not none and arrayVerif['form_firstname'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur prenom' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_firstname" class="input_element" name="form_firstname" autocomplete="off" value="{{ parm['form_firstname'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_firstname']) ? $needed['form_firstname'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_job">
|
||||||
|
{% if arrayVerif['form_job'] is not none and arrayVerif['form_job'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur poste' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_job" class="input_element" name="form_job" autocomplete="off" value="{{ parm['form_job'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_job']) ? $needed['form_job'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_activity">
|
||||||
|
{% if arrayVerif['form_activity'] is not none and arrayVerif['form_activity'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur activite' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_activity" class="input_element" name="form_activity" autocomplete="off" value="{{ parm['form_activity'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_activity']) ? $needed['form_activity'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_phone">
|
||||||
|
{% if arrayVerif['form_phone'] is not none and arrayVerif['form_phone'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur telephone' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_phone" class="input_element" name="form_phone" autocomplete="off" value="{{ parm['form_phone'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_phone']) ? $needed['form_phone'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_fax">
|
||||||
|
{% if arrayVerif['form_fax'] is not none and arrayVerif['form_fax'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur fax' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_fax" class="input_element" name="form_fax" autocomplete="off" value="{{ parm['form_fax'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_fax']) ? $needed['form_fax'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_company">
|
||||||
|
{% if arrayVerif['form_company'] is not none and arrayVerif['form_company'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur societe' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_company" class="input_element" name="form_company" autocomplete="off" value="{{ parm['form_company'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_company']) ? $needed['form_company'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_address">
|
||||||
|
{% if arrayVerif['form_address'] is not none and arrayVerif['form_address'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur adresse' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_address" class="input_element" name="form_address" autocomplete="off" value="{{ parm['form_address'] }}" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_address']) ? $needed['form_address'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_zip">
|
||||||
|
{% if arrayVerif['form_zip'] is not none and arrayVerif['form_zip'] == true %}<span class="requiredField">*</span>{% endif %}
|
||||||
|
{% trans 'admin::compte-utilisateur code postal' %}
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input id="form_zip" autocomplete="off" type="text" value="{{ parm['form_zip'] }}" class="input_element" name="form_zip" />
|
||||||
|
<p class="form_alert help-block">{#<?php echo isset($needed['form_zip']) ? $needed['form_zip'] : '' ?>#}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
</div><!-- /form_register_table -->
|
||||||
|
|
||||||
|
{% if registry.get('GV_autoselectDB') %}
|
||||||
|
<div style="display: none;">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<p style="width: 600px; height: 20px; text-align: center; margin: 0 auto;">
|
||||||
|
{% trans 'admin::compte-utilisateur actuellement, acces aux bases suivantes : ' %}
|
||||||
|
</p>
|
||||||
|
<p class="requiredField" style="width: 600px; height: 20px; text-align: center; margin: 0 auto;">
|
||||||
|
{#<?php echo isset($needed['demand']) ? 'Vous n\'avez selectionne aucune base' : '' ?>#}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div style="width: 600px; text-align: center; margin: 0 5px;">
|
||||||
|
|
||||||
|
|
||||||
|
<table border="0" style="table-layout:fixed" cellspacing=0 width="590">
|
||||||
|
<tr>
|
||||||
|
<td style="width:240px; text-align:right"> </td>
|
||||||
|
<td width="25px" style="width:25px"> </td>
|
||||||
|
<td style="width:325px;"> </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% for sbasId, baseInsc in inscriptions %}
|
||||||
|
{% if (baseInsc['CollsCGU'] or baseInsc['Colls']) and baseInsc['inscript'] %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">
|
||||||
|
<h3 style="margin: 15px 0pt 2px;" class="inscriptbase">{{ sbasId |sbas_names }}</h3>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% if baseInsc['Colls'] %}
|
||||||
|
{% if baseInsc['CGU'] %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">
|
||||||
|
{% trans 'login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes' %}<br/>
|
||||||
|
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas=' . $sbasId . '">{% trans 'login::register::CGU: ouvrir dans une nouvelle fenetre' %}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% for collId, collName in baseInsc['Colls'] %}
|
||||||
|
{% set baseId = sbasId |baseFromColl(collId) %}
|
||||||
|
{% set ch = "checked" %}
|
||||||
|
{% if not is_null(demandes) and not demandes['baseId'] %}
|
||||||
|
{% set ch = "" %}
|
||||||
|
{% endif %}
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: right;">{{ collName }}</td>
|
||||||
|
<td></td>
|
||||||
|
<td class="TD_R" style="width: 200px;">
|
||||||
|
<input type="checkbox" class="checkbox" {{ ch }} name="demand[]" value="{{ baseId }}" style="width: 15px;" >
|
||||||
|
<span>{% trans 'login::register: Faire une demande d\'acces' %}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% if baseInsc['CollsCGU'] %}
|
||||||
|
{% for collId, collDesc in baseInsc['CollsCGU'] %}
|
||||||
|
{% set baseId = sbasId |baseFromColl(collId) %}
|
||||||
|
{% set ch = "checked" %}
|
||||||
|
{% if not is_null(demandes) and not demandes['baseId'] %}
|
||||||
|
{% set ch = "" %}
|
||||||
|
{% endif %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align: center;">
|
||||||
|
<hr style="width: 80%"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" style="text-align:center;">
|
||||||
|
{% trans 'login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes' %}<br/>
|
||||||
|
<a class="inscriptlink" href="/include/cguUtils.php?action=PRINT&bas={{ sbasId }}&col={{ collId }}">{% trans 'login::register::CGU: ouvrir dans une nouvelle fenetre' %}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: right;">{{ collDesc['name'] }}</td>
|
||||||
|
<td></td>
|
||||||
|
<td class="TD_R" style="width: 200px;">
|
||||||
|
<input style="width:15px;" class="checkbox" type="checkbox" {{ ch }} name="demand[]" value="{{ baseId }}" >
|
||||||
|
<span>{% trans 'login::register: Faire une demande d\'acces' %}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if registry.get('GV_autoselectDB') %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<input type="hidden" value="{{ lng }}" name="lng">
|
||||||
|
<div style="margin: 10px 0; text-align: center;">
|
||||||
|
<input type="submit" class="btn" value="{% trans 'boutton::valider' %}" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$('.tab').hover(function(){
|
||||||
|
$(this).addClass('active');
|
||||||
|
}, function(){
|
||||||
|
$(this).removeClass('active');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
88
templates/web/account/reset-email.html.twig
Normal file
88
templates/web/account/reset-email.html.twig
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans 'admin::compte-utilisateur changer mon mot de passe' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<script type="text/javascript" language="javascript" src="/include/jslibs/jquery.validate.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#mainform").validate(
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
form_password : {
|
||||||
|
required:true
|
||||||
|
},
|
||||||
|
form_email : {
|
||||||
|
required:true,
|
||||||
|
email:true
|
||||||
|
},
|
||||||
|
form_email_confirm : {
|
||||||
|
required:true,
|
||||||
|
equalTo:'#form_email'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
form_password : {
|
||||||
|
required : "{% trans 'forms::ce champ est requis' %}"
|
||||||
|
},
|
||||||
|
form_email : {
|
||||||
|
required : "{% trans 'forms::ce champ est requis' %}",
|
||||||
|
email:"{% trans 'forms::l\'email semble invalide' %}"
|
||||||
|
},
|
||||||
|
form_email_confirm : {
|
||||||
|
required : "{% trans 'forms::ce champ est requis' %}",
|
||||||
|
equalTo : "{% trans 'forms::les emails ne correspondent pas' %}"
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
errorPlacement: function(error, element) {
|
||||||
|
error.prependTo( element.parent().next() );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form method="POST" action="/account/reset-email/" id="mainform" class="form-horizontal">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_login">{% trans 'admin::compte-utilisateur identifiant' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<p>{{ user.get_login() }}</p>
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_password">{% trans 'admin::compte-utilisateur mot de passe' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="password" id="form_password" name="form_password" autocomplete="off" />
|
||||||
|
{#<p class="form_alert help-block"><?php echo isset($needed['form_password']) ? $needed['form_password'] : '' ?></p>#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_email">{% trans 'admin::compte-utilisateur nouvelle adresse email' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_email" name="form_email" />
|
||||||
|
{#<p class="form_alert help-block"><?php echo isset($needed['form_email']) ? $needed['form_email'] : '' ?></p>#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_email_confirm">{% trans 'admin::compte-utilisateur confirmer la nouvelle adresse email' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="form_email_confirm" name="form_email_confirm" autocomplete="off" />
|
||||||
|
{#<p class="form_alert help-block"><?php echo isset($needed['form_email_confirm']) ? $needed['form_email_confirm'] : '' ?></p>#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions" style="background-color: transparent;">
|
||||||
|
<input type="submit" class="btn" value="{% trans 'boutton::valider' %}" style="margin: 20px auto;" />
|
||||||
|
<input type="button" class="btn" value="{% trans 'boutton::annuler' %}" onclick="self.location.replace('/account/');" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<p>
|
||||||
|
{% trans 'admin::compte-utilisateur: Pourquoi me demande-t-on mon mot de passe pour changer mon adresse email ?'%}
|
||||||
|
<br />
|
||||||
|
{% trans 'admin::compte-utilisateur: Votre adresse e-mail sera utilisee lors de la perte de votre mot de passe afin de pouvoir le reinitialiser, il est important que vous soyez la seule personne a pouvoir la changer.'%}
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
122
templates/web/account/reset-password.html.twig
Normal file
122
templates/web/account/reset-password.html.twig
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans 'admin::compte-utilisateur changer mon mot de passe' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$.validator.passwordRating.messages = {
|
||||||
|
"similar-to-username": "{% trans 'forms::le mot de passe est trop similaire a l\'identifiant' %}",
|
||||||
|
"too-short": "{% trans 'forms::la valeur donnee est trop courte' %}",
|
||||||
|
"very-weak": "{% trans 'forms::le mot de passe est trop simple' %}",
|
||||||
|
"weak": "{% trans 'forms::le mot de passe est simple' %}",
|
||||||
|
"good": "{% trans 'forms::le mot de passe est bon' %}",
|
||||||
|
"strong": "{% trans 'forms::le mot de passe est tres bon' %}"
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#mainform").validate(
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
form_old_password : {
|
||||||
|
required:true
|
||||||
|
},
|
||||||
|
form_password : {
|
||||||
|
password:'#form_login'
|
||||||
|
},
|
||||||
|
form_password_confirm : {
|
||||||
|
required:true,
|
||||||
|
equalTo:'#form_password'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
form_old_password : {
|
||||||
|
required : "<?php echo str_replace('"', '\"', {% trans 'forms::ce champ est requis' %}) ?>"
|
||||||
|
},
|
||||||
|
form_password : {
|
||||||
|
required : "<?php echo str_replace('"', '\"', {% trans 'forms::ce champ est requis' %}) ?>"
|
||||||
|
},
|
||||||
|
form_password_confirm : {
|
||||||
|
required : "<?php echo str_replace('"', '\"', {% trans 'forms::ce champ est requis' %}) ?>",
|
||||||
|
equalTo : "<?php echo str_replace('"', '\"', {% trans 'forms::les mots de passe ne correspondent pas' %}) ?>"
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
errorPlacement: function(error, element) {
|
||||||
|
error.prependTo( element.parent().next() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$("#form_password").valid();
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form method="post" action="/login/reset-password.php" id="mainform" class="form-horizontal">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_login">{% trans 'admin::compte-utilisateur identifiant' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<p>{{ user.get_login() }}</p>
|
||||||
|
<p class="form_alert help-block"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_old_password">{% trans 'admin::compte-utilisateur ancien mot de passe' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="password" id="form_old_password" name="form_old_password" autocomplete="off" />
|
||||||
|
{#<p class="form_alert help-block"><?php echo isset($needed['form_old_password']) ? $needed['form_old_password'] : '' ?></p>#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_password">
|
||||||
|
{% trans 'admin::compte-utilisateur nouveau mot de passe' %}<br />
|
||||||
|
<span style="font-size: 10px;">{% trans '8 caracteres minimum' %}</span>
|
||||||
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="hidden" id="form_login" value="{{ user.get_login() }}" autocomplete="off" />
|
||||||
|
<input type="password" id="form_password" name="form_password" />
|
||||||
|
{#<p class="form_alert help-block">
|
||||||
|
<?php echo isset($needed['form_password']) ? $needed['form_password'] : '' ?>
|
||||||
|
<div class="password-meter">
|
||||||
|
<p class="password-meter-message"> </p>
|
||||||
|
<div class="password-meter-bg">
|
||||||
|
<div class="password-meter-bar"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p>#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="form_label control-label" for="form_password_confirm">{% trans 'admin::compte-utilisateur confirmer le mot de passe' %}</label>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="password" id="form_password_confirm" name="form_password_confirm" autocomplete="off" />
|
||||||
|
{#<p class="form_alert help-block"><?php echo isset($needed['form_password_confirm']) ? $needed['form_password_confirm'] : '' ?></p>#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions" style="background-color: transparent;">
|
||||||
|
<input type="submit" class="btn" value="{% trans 'boutton::valider' %}" style="margin: 20px auto;" />
|
||||||
|
<input type="button" class="btn" value="{% trans 'boutton::annuler' %}" onclick="self.location.replace('/account/');" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div>
|
||||||
|
<p style="text-align: center; font-weight: bold; font-size: 13px; margin: 40px 0 0;">
|
||||||
|
{% trans 'admin::compte-utilisateur A propos de la securite des mots de passe :' %}
|
||||||
|
</p>
|
||||||
|
<p style="text-align: center; margin: 20px 0 0;">
|
||||||
|
{% trans 'admin::compte-utilisateur Les mots de passe doivent etre clairement distincts du login et contenir au moins deux types parmis les caracteres suivants :' %}
|
||||||
|
</p>
|
||||||
|
<div style="text-align: left; margin: 10px auto; width: 300px;">
|
||||||
|
<ul>
|
||||||
|
<li>{% trans 'admin::compte-utilisateur::securite caracteres speciaux' %}</li>
|
||||||
|
<li>{% trans 'admin::compte-utilisateur::securite caracteres majuscules' %}</li>
|
||||||
|
<li>{% trans 'admin::compte-utilisateur::securite caracteres minuscules' %}</li>
|
||||||
|
<li>{% trans 'admin::compte-utilisateur::securite caracteres numeriques' %}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
64
templates/web/account/sessions.html.twig
Normal file
64
templates/web/account/sessions.html.twig
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% trans 'Mes sessions' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div>
|
||||||
|
<table style="width: 80%; margin: 0 auto;">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% trans 'Date de connexion' %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% trans 'Dernier access' %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% trans 'IP' %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% trans 'Browser' %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% trans 'ecran' %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% trans 'Session persistante' %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% for row in session.get_my_sessions() %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{% if session.get_ses_id() != row['session_id'] %}
|
||||||
|
<img src="/skins/icons/delete.png"/>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ row['created_on'] |getDate }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ row['lastaccess'] |getDate }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ row['ip'] }}
|
||||||
|
{{ row['ip_infos'] }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ row['browser'] }} {{ row['browser_version'] }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ row['screen'] }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if row['token'] %}oui{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@@ -138,7 +138,7 @@
|
|||||||
{% trans 'Guest' %}
|
{% trans 'Guest' %}
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a target="_blank" href="/login/account.php" title="{% trans 'login:: Mon compte' %}">
|
<a target="_blank" href="/account/" title="{% trans 'login:: Mon compte' %}">
|
||||||
<span>
|
<span>
|
||||||
{{user.get_login()}}
|
{{user.get_login()}}
|
||||||
</span>
|
</span>
|
||||||
|
90
templates/web/developers/application.html.twig
Normal file
90
templates/web/developers/application.html.twig
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% use "developers/header.html.twig" with header as parent_header %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
{{ block('parent_header') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<h1 style='text-align:left'>{% trans 'Application' %}</h1>
|
||||||
|
<input type="hidden" value="{{app.get_id}}" name="app_id"/>
|
||||||
|
<div>
|
||||||
|
<ul class='app-list'>
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
<span class='app-row'><strong><a class="link" href="/developers/application/{{app.get_id}}/">{{app.get_name}}</a></strong></span>
|
||||||
|
<span class='app-row'>{{app.get_description }}</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h1 style='text-align:left'>{% trans 'settings OAuth' %}</h1>
|
||||||
|
<p style='text-align:left'>{% trans 'Les parametres oauth de votre application.' %}</p>
|
||||||
|
<table id="app-oauth-setting">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>Client ID</td>
|
||||||
|
<td>{{app.get_client_id}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Client Secret</td>
|
||||||
|
<td>{{app.get_client_secret}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{% trans 'URL de callback' %}</td>
|
||||||
|
{% if app.get_type == constant('API_OAuth2_Application::DESKTOP_TYPE') %}
|
||||||
|
<td>
|
||||||
|
<span>{{app.get_redirect_uri}}</span>
|
||||||
|
</td>
|
||||||
|
{% else %}
|
||||||
|
<td class="url_callback"><span class="url_callback_input">{{app.get_redirect_uri}}</span>
|
||||||
|
<button type="button" class="save_callback" style="display:none;">save</button>
|
||||||
|
<button type="button" class="modifier_callback" style="display:none;">modifier</button>
|
||||||
|
</td>
|
||||||
|
{%endif%}
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Authorize endpoint</td>
|
||||||
|
<td>{{registry.get('GV_ServerName')}}api/oauthv2/authorize</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Access endpoint</td>
|
||||||
|
<td>{{registry.get('GV_ServerName')}}api/oauthv2/token</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{% trans 'Activer le grant_type de type password pour votre application' %}</td>
|
||||||
|
<td><input class="grant-type" type='checkbox' {{ app.is_password_granted() ? "checked='checked'" : ""}} name="grant" value='{{app.get_id()}}'></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h1 style='text-align:left'>{% trans 'Votre token d\'access' %}</h1>
|
||||||
|
<p style='text-align:left'> {% trans 'Les paramétres oauth de votre application.' %}</p>
|
||||||
|
<table id="app-access-token-setting">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style='width:25%'>
|
||||||
|
{% trans 'Token' %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span id="my_access_token">
|
||||||
|
{% if not token is none %}
|
||||||
|
{{token|default('')}}
|
||||||
|
{% else %}
|
||||||
|
{% trans 'Le token n\'a pas encore ete genere' %}
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style='width:25%'></td>
|
||||||
|
<td><button id="generate_access" type="button" value="{{app.get_id}}">{% trans 'boutton::generer' %}</button></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div style='text-align:left'>
|
||||||
|
<a class="link" href="/developers/applications/"><button>{% trans 'boutton::retour' %}</button></a>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
105
templates/web/developers/application_form.html.twig
Normal file
105
templates/web/developers/application_form.html.twig
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% use "developers/header.html.twig" with header as parent_header %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
{{ block('parent_header') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{# form input macro #}
|
||||||
|
{% macro input(name, value, violations, property, type, size) %}
|
||||||
|
{% if violations is none %}
|
||||||
|
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
|
||||||
|
{% else %}
|
||||||
|
{% set hasError = "false" %}
|
||||||
|
{% for violation in violations %}
|
||||||
|
{% if violation.getPropertyPath == property and hasError == "false" %}
|
||||||
|
{% set hasError = "true" %}
|
||||||
|
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value }}" size="{{ size|default(20) }}" />
|
||||||
|
<div style="color:red" > {{ violation.getInvalidValue }} - {{violation.getMessage}} </div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if hasError == "false" %}
|
||||||
|
<input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" />
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{# form textare macro #}
|
||||||
|
{% macro textarea(name, value, violations,property, rows, cols) %}
|
||||||
|
{% if violations is none %}
|
||||||
|
<textarea name="{{ name }}" rows="{{ rows|default(4)}}" cols="{{cols|default(20)}}" >{{ value|e}}</textarea>
|
||||||
|
{% else %}
|
||||||
|
{% set hasError = "false" %}
|
||||||
|
{% for violation in violations %}
|
||||||
|
{% if violation.getPropertyPath == property and hasError == "false" %}
|
||||||
|
{% set hasError = "true" %}
|
||||||
|
<textarea name="{{ name }}" rows="{{ rows|default(4)}}" cols="{{cols|default(20)}}" >{{ violation.getInvalidValue}}</textarea>
|
||||||
|
<div style="color:red" > {{violation.getMessage}} </div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if hasError == "false" %}
|
||||||
|
<textarea name="{{ name }}" rows="{{ rows|default(4)}}" cols="{{cols|default(20)}}" >{{ value|e}}</textarea>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<form id="form_create" action="/developers/application/" method="POST">
|
||||||
|
{% if form is none %}
|
||||||
|
{% set name, description, website, callback = '', '', '', ''%}
|
||||||
|
{% set app_type = 'web'%}
|
||||||
|
{% else %}
|
||||||
|
{% set name = form.name %}
|
||||||
|
{% set description = form.description %}
|
||||||
|
{% set website = form.website %}
|
||||||
|
{% set callback = form.callback %}
|
||||||
|
{% set app_type = form.type %}
|
||||||
|
{% endif %}
|
||||||
|
<table id = "app-dev-create">
|
||||||
|
<tr>
|
||||||
|
<td><label for="name">{% trans 'Nom' %}</label></td>
|
||||||
|
<td>{{ _self.input("name", name, violations, 'name') }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="description">{% trans 'Description' %}</label></td>
|
||||||
|
<td>{{ _self.textarea("description", description, 'description', violations, 5, 17) }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="website">{% trans 'Site web' %}</label></td>
|
||||||
|
<td class="url-td">
|
||||||
|
<select name="scheme-website">
|
||||||
|
<option value="http://">http://</option>
|
||||||
|
<option value="https://">https://</option>
|
||||||
|
</select>
|
||||||
|
{{ _self.input("website", website, violations, 'urlwebsite') }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label for="type">{% trans 'Type d\'application' %}</label></td>
|
||||||
|
<td>{% trans 'Application web' %}
|
||||||
|
<input type="radio" name="type" value="web" {{ app_type == "web" ? "checked='checked'" : "" }}/>
|
||||||
|
{% trans 'Application desktop' %}
|
||||||
|
<input type="radio" name="type" value="desktop" {{ app_type == "desktop" ? "checked='checked'" : "" }}/></td>
|
||||||
|
</tr>
|
||||||
|
{% if app_type == "web" %}
|
||||||
|
<tr class="callback" style="height:25px;">
|
||||||
|
<td><label for="callback">{% trans 'URL de callback' %} <br/></label></td>
|
||||||
|
<td class="url-td">
|
||||||
|
<select name="scheme-callback">
|
||||||
|
<option value="http://">http://</option>
|
||||||
|
<option value="https://">https://</option>
|
||||||
|
</select>
|
||||||
|
{{ _self.input("callback", callback, violations, 'urlcallback') }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td><button class="app_submit" type="button">{% trans 'boutton::valider' %}</button</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
<div style="text-align:left">
|
||||||
|
<a href="/developers/applications/"><button>{% trans 'boutton::retour' %}</button></a>
|
||||||
|
<div>
|
||||||
|
{% endblock %}
|
62
templates/web/developers/applications.html.twig
Normal file
62
templates/web/developers/applications.html.twig
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
{% extends 'account/base.html.twig' %}
|
||||||
|
|
||||||
|
{% use "developers/header.html.twig" with header as parent_header %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
{{ block('parent_header') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<table class='app-placement'>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style='width:600px;'>
|
||||||
|
<div id="content-apps">
|
||||||
|
<h1>Phraseanet Developer Center</h1>
|
||||||
|
<h3>{% trans 'Mes applications' %}</h3>
|
||||||
|
{% if apps|length > 0 %}
|
||||||
|
<ul class='app-list'>
|
||||||
|
{% for app in apps %}
|
||||||
|
<li id='app_{{app.get_id()}}'>
|
||||||
|
<div>
|
||||||
|
<button class='delete_app' type='button'>{% trans 'button::supprimer'%}</button>
|
||||||
|
<span class='app-row'>
|
||||||
|
<strong>
|
||||||
|
<a class="link" href="/developers/application/{{app.get_id()}}/">
|
||||||
|
{{app.get_name()}}
|
||||||
|
</a>
|
||||||
|
</strong>
|
||||||
|
</span>
|
||||||
|
<span class='app-row'>{{app.get_description() }}</span>
|
||||||
|
<span class='app-row'>{{app.get_website()}}</span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{%endfor%}
|
||||||
|
</ul>
|
||||||
|
{% else %}
|
||||||
|
<div>
|
||||||
|
{% trans 'Aucune application creee.' %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td style="vertical-align:top;text-align:left;">
|
||||||
|
<div style="margin:10px;text-align:left;" class="side-section">
|
||||||
|
<div>
|
||||||
|
<a href="http://developer.phraseanet.com/" class="no_underline" target="_blank">
|
||||||
|
<button class="link_button">{% trans 'Demarrer avec l\'API Phraseanet' %}</button>
|
||||||
|
</a><br/>
|
||||||
|
{% trans 'Decouvrez la documentation' %}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<a class="no_underline" href="/developers/application/new/">
|
||||||
|
<button class="link_button">{% trans 'Creer une nouvelle applications' %}</button>
|
||||||
|
</a><br/>
|
||||||
|
{% trans 'Creez une application pour commencer a utiliser l\'API Phraseanet' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
177
templates/web/developers/header.html.twig
Normal file
177
templates/web/developers/header.html.twig
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
{% block header %}
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
var trans = {
|
||||||
|
'confirm_delete' : "{% trans 'etes vous sur de vouloir supprimer cette application' %}"
|
||||||
|
,'yes' : "{% trans 'oui' %}"
|
||||||
|
,'no' : "{% trans 'non' %}"
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#generate_access").live("click", function(){
|
||||||
|
var app_id = $(this).attr("value");
|
||||||
|
var usr_id = $(this).closest("div").attr("id");
|
||||||
|
var opts = {
|
||||||
|
type:"POST",
|
||||||
|
url : '/developers/application/'+ app_id +'/access_token/',
|
||||||
|
dataType: 'json',
|
||||||
|
data : {
|
||||||
|
usr_id : usr_id
|
||||||
|
},
|
||||||
|
success : function(data){
|
||||||
|
if(data.success) {
|
||||||
|
$("#my_access_token").empty().append(data.token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jQuery.ajax(opts);
|
||||||
|
});
|
||||||
|
|
||||||
|
var $url_callback_event = function(event) {
|
||||||
|
if ( event.type == "mouseover" ) {
|
||||||
|
$(this).find(".modifier_callback").show();
|
||||||
|
} else {
|
||||||
|
$(this).find(".modifier_callback").hide();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var $event = function(event){
|
||||||
|
if ( event.type == "mouseover" ) {
|
||||||
|
$(this).find(".delete_app").show();
|
||||||
|
} else {
|
||||||
|
$(this).find(".delete_app").hide();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$(".url_callback").live("mouseover mouseout", $url_callback_event);
|
||||||
|
|
||||||
|
$(".app-list li").live("mouseover mouseout", $event);
|
||||||
|
|
||||||
|
$(".modifier_callback").live("click", function(){
|
||||||
|
$(this).hide();
|
||||||
|
$(".save_callback").show();
|
||||||
|
var cur_value = $(".url_callback_input").html();
|
||||||
|
$(".url_callback_input")
|
||||||
|
.empty()
|
||||||
|
.wrapInner('<input value = "'+cur_value+'" name="oauth_callback" size="50" type="text"/>');
|
||||||
|
$(".url_callback").die();
|
||||||
|
$(".save_callback").live("click", function(){
|
||||||
|
var callback = $("input[name=oauth_callback]").val();
|
||||||
|
var app_id = $("input[name=app_id]").val();
|
||||||
|
var $this = $(this);
|
||||||
|
var option = {
|
||||||
|
type:"POST",
|
||||||
|
url : "/developers/application/" + app_id + "callback/",
|
||||||
|
dataType: 'json',
|
||||||
|
data :{callback : callback},
|
||||||
|
success : function(data){
|
||||||
|
if(data.success == true)
|
||||||
|
$(".url_callback_input").empty().append(callback);
|
||||||
|
else
|
||||||
|
$(".url_callback_input").empty().append(cur_value);
|
||||||
|
$this.hide();
|
||||||
|
$(".url_callback").live("mouseover mouseout", $url_callback_event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.ajax(option);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".app_submit").live("click", function(){
|
||||||
|
var form = $(this).closest("form");
|
||||||
|
var action = form.attr("action");
|
||||||
|
var option = {
|
||||||
|
type:"POST",
|
||||||
|
url : action,
|
||||||
|
dataType: 'html',
|
||||||
|
data : form.serializeArray(),
|
||||||
|
success : function(data){
|
||||||
|
$(".ui-tabs-panel:visible").empty().append(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.ajax(option);
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#form_create input[name=type]").live("click", function(){
|
||||||
|
if($(this).val() == "desktop")
|
||||||
|
$("#form_create .callback td").hide().find("input").val('');
|
||||||
|
else
|
||||||
|
$("#form_create .callback td").show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.grant-type').live('click', function(){
|
||||||
|
var appId = $(this).val();
|
||||||
|
var grant = $(this).is(":checked") ? "1": "0";
|
||||||
|
var opts = {
|
||||||
|
type:"POST",
|
||||||
|
url : '/developers/application/' + appId + '/authorize_grant_password/',
|
||||||
|
dataType: 'json',
|
||||||
|
data : {grant : grant},
|
||||||
|
success : function(data){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.ajax(opts);
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#app_dev, #app_dev_new, #app_dev_create, a.dev_back").live("click", function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
target = $(this).attr("href");
|
||||||
|
var opts = {
|
||||||
|
type:"GET",
|
||||||
|
url : target,
|
||||||
|
dataType: 'html',
|
||||||
|
success : function(data){
|
||||||
|
$(".ui-tabs-panel:visible").empty().append(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.ajax(opts);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".delete_app").die().live("click", function(){
|
||||||
|
var id = $(this).closest("li").attr('id').split("_");;
|
||||||
|
var app_id = id[1];
|
||||||
|
var $this= $(this);
|
||||||
|
$("body").append("<div id='confirm_delete'><p>"+trans.confirm_delete+" ? </p></div>")
|
||||||
|
$("#confirm_delete").dialog({
|
||||||
|
resizable: false,
|
||||||
|
autoOpen :true,
|
||||||
|
title: "",
|
||||||
|
draggable: false,
|
||||||
|
width:340,
|
||||||
|
modal: true,
|
||||||
|
buttons: [{
|
||||||
|
id: "ybutton",
|
||||||
|
text: trans.yes,
|
||||||
|
click: function() {
|
||||||
|
var opts = {
|
||||||
|
type:"DELETE",
|
||||||
|
url : '/developers/application/'+ app_id +'/',
|
||||||
|
dataType: 'json',
|
||||||
|
data : {},
|
||||||
|
success : function(data){
|
||||||
|
if(data.success)
|
||||||
|
{
|
||||||
|
$this.closest("li").remove();
|
||||||
|
$("#confirm_delete").dialog("close");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.ajax(opts);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "nbutton",
|
||||||
|
text: trans.no,
|
||||||
|
click: function() {
|
||||||
|
$( this ).dialog( "close" );
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
close : function() {
|
||||||
|
$( this ).remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
@@ -1,8 +1,8 @@
|
|||||||
<title>{{module_name}}</title>
|
<title>{{module_name}}</title>
|
||||||
<meta content="{{meta_description}}" name="description"/>
|
<meta content="{{meta_description}}" name="description"/>
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
||||||
<meta content="{{meta_keywords}}" name="keywords"/>
|
<meta content="{{meta_keywords}}" name="keywords"/>
|
||||||
<meta content="phraseanet" name="generator"/>
|
<meta content="phraseanet" name="generator"/>
|
||||||
|
|
||||||
{% for feed in feeds %}
|
{% for feed in feeds %}
|
||||||
{% set link = feed.get_homepage_link(registry, 'rss') %}
|
{% set link = feed.get_homepage_link(registry, 'rss') %}
|
||||||
@@ -11,6 +11,6 @@
|
|||||||
<link rel="alternate" type="{{ link.get_mimetype() }}" title="{{ link.get_title() }}" href="{{ link.get_href() }}" />
|
<link rel="alternate" type="{{ link.get_mimetype() }}" title="{{ link.get_title() }}" href="{{ link.get_href() }}" />
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
<link REL="stylesheet" TYPE="text/css" HREF="/login/home.css" />
|
<link rel="stylesheet" type="text/css" href="/login/home.css,/skins/login/css/main.css" />
|
||||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js,include/jslibs/jquery.cookie.js,login/home.js"></script>
|
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js,include/jslibs/jquery.cookie.js,login/home.js"></script>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
{{login.get_guest_link|raw}}
|
{{login.get_guest_link|raw}}
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top:10px;height:20px;">
|
<div style="margin-top:10px;height:20px;">
|
||||||
<a target="_self" class="link" rel="external" href="/login/forgotpwd.php">
|
<a target="_self" class="link" rel="external" href="/account/forgot-password/">
|
||||||
{% trans 'login:: Forgot your password' %}
|
{% trans 'login:: Forgot your password' %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
{{login.get_guest_link|raw}}
|
{{login.get_guest_link|raw}}
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top:10px;height:20px;">
|
<div style="margin-top:10px;height:20px;">
|
||||||
<a target="_self" class="link" rel="external" href="/login/forgotpwd.php">
|
<a target="_self" class="link" rel="external" href="/account/forgot-password/">
|
||||||
{% trans 'login:: Forgot your password' %}
|
{% trans 'login:: Forgot your password' %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
<div style="margin-top:3px;"><input {% if maintenance == true %}disabled{% endif %} tabindex="2" name="pwd"
|
<div style="margin-top:3px;"><input {% if maintenance == true %}disabled{% endif %} tabindex="2" name="pwd"
|
||||||
id="pwd" value="" type="password" style="width:100%" /></div>
|
id="pwd" value="" type="password" style="width:100%" /></div>
|
||||||
<div style="text-align:right;margin-top:3px;">
|
<div style="text-align:right;margin-top:3px;">
|
||||||
<a target="_self" class="link" rel="external" href="/login/forgotpwd.php">
|
<a target="_self" class="link" rel="external" href="/account/forgot-password/">
|
||||||
{% trans 'login:: Forgot your password' %}
|
{% trans 'login:: Forgot your password' %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
75
tests/Alchemy/Phrasea/Controller/Root/AccountTest.php
Normal file
75
tests/Alchemy/Phrasea/Controller/Root/AccountTest.php
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
|
||||||
|
|
||||||
|
class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->client = $this->createClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createApplication()
|
||||||
|
{
|
||||||
|
$app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Root.php';
|
||||||
|
|
||||||
|
$app['debug'] = true;
|
||||||
|
unset($app['exception_handler']);
|
||||||
|
|
||||||
|
return $app;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetAccount()
|
||||||
|
{
|
||||||
|
$this->client->request('GET', '/account/');
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
|
$this->assertTrue($response->isOk());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUpdateAccount()
|
||||||
|
{
|
||||||
|
$core = \bootstrap::getCore();
|
||||||
|
$appbox = \appbox::get_instance($core);
|
||||||
|
|
||||||
|
$bases = array();
|
||||||
|
foreach ($appbox->get_databoxes() as $databox) {
|
||||||
|
foreach ($databox->get_collections() as $collection) {
|
||||||
|
$bases[] = $collection->get_base_id();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(0 === count($bases)) {
|
||||||
|
$this->markTestSkipped('No collections');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->client->request('POST', '/account/', array(
|
||||||
|
'demand' => $bases,
|
||||||
|
'form_gender' => 'M',
|
||||||
|
'form_firstname' => 'gros',
|
||||||
|
'form_lastname' => 'minet',
|
||||||
|
'form_address' => 'rue du lac',
|
||||||
|
'form_zip' => '75005',
|
||||||
|
'form_phone' => '+33645787878',
|
||||||
|
'form_fax' => '+33145787845',
|
||||||
|
'form_function' => 'astronaute',
|
||||||
|
'form_company' => 'NASA',
|
||||||
|
'form_activity' => 'Space',
|
||||||
|
'form_geonameid' => '',
|
||||||
|
'form_addrFTP' => '',
|
||||||
|
'form_loginFTP' => '',
|
||||||
|
'form_pwdFTP' => '',
|
||||||
|
'form_destFTP' => '',
|
||||||
|
'form_prefixFTPfolder' => '',
|
||||||
|
'form_defaultdataFTP' => array('document', 'preview', 'caption'),
|
||||||
|
'mail_notifications' => '1'
|
||||||
|
));
|
||||||
|
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
$this->assertTrue($response->isRedirect());
|
||||||
|
$this->assertEquals('minet', $core->getAUthenticatedUser()->get_lastname());
|
||||||
|
}
|
||||||
|
}
|
39
tests/Alchemy/Phrasea/Security/FirewallTest.php
Normal file
39
tests/Alchemy/Phrasea/Security/FirewallTest.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
|
||||||
|
|
||||||
|
class FirewallTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||||
|
{
|
||||||
|
protected $client;
|
||||||
|
|
||||||
|
public function createApplication()
|
||||||
|
{
|
||||||
|
$app = require __DIR__ . '/../../../../lib/Alchemy/Phrasea/Application/Admin.php';
|
||||||
|
|
||||||
|
$app['debug'] = true;
|
||||||
|
unset($app['exception_handler']);
|
||||||
|
|
||||||
|
return $app;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
$this->client = $this->createClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRequiredAuth()
|
||||||
|
{
|
||||||
|
$core = \bootstrap::getCore();
|
||||||
|
$response = $core['Firewall']->requireAuthentication($this->app);
|
||||||
|
$this->assertNull($response);
|
||||||
|
$appbox = \appbox::get_instance($core);
|
||||||
|
$session = $appbox->get_session();
|
||||||
|
$session->logout();
|
||||||
|
$response = $core['Firewall']->requireAuthentication($this->app);
|
||||||
|
$this->assertTrue($response->isRedirect());
|
||||||
|
$this->assertEquals('/login/', $response->headers->get('location'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@@ -48,6 +48,8 @@
|
|||||||
|
|
||||||
RewriteRule ^robots.txt$ /index.php [L]
|
RewriteRule ^robots.txt$ /index.php [L]
|
||||||
RewriteRule ^feeds/.*$ /index.php [L]
|
RewriteRule ^feeds/.*$ /index.php [L]
|
||||||
|
RewriteRule ^account/.*$ /index.php [L]
|
||||||
|
RewriteRule ^developers/.*$ /index.php [L]
|
||||||
|
|
||||||
# RewriteRule ^atom\/(cooliris)+\/?([0-9]*)\/?$ /cooliris.php?item_id=$2 [L]
|
# RewriteRule ^atom\/(cooliris)+\/?([0-9]*)\/?$ /cooliris.php?item_id=$2 [L]
|
||||||
|
|
||||||
|
@@ -81,6 +81,7 @@ if ($request->has_post_datas()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count(array_diff($accountFields, array_keys($request->get_post_datas()))) == 0) {
|
if (count(array_diff($accountFields, array_keys($request->get_post_datas()))) == 0) {
|
||||||
|
|
||||||
$defaultDatas = 0;
|
$defaultDatas = 0;
|
||||||
@@ -123,6 +124,7 @@ if ($request->has_post_datas()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->has_post_datas()) {
|
if ($request->has_post_datas()) {
|
||||||
$evt_mngr = eventsmanager_broker::getInstance($appbox, $Core);
|
$evt_mngr = eventsmanager_broker::getInstance($appbox, $Core);
|
||||||
$notifications = $evt_mngr->list_notifications_available($appbox->get_session()->get_usr_id());
|
$notifications = $evt_mngr->list_notifications_available($appbox->get_session()->get_usr_id());
|
||||||
@@ -144,649 +146,42 @@ if ($request->has_post_datas()) {
|
|||||||
$user->setPrefs('notification_' . $k, $v);
|
$user->setPrefs('notification_' . $k, $v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$geonames = new geonames();
|
$geonames = new geonames();
|
||||||
$user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
|
$user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
|
||||||
|
|
||||||
|
$notice = '';
|
||||||
|
if ( ! is_null($parm['notice'])) {
|
||||||
|
switch ($parm['notice']) {
|
||||||
|
case 'password-update-ok':
|
||||||
|
$notice = _('login::notification: Mise a jour du mot de passe avec succes');
|
||||||
|
break;
|
||||||
|
case 'account-update-ok':
|
||||||
|
$notice = _('login::notification: Changements enregistres');
|
||||||
|
break;
|
||||||
|
case 'account-update-bad':
|
||||||
|
$notice = _('forms::erreurs lors de l\'enregistrement des modifications');
|
||||||
|
break;
|
||||||
|
case 'demand-ok':
|
||||||
|
$notice = _('login::notification: Vos demandes ont ete prises en compte');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$demandes = giveMeBaseUsr($usr_id, $lng);
|
||||||
|
$evt_mngr = eventsmanager_broker::getInstance($appbox, $Core);
|
||||||
|
$notifications = $evt_mngr->list_notifications_available($appbox->get_session()->get_usr_id());
|
||||||
|
|
||||||
|
$parameters = array(
|
||||||
|
'geonames' => $geonames,
|
||||||
|
'user' => $user,
|
||||||
|
'notice' => $notice,
|
||||||
|
'demandes' => $demandes,
|
||||||
|
'evt_mngr' => $evt_mngr,
|
||||||
|
'notifications' => $notifications,
|
||||||
|
);
|
||||||
|
|
||||||
|
$Core['Twig']->display('user/account.html.twig', $parameters);
|
||||||
|
|
||||||
|
return;
|
||||||
?>
|
?>
|
||||||
<html lang="<?php echo $appbox->get_session()->get_I18n(); ?>">
|
|
||||||
<head>
|
|
||||||
<title><?php echo $appbox->get_registry()->get('GV_homeTitle') ?> <?php echo _('login:: Mon compte') ?></title>
|
|
||||||
<link REL="stylesheet" TYPE="text/css" HREF="/include/minify/f=login/home.css,login/geonames.css"/>
|
|
||||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js"></script>
|
|
||||||
<script type="text/javascript" language="javascript" src="/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
|
|
||||||
<script type="text/javascript" src="/login/geonames.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function(){
|
|
||||||
|
|
||||||
var trans = {
|
|
||||||
'confirm_delete' : "<?php echo _("etes vous sur de vouloir supprimer cette application"); ?>"
|
|
||||||
,'yes' : "<?php echo _("oui"); ?>"
|
|
||||||
,'no' : "<?php echo _("non"); ?>"
|
|
||||||
}
|
|
||||||
$( "#tab-account-cat").tabs({
|
|
||||||
ajaxOptions: {
|
|
||||||
error: function( xhr, status, index, anchor ) {
|
|
||||||
$( anchor.hash ).html("<?php echo _('Erreur lors du chargement') ?>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
initialize_geoname_field($('#form_geonameid'));
|
|
||||||
|
|
||||||
$("#generate_access").live("click", function(){
|
|
||||||
var app_id = $(this).attr("value");
|
|
||||||
var usr_id = $(this).closest("div").attr("id");
|
|
||||||
var opts = {
|
|
||||||
type:"POST",
|
|
||||||
url : '/api/oauthv2/applications/'+ app_id +'/generate_access_token/',
|
|
||||||
dataType: 'json',
|
|
||||||
data : {
|
|
||||||
usr_id : usr_id
|
|
||||||
},
|
|
||||||
success : function(data){
|
|
||||||
if(data.ok)
|
|
||||||
$("#my_access_token").empty().append(data.token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jQuery.ajax(opts);
|
|
||||||
});
|
|
||||||
|
|
||||||
var $url_callback_event = function(event) {
|
|
||||||
if ( event.type == "mouseover" ) {
|
|
||||||
$(this).find(".modifier_callback").show();
|
|
||||||
} else {
|
|
||||||
$(this).find(".modifier_callback").hide();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var $event = function(event){
|
|
||||||
if ( event.type == "mouseover" ) {
|
|
||||||
$(this).find(".delete_app").show();
|
|
||||||
} else {
|
|
||||||
$(this).find(".delete_app").hide();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$(".url_callback").live("mouseover mouseout", $url_callback_event);
|
|
||||||
|
|
||||||
$(".app-list li").live("mouseover mouseout", $event);
|
|
||||||
|
|
||||||
$(".modifier_callback").live("click", function(){
|
|
||||||
$(this).hide();
|
|
||||||
$(".save_callback").show();
|
|
||||||
var cur_value = $(".url_callback_input").html();
|
|
||||||
$(".url_callback_input")
|
|
||||||
.empty()
|
|
||||||
.wrapInner('<input value = "'+cur_value+'" name="oauth_callback" size="50" type="text"/>');
|
|
||||||
$(".url_callback").die();
|
|
||||||
$(".save_callback").live("click", function(){
|
|
||||||
var callback = $("input[name=oauth_callback]").val();
|
|
||||||
var app_id = $("input[name=app_id]").val();
|
|
||||||
var $this = $(this);
|
|
||||||
var option = {
|
|
||||||
type:"POST",
|
|
||||||
url : "/api/oauthv2/applications/oauth_callback",
|
|
||||||
dataType: 'json',
|
|
||||||
data :{app_id : app_id, callback : callback},
|
|
||||||
success : function(data){
|
|
||||||
if(data.success == true)
|
|
||||||
$(".url_callback_input").empty().append(callback);
|
|
||||||
else
|
|
||||||
$(".url_callback_input").empty().append(cur_value);
|
|
||||||
$this.hide();
|
|
||||||
$(".url_callback").live("mouseover mouseout", $url_callback_event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$.ajax(option);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".app_submit").live("click", function(){
|
|
||||||
var form = $(this).closest("form");
|
|
||||||
var action = form.attr("action");
|
|
||||||
var option = {
|
|
||||||
type:"POST",
|
|
||||||
url : action,
|
|
||||||
dataType: 'html',
|
|
||||||
data : form.serializeArray(),
|
|
||||||
success : function(data){
|
|
||||||
$(".ui-tabs-panel:visible").empty().append(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$.ajax(option);
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#form_create input[name=type]").live("click", function(){
|
|
||||||
if($(this).val() == "desktop")
|
|
||||||
$("#form_create .callback td").hide().find("input").val('');
|
|
||||||
else
|
|
||||||
$("#form_create .callback td").show();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.grant-type').live('click', function(){
|
|
||||||
var appId = $(this).val();
|
|
||||||
var grant = $(this).is(":checked") ? "1": "0";
|
|
||||||
var opts = {
|
|
||||||
type:"POST",
|
|
||||||
url : '/api/oauthv2/applications/' + appId + '/grant_password/',
|
|
||||||
dataType: 'json',
|
|
||||||
data : {
|
|
||||||
grant : grant
|
|
||||||
},
|
|
||||||
success : function(data){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$.ajax(opts);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".app-btn").live("click", function(){
|
|
||||||
|
|
||||||
if (!$(this).hasClass("authorize"))
|
|
||||||
{
|
|
||||||
var revoke = 1;
|
|
||||||
var button_class = "authorize";
|
|
||||||
var old_class ="revoke";
|
|
||||||
var string = "<?php echo _('Authoriser l\'access'); ?>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($(this).hasClass("authorize"))
|
|
||||||
{
|
|
||||||
var revoke = 0;
|
|
||||||
var button_class = "revoke";
|
|
||||||
var old_class ="authorize";
|
|
||||||
var string = "<?php echo _('Revoquer l\'access'); ?>";
|
|
||||||
}
|
|
||||||
|
|
||||||
var acc_id = $(this).attr("value");
|
|
||||||
var current = $(this);
|
|
||||||
var opts = {
|
|
||||||
type:"POST",
|
|
||||||
url : '/api/oauthv2/applications/revoke_access/',
|
|
||||||
dataType: 'json',
|
|
||||||
data : {
|
|
||||||
account_id : acc_id,
|
|
||||||
revoke : revoke
|
|
||||||
},
|
|
||||||
success : function(data){
|
|
||||||
if(data.ok)
|
|
||||||
{
|
|
||||||
div = current.closest("div");
|
|
||||||
current.removeClass(old_class).addClass(button_class);
|
|
||||||
current.attr("value", acc_id);
|
|
||||||
current.empty().append(string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$.ajax(opts);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$("#app_dev, #app_dev_new, #app_dev_create, a.dev_back").live("click", function(e){
|
|
||||||
e.preventDefault();
|
|
||||||
target = $(this).attr("href");
|
|
||||||
var opts = {
|
|
||||||
type:"GET",
|
|
||||||
url : target,
|
|
||||||
dataType: 'html',
|
|
||||||
success : function(data){
|
|
||||||
$(".ui-tabs-panel:visible").empty().append(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$.ajax(opts);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$(".delete_app").die().live("click", function(){
|
|
||||||
var id = $(this).closest("li").attr('id').split("_");;
|
|
||||||
var app_id = id[1];
|
|
||||||
var $this= $(this);
|
|
||||||
$("body").append("<div id='confirm_delete'><p>"+trans.confirm_delete+" ? </p></div>")
|
|
||||||
$("#confirm_delete").dialog({
|
|
||||||
resizable: false,
|
|
||||||
autoOpen :true,
|
|
||||||
title: "",
|
|
||||||
draggable: false,
|
|
||||||
width:340,
|
|
||||||
modal: true,
|
|
||||||
buttons: [{
|
|
||||||
id: "ybutton",
|
|
||||||
text: trans.yes,
|
|
||||||
click: function() {
|
|
||||||
var opts = {
|
|
||||||
type:"DELETE",
|
|
||||||
url : '/api/oauthv2/applications/'+ app_id,
|
|
||||||
dataType: 'json',
|
|
||||||
data : {},
|
|
||||||
success : function(data){
|
|
||||||
if(data.success == true)
|
|
||||||
{
|
|
||||||
$this.closest("li").remove();
|
|
||||||
$("#confirm_delete").dialog("close");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$.ajax(opts);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "nbutton",
|
|
||||||
text: trans.no,
|
|
||||||
click: function() {
|
|
||||||
$( this ).dialog( "close" );
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
close : function() {
|
|
||||||
$( this ).remove();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<style type="text/css">
|
|
||||||
.tab-content{
|
|
||||||
height:auto;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div style="width:950px;margin-left:auto;margin-right:auto;">
|
|
||||||
<div style="margin-top:70px;height:35px;">
|
|
||||||
<table style="width:100%;">
|
|
||||||
<tr style="height:35px;">
|
|
||||||
<td style="width:580px;"><span class="title-name"><?php echo $appbox->get_registry()->get('GV_homeTitle') ?></span><span class="title-desc"><?php echo _('login:: Mon compte') ?></span></td>
|
|
||||||
<td style="color:#b1b1b1;text-align:right;">
|
|
||||||
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane">
|
|
||||||
<div id="id-main" class="tab-content" style="display:block;text-align:center;overflow-y:auto;overflow-x:hidden;">
|
|
||||||
<div id="tab-account-cat">
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><a href="#tab-account-info"><?php echo _('Informations'); ?></a></li>
|
|
||||||
<li><a href="#tab-account-access"><?php echo _('Acces'); ?></a></li>
|
|
||||||
<li><a href="#tab-account-session"><?php echo _('Sessions'); ?></a></li>
|
|
||||||
<li><a href="/api/oauthv2/applications" title="tab-account-app"><?php echo _('Applications'); ?></a></li>
|
|
||||||
<li><a href="/api/oauthv2/applications/dev" title="tab-account-dev"><?php echo _('Developpeur'); ?></a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="tab-account-info">
|
|
||||||
<table>
|
|
||||||
<tr valign="top">
|
|
||||||
<td style="width:98%">
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$notice = '';
|
|
||||||
if ( ! is_null($parm['notice'])) {
|
|
||||||
switch ($parm['notice']) {
|
|
||||||
case 'password-update-ok':
|
|
||||||
$notice = _('login::notification: Mise a jour du mot de passe avec succes');
|
|
||||||
break;
|
|
||||||
case 'account-update-ok':
|
|
||||||
$notice = _('login::notification: Changements enregistres');
|
|
||||||
break;
|
|
||||||
case 'account-update-bad':
|
|
||||||
$notice = _('forms::erreurs lors de l\'enregistrement des modifications');
|
|
||||||
break;
|
|
||||||
case 'demand-ok':
|
|
||||||
$notice = _('login::notification: Vos demandes ont ete prises en compte');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($notice != '') {
|
|
||||||
?>
|
|
||||||
<div class="notice"><?php echo $notice ?></div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<form name="account" id="account" action="/login/account.php" method="post">
|
|
||||||
<table style="margin:20px auto;">
|
|
||||||
<tr>
|
|
||||||
<td></td>
|
|
||||||
<td><a href="/login/reset-password.php" class="link" target="_self"><?php echo _('admin::compte-utilisateur changer mon mot de passe'); ?></a></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_login"><?php echo _('admin::compte-utilisateur identifiant'); ?></label></td>
|
|
||||||
<td class="form_input"><?php echo $user->get_login() ?></td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_gender"><?php echo _('admin::compte-utilisateur sexe') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<select class="input_element" name="form_gender" id="form_gender" >
|
|
||||||
<option <?php echo ($user->get_gender() == "0" ? "selected" : "") ?> value="0" ><?php echo _('admin::compte-utilisateur:sexe: mademoiselle'); ?></option>
|
|
||||||
<option <?php echo ($user->get_gender() == "1" ? "selected" : "") ?> value="1" ><?php echo _('admin::compte-utilisateur:sexe: madame'); ?></option>
|
|
||||||
<option <?php echo ($user->get_gender() == "2" ? "selected" : "") ?> value="2" ><?php echo _('admin::compte-utilisateur:sexe: monsieur'); ?></option>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_lastname"><?php echo _('admin::compte-utilisateur nom'); ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_lastname" id="form_lastname" value="<?php echo $user->get_lastname() ?>" >
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_firstname"><?php echo _('admin::compte-utilisateur prenom'); ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_firstname" id="form_firstname" value="<?php echo $user->get_firstname() ?>" >
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3">
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for=""><?php echo _('admin::compte-utilisateur email') ?></label></td>
|
|
||||||
<td class="form_input" colspan="2">
|
|
||||||
<?php echo $user->get_email() ?> <a class="link" href="/login/reset-email.php" target="_self"><?php echo _('login:: Changer mon adresse email') ?></a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3"><?php echo _('Email notification') ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
$evt_mngr = eventsmanager_broker::getInstance($appbox, $Core);
|
|
||||||
$notifications = $evt_mngr->list_notifications_available($appbox->get_session()->get_usr_id());
|
|
||||||
|
|
||||||
foreach ($notifications as $notification_group => $nots) {
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td style="font-weight:bold;" colspan="3"><?php echo $notification_group; ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
foreach ($nots as $notification) {
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label" colspan="2"><label for="notif_<?php echo $notification['id'] ?>"><?php echo $notification['description'] ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input type="checkbox" id="notif_<?php echo $notification['id'] ?>" name="notifications[<?php echo $notification['id'] ?>]" <?php echo $user->getPrefs('notification_' . $notification['id']) == '0' ? '' : 'checked'; ?> value="1"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_address"><?php echo _('admin::compte-utilisateur adresse') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_address" id="form_address" value="<?php echo $user->get_address() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_zip"><?php echo _('admin::compte-utilisateur code postal') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_zip", id="form_zip" value="<?php echo $user->get_zipcode() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_city"><?php echo _('admin::compte-utilisateur ville') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input id="form_geonameid" type="text" geonameid="<?php echo $user->get_geonameid() ?>" value="<?php echo $geonames->name_from_id($user->get_geonameid()) ?>" class="input_element geoname_field" name="form_geonameid">
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"></td>
|
|
||||||
<td class="form_input"><div id="test_city" style="position:absolute;width:200px;max-height:200px;overflow-y:auto;z-index:99999;"></div></td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3">
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_function"><?php echo _('admin::compte-utilisateur poste') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_function" id="form_function" value="<?php echo $user->get_position() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_company"><?php echo _('admin::compte-utilisateur societe') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_company" id="form_company" value="<?php echo $user->get_company() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_activity"><?php echo _('admin::compte-utilisateur activite') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_activity" id="form_activity" value="<?php echo $user->get_job() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_phone"><?php echo _('admin::compte-utilisateur telephone') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_phone" id="form_phone" value="<?php echo $user->get_tel() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_fax"><?php echo _('admin::compte-utilisateur fax') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_fax" id="form_fax" value="<?php echo $user->get_fax() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3">
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_activeFTP"><?php echo _('admin::compte-utilisateur:ftp: Activer le compte FTP'); ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input onchange="if(this.checked){$('#ftpinfos').slideDown();}else{$('#ftpinfos').slideUp();}" style="" type="checkbox" class="checkbox" <?php echo ($user->get_activeftp() ? "checked" : "") ?> name="form_activeFTP" id="form_activeFTP">
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="3">
|
|
||||||
<div id="ftpinfos" style="display:<?php echo ($user->get_activeftp() ? "block" : "none") ?>;">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_addrFTP"><?php echo _('phraseanet:: adresse') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_addrFTP" id="form_addrFTP" value="<?php echo $user->get_ftp_address() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_loginFTP"><?php echo _('admin::compte-utilisateur identifiant') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_loginFTP" id="form_loginFTP" value="<?php echo $user->get_ftp_login() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_pwdFTP"><?php echo _('admin::compte-utilisateur mot de passe') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="password" name="form_pwdFTP" id="form_pwdFTP" value="<?php echo $user->get_ftp_password() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_destFTP"><?php echo _('admin::compte-utilisateur:ftp: repertoire de destination ftp') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_destFTP" id="form_destFTP" value="<?php echo $user->get_ftp_dir() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_prefixFTPfolder"><?php echo _('admin::compte-utilisateur:ftp: prefixe des noms de dossier ftp') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_prefixFTPfolder" id="form_prefixFTPfolder" value="<?php echo $user->get_ftp_dir_prefix() ?>"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="form_label"><label for="form_passifFTP"><?php echo _('admin::compte-utilisateur:ftp: Utiliser le mode passif') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input type="checkbox" <?php echo ($user->get_ftp_passif() == "1" ? "checked" : "") ?> name="form_passifFTP" id="form_passifFTP"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr style="display:none;">
|
|
||||||
<td class="form_label"><label for="form_retryFTP"><?php echo _('admin::compte-utilisateur:ftp: Nombre d\'essais max') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="input_element" type="text" name="form_retryFTP" id="form_retryFTP" value="5"/>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
<tr style="display:none;">
|
|
||||||
<td class="form_label"><label for="form_defaultdataFTP"><?php echo _('admin::compte-utilisateur:ftp: Donnees envoyees automatiquement par ftp') ?></label></td>
|
|
||||||
<td class="form_input">
|
|
||||||
<input class="checkbox" type="checkbox" <?php echo ((($user->get_defaultftpdatas() >> 2) & 1) == 1 ? "checked" : "") ?> name="form_defaultdataFTP[]" value="document" id="form_defaultSendDocument"><label for="form_defaultSendDocument"><?php echo _('phraseanet:: original'); ?></label>
|
|
||||||
<input class="checkbox" type="checkbox" <?php echo ((($user->get_defaultftpdatas() >> 1) & 1) == 1 ? "checked" : "") ?> name="form_defaultdataFTP[]" value="preview" id="form_defaultSendPreview"><label for="form_defaultSendPreview"><?php echo _('phraseanet:: preview'); ?></label>
|
|
||||||
<input class="checkbox" type="checkbox" <?php echo (($user->get_defaultftpdatas() & 1) == 1 ? "checked" : "") ?> name="form_defaultdataFTP[]" value="caption" id="form_defaultSendCaption"><label for="form_defaultSendCaption"><?php echo _('phraseanet:: imagette'); ?></label>
|
|
||||||
</td>
|
|
||||||
<td class="form_alert"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<div style="text-align:center;margin:5px 0;">
|
|
||||||
<input type="submit" value="<?php echo _('boutton::valider'); ?>">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- END TAB ACCOUNT -->
|
|
||||||
<!-- START TAB ACCESS -->
|
|
||||||
<div id="tab-account-access">
|
|
||||||
|
|
||||||
|
|
||||||
<form name="updatingDemand" id="updatingDemand" action="/login/account.php" method="post">
|
|
||||||
<?php
|
|
||||||
$demandes = giveMeBaseUsr($usr_id, $lng);
|
|
||||||
echo $demandes['tab'];
|
|
||||||
?>
|
|
||||||
<input type="submit" value="<?php echo _('boutton::valider'); ?>"/>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- END TAB ACCESS -->
|
|
||||||
<!-- START TAB SESSION -->
|
|
||||||
|
|
||||||
<div id="tab-account-session">
|
|
||||||
<table style="width:80%;margin:0 auto;">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th colspan="7" style="text-align:left;">
|
|
||||||
<?php echo _('My sessions') ?>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo _('Date of connection') ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo _('Last access') ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo _('IP adress') ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo _('Browser') ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo _('Screen') ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo _('Persistent session') ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
foreach ($appbox->get_session()->get_my_sessions() as $row) {
|
|
||||||
?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
if ($appbox->get_session()->get_ses_id() != $row['session_id']) {
|
|
||||||
?>
|
|
||||||
<img src="/skins/icons/delete.png"/>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo phraseadate::getDate(new DateTime($row['created_on'])) ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo phraseadate::getDate(new DateTime($row['lastaccess'])) ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo $row['ip'] ?>
|
|
||||||
<?php echo $row['ip_infos'] ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
echo $row['browser'];
|
|
||||||
echo ' ' . $row['browser_version']
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo $row['screen'] ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php echo $row['token'] ? 'oui' : '' ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<!-- END TAB SESSION -->
|
|
||||||
<!-- START TAB APPLICATION -->
|
|
||||||
<div id="tab-account-app">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="tab-account-dev">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="text-align:right;position:relative;margin:18px 10px 0 0;font-size:10px;font-weight:normal;"><span>© Copyright Alchemy 2005-<?php echo date('Y') ?></span></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
@@ -83,7 +83,7 @@ if (( ! is_null($parm['login']) && ! is_null($parm['pwd'])) || $is_guest) {
|
|||||||
$usr_id = User_Adapter::get_usr_id_from_login($parm['login']);
|
$usr_id = User_Adapter::get_usr_id_from_login($parm['login']);
|
||||||
$url = random::getUrlToken(\random::TYPE_PASSWORD, $usr_id, $date);
|
$url = random::getUrlToken(\random::TYPE_PASSWORD, $usr_id, $date);
|
||||||
|
|
||||||
$url = '/login/forgotpwd.php?token=' . $url . '&salt=1';
|
$url = '/account/forgot-password/?token=' . $url . '&salt=1';
|
||||||
|
|
||||||
return phrasea::redirect($url);
|
return phrasea::redirect($url);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@@ -1,278 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* This file is part of Phraseanet
|
|
||||||
*
|
|
||||||
* (c) 2005-2012 Alchemy
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
|
||||||
* @link www.phraseanet.com
|
|
||||||
*/
|
|
||||||
/* @var $Core \Alchemy\Phrasea\Core */
|
|
||||||
$Core = require_once __DIR__ . "/../../lib/bootstrap.php";
|
|
||||||
|
|
||||||
$appbox = appbox::get_instance($Core);
|
|
||||||
$session = $appbox->get_session();
|
|
||||||
$registry = $appbox->get_registry();
|
|
||||||
|
|
||||||
$request = http_request::getInstance();
|
|
||||||
$symfoRequest = Symfony\Component\HttpFoundation\Request::createFromGlobals();
|
|
||||||
$parm = $request->get_parms('salt', 'error', 'sent', 'token', 'form_password', 'form_password_confirm', 'mail');
|
|
||||||
|
|
||||||
$needed = array();
|
|
||||||
|
|
||||||
if (isset($parm["mail"]) && trim($parm["mail"]) != "") {
|
|
||||||
if ( ! PHPMailer::ValidateAddress($parm['mail'])) {
|
|
||||||
return phrasea::redirect('/login/forgotpwd.php?error=noaccount');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
$usr_id = User_Adapter::get_usr_id_from_email($parm['mail']);
|
|
||||||
$user = User_Adapter::getInstance($usr_id, $appbox);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return phrasea::redirect('/login/forgotpwd.php?error=noaccount');
|
|
||||||
}
|
|
||||||
|
|
||||||
$date = new DateTime('1 day');
|
|
||||||
$url = random::getUrlToken(\random::TYPE_PASSWORD, $user->get_id(), $date);
|
|
||||||
|
|
||||||
if ($url !== false) {
|
|
||||||
$url = $registry->get('GV_ServerName') . 'login/forgotpwd.php?token=' . $url;
|
|
||||||
if (mail::forgot_passord($parm['mail'], $user->get_login(), $url) === true) {
|
|
||||||
return phrasea::redirect('/login/forgotpwd.php?sent=ok');
|
|
||||||
} else {
|
|
||||||
return phrasea::redirect('/login/forgotpwd.php?error=mailserver');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return phrasea::redirect('/login/forgotpwd.php?error=noaccount');
|
|
||||||
}
|
|
||||||
if (isset($parm['token']) && isset($parm['form_password']) && isset($parm['form_password_confirm'])) {
|
|
||||||
if ($parm['form_password'] !== $parm['form_password_confirm'])
|
|
||||||
$needed['form_password'] = $needed['form_password_confirm'] = _('forms::les mots de passe ne correspondent pas');
|
|
||||||
elseif (strlen(trim($parm['form_password'])) < 5)
|
|
||||||
$needed['form_password'] = _('forms::la valeur donnee est trop courte');
|
|
||||||
elseif (trim($parm['form_password']) != str_replace(array("\r\n", "\n", "\r", "\t", " "), "_", $parm['form_password']))
|
|
||||||
$needed['form_password'] = _('forms::la valeur donnee contient des caracteres invalides');
|
|
||||||
|
|
||||||
if (count($needed) == 0) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
$datas = random::helloToken($parm['token']);
|
|
||||||
$user = User_Adapter::getInstance($datas['usr_id'], $appbox);
|
|
||||||
$user->set_password($parm['form_password_confirm']);
|
|
||||||
|
|
||||||
\mail::change_password($user, $symfoRequest->getClientIp(), new \DateTime());
|
|
||||||
|
|
||||||
random::removeToken($parm['token']);
|
|
||||||
|
|
||||||
return phrasea::redirect('/login/index.php?confirm=password-update-ok');
|
|
||||||
} catch (Exception_NotFound $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
phrasea::headers();
|
|
||||||
?>
|
|
||||||
<html lang="<?php echo $session->get_I18n(); ?>">
|
|
||||||
<head>
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
|
||||||
<link type="text/css" rel="stylesheet" href="/login/home.css" />
|
|
||||||
<title><?php echo _('admin::compte-utilisateur changer mon mot de passe'); ?></title>
|
|
||||||
</head>
|
|
||||||
<body >
|
|
||||||
<div style="width:950px;margin:0 auto;">
|
|
||||||
<div style="margin-top:70px;height:35px;">
|
|
||||||
<table style="width:100%;">
|
|
||||||
<tr style="height:35px;">
|
|
||||||
<td style="width:auto;"><div style="font-size:28px;color:#b1b1b1;"><?php echo $registry->get('GV_homeTitle') ?></div></td>
|
|
||||||
<td style="color:#b1b1b1;text-align:right;">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div style="height:530px;background-color:#525252;">
|
|
||||||
<div id="id-main" class="tab-content" style="display:block;">
|
|
||||||
<!--<div style="width:560px;float:left;height:490px;">
|
|
||||||
<img src="/skins/icons/home.jpg" style="margin: 85px 10px; width: 540px;"/>
|
|
||||||
</div>-->
|
|
||||||
<div xstyle="width:360px;float:right;height:490px;">
|
|
||||||
<div style="margin:40px 25px;float:left;width:880px;">
|
|
||||||
<?php
|
|
||||||
$tokenize = false;
|
|
||||||
if ($parm['token'] !== null) {
|
|
||||||
try {
|
|
||||||
random::helloToken($parm['token']);
|
|
||||||
$tokenize = true;
|
|
||||||
?>
|
|
||||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js"></script>
|
|
||||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.js"></script>
|
|
||||||
<script type="text/javascript" language="javascript" src="/include/minify/f=include/jslibs/jquery.validate.password.js"></script>
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript" >
|
|
||||||
<?php
|
|
||||||
$rules = 'form_password_confirm:{required:true}';
|
|
||||||
$msg = '
|
|
||||||
form_password_confirm : {equalTo:"' . _('forms::les mots de passe ne correspondent pas') . '"}';
|
|
||||||
?>
|
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
$.validator.passwordRating.messages = {
|
|
||||||
"similar-to-username": "<?php echo _('forms::le mot de passe est trop similaire a l\'identifiant'); ?>",
|
|
||||||
"too-short": "<?php echo _('forms::la valeur donnee est trop courte') ?>",
|
|
||||||
"very-weak": "<?php echo _('forms::le mot de passe est trop simple') ?>",
|
|
||||||
"weak": "<?php echo _('forms::le mot de passe est trop simple') ?>",
|
|
||||||
"good": "<?php echo _('forms::le mot de passe est bon') ?>",
|
|
||||||
"strong": "<?php echo _('forms::le mot de passe est tres bon') ?>"
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#password-reset").validate(
|
|
||||||
{
|
|
||||||
rules: {
|
|
||||||
<?php echo $rules ?>
|
|
||||||
},
|
|
||||||
messages: {
|
|
||||||
<?php echo $msg ?>
|
|
||||||
},
|
|
||||||
errorPlacement: function(error, element) {
|
|
||||||
error.prependTo( element.parent().parent().next().find('.form_alert') );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$('#form_password').rules("add",{password: "#form_login"});
|
|
||||||
$('#form_password_confirm').rules("add",{equalTo: "#form_password"});
|
|
||||||
$("#form_password").valid();
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if ($parm['salt']) {
|
|
||||||
?>
|
|
||||||
<div class="notice" style="text-align:center;margin:20px 40px;padding:10px;font-weight:bold;font-size:14px;">
|
|
||||||
<?php echo _('Pour ameliorer la securite de l\'application, vous devez mettre a jour votre mot de passe.'); ?><br/>
|
|
||||||
<?php echo _('Cette tache ne pouvant etre automatisee, merci de bien vouloir la realiser.'); ?>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<form name="send" action="forgotpwd.php" method="post" id="password-reset" style="width:600px;margin:0 auto;">
|
|
||||||
<table cellspacing="0" cellpadding="0" border="0">
|
|
||||||
<tr style="height:30px;">
|
|
||||||
<td style="width:33%;"><label for="form_password"><?php echo _('admin::compte-utilisateur nouveau mot de passe') ?> :</label></td>
|
|
||||||
<td style="width:33%;">
|
|
||||||
<div class="form_input">
|
|
||||||
<input autocomplete="off" type="password" value="" id="form_password" name="form_password"/>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td style="width:33%;">
|
|
||||||
<div class="form_alert">
|
|
||||||
<?php echo isset($needed['form_password']) ? $needed['form_password'] : ''; ?>
|
|
||||||
<div class="password-meter">
|
|
||||||
<div class="password-meter-message"> </div>
|
|
||||||
<div class="password-meter-bg">
|
|
||||||
<div class="password-meter-bar"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr style="height:30px;">
|
|
||||||
<td>
|
|
||||||
<label for="form_password" ><?php echo _('admin::compte-utilisateur confirmer le mot de passe') ?> :</label></td>
|
|
||||||
<td>
|
|
||||||
<div class="form_input">
|
|
||||||
<input autocomplete="off" type="password" value="" id="form_password_confirm" name="form_password_confirm"/>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<div class="form_alert">
|
|
||||||
<?php echo isset($needed['form_password_confirm']) ? $needed['form_password_confirm'] : ''; ?>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr style="height:30px;">
|
|
||||||
<td></td>
|
|
||||||
<td>
|
|
||||||
<input type="hidden" value="<?php echo $parm['token']; ?>" name="token"/>
|
|
||||||
<input type="submit" value="valider"/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a class="link" href="index.php" target="_self"><?php echo _('login:: Retour a l\'accueil'); ?></a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
} catch (Exception_NotFound $e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
if ( ! $tokenize) {
|
|
||||||
$parm['error'] = 'token';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! $tokenize) {
|
|
||||||
echo '<form name="send" action="forgotpwd.php" method="post" style="width:600px;margin:0 auto;">';
|
|
||||||
|
|
||||||
if ($parm['error'] !== null) {
|
|
||||||
switch ($parm['error']) {
|
|
||||||
case 'mailserver':
|
|
||||||
echo '<div style="background:#00a8FF;">' . _('phraseanet::erreur: Echec du serveur mail') . '</div>';
|
|
||||||
break;
|
|
||||||
case 'noaccount':
|
|
||||||
echo '<div style="background:#00a8FF;">' . _('phraseanet::erreur: Le compte n\'a pas ete trouve') . '</div>';
|
|
||||||
break;
|
|
||||||
case 'mail':
|
|
||||||
echo '<div style="background:#00a8FF;">' . _('phraseanet::erreur: Echec du serveur mail') . '</div>';
|
|
||||||
break;
|
|
||||||
case 'token':
|
|
||||||
echo '<div style="background:#00a8FF;">' . _('phraseanet::erreur: l\'url n\'est plus valide') . '</div>';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($parm['sent'] !== null) {
|
|
||||||
switch ($parm['sent']) {
|
|
||||||
case 'ok':
|
|
||||||
echo '<div style="background:#00a8FF;">' . _('phraseanet:: Un email vient de vous etre envoye') . '</div>';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div style="margin-top:20px;font-size:16px;font-weight:bold;">
|
|
||||||
<?php echo _('login:: Forgot your password') ?>
|
|
||||||
</div>
|
|
||||||
<div style="margin-top:20px;">
|
|
||||||
<?php echo _('login:: Entrez votre adresse email') ?>
|
|
||||||
</div>
|
|
||||||
<div style="margin-top:20px;">
|
|
||||||
<input name="mail" type="text" style="width:100%">
|
|
||||||
</div>
|
|
||||||
<div style="margin-top:10px;">
|
|
||||||
<input type="submit" value="<?php echo _('boutton::valider'); ?>"/>
|
|
||||||
<a style="margin-left:120px;" class="link" href="index.php" target="_self"><?php echo _('login:: Retour a l\'accueil'); ?></a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="text-align:right;position:relative;margin:18px 10px 0 0;font-size:10px;font-weight:normal;"><span>© Copyright Alchemy 2005-<?php echo date('Y') ?></span></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@@ -186,14 +186,14 @@ if ($error) {
|
|||||||
</form>
|
</form>
|
||||||
<div>
|
<div>
|
||||||
<?php
|
<?php
|
||||||
echo '<div style="text-align:center;font-weight:bold;font-size:13px;margin:60px 0 0;">' . _('admin::compte-utilisateur A propos de la securite des mots de passe :') . '</div>';
|
echo '<div style="text-align:center;font-weight:bold;font-size:13px;margin:60px 0 0;">' . _('admin::compte-utilisateur A propos de la securite des mots de passe :') . '</div>';
|
||||||
echo '<div style="text-align:center;margin:20px 0 0;">' . _('admin::compte-utilisateur Les mots de passe doivent etre clairement distincts du login et contenir au moins deux types parmis les caracteres suivants :') . '</div>';
|
echo '<div style="text-align:center;margin:20px 0 0;">' . _('admin::compte-utilisateur Les mots de passe doivent etre clairement distincts du login et contenir au moins deux types parmis les caracteres suivants :') . '</div>';
|
||||||
echo '<div style="text-align:left;margin:10px auto;width:300px;"><ul>';
|
echo '<div style="text-align:left;margin:10px auto;width:300px;"><ul>';
|
||||||
echo '<li>' . _('admin::compte-utilisateur::securite caracteres speciaux') . '</li>';
|
echo '<li>' . _('admin::compte-utilisateur::securite caracteres speciaux') . '</li>';
|
||||||
echo '<li>' . _('admin::compte-utilisateur::securite caracteres majuscules') . '</li>';
|
echo '<li>' . _('admin::compte-utilisateur::securite caracteres majuscules') . '</li>';
|
||||||
echo '<li>' . _('admin::compte-utilisateur::securite caracteres minuscules') . '</li>';
|
echo '<li>' . _('admin::compte-utilisateur::securite caracteres minuscules') . '</li>';
|
||||||
echo '<li>' . _('admin::compte-utilisateur::securite caracteres numeriques') . '</li>';
|
echo '<li>' . _('admin::compte-utilisateur::securite caracteres numeriques') . '</li>';
|
||||||
echo '</ul></div>';
|
echo '</ul></div>';
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
57
www/skins/login/css/main.css
Normal file
57
www/skins/login/css/main.css
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/******* GLOBAL CSS for LOGIN *************************************************/
|
||||||
|
body,
|
||||||
|
html {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #000000;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
* {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
cursor: pointer;
|
||||||
|
color: #0088cc;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 18px;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
/******* NAVBAR ***************************************************************/
|
||||||
|
#tab-account-cat ul {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
#tab-account-cat ul li {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
#tab-account-cat ul li a {
|
||||||
|
color: #0088cc;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
#tab-account-cat ul li a:hover {
|
||||||
|
color: #0088cc;
|
||||||
|
}
|
||||||
|
/******* FORM *****************************************************************/
|
||||||
|
legend {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
.form-horizontal .control-group {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
legend + .control-group {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#id-main .account-menu li {
|
||||||
|
display: inline-block;
|
||||||
|
width:130px;
|
||||||
|
font-size:16px;
|
||||||
|
}
|
7
www/skins/login/csscompiler.sh
Executable file
7
www/skins/login/csscompiler.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
for i in $( ls less ); do
|
||||||
|
lessc $DIR/less/$i $DIR/css/`echo $i | sed -e 's/less/css/g'`
|
||||||
|
done
|
90
www/skins/login/less/main.less
Normal file
90
www/skins/login/less/main.less
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
//****** LESS SETTINGS ********************************************************/
|
||||||
|
|
||||||
|
// Colors & bg settings
|
||||||
|
@white: #FFF;
|
||||||
|
@black: #000;
|
||||||
|
@dark: #333;
|
||||||
|
@grey: #CCC;
|
||||||
|
@blue: #0088CC;
|
||||||
|
.bg(@c: @black) {
|
||||||
|
background-color: @c;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spaces settings
|
||||||
|
.no-space() {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Text settings
|
||||||
|
@size: 12px;
|
||||||
|
.color(@c: @white) {
|
||||||
|
color: @c;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Misc.
|
||||||
|
.cursor(@type: pointer) {
|
||||||
|
cursor: @type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******* GLOBAL CSS for LOGIN *************************************************/
|
||||||
|
|
||||||
|
body, html {
|
||||||
|
.no-space;
|
||||||
|
.bg;
|
||||||
|
.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
.cursor;
|
||||||
|
.color(@blue);
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 18px;
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/******* NAVBAR ***************************************************************/
|
||||||
|
|
||||||
|
#tab-account-cat {
|
||||||
|
ul {
|
||||||
|
list-style: none;
|
||||||
|
li {
|
||||||
|
display: inline;
|
||||||
|
a {
|
||||||
|
.color(@blue);
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 13px;
|
||||||
|
&:hover {
|
||||||
|
.color(@blue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/******* FORM *****************************************************************/
|
||||||
|
|
||||||
|
legend {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
.color(@white);
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
.color(@white);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-horizontal .control-group {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend + .control-group {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
Reference in New Issue
Block a user