diff --git a/templates/web/account/authorized_apps.html.twig b/templates/web/account/authorized_apps.html.twig
index db835740eb..5d7a65ccea 100644
--- a/templates/web/account/authorized_apps.html.twig
+++ b/templates/web/account/authorized_apps.html.twig
@@ -1,102 +1,67 @@
-{% extends 'account/base.html.twig' %}
+{% extends "account/base.html.twig" %}
{% block title %}
- {% trans 'Granted third party applications' %}
-{% endblock %}
-
-{% block head %}
-
+ {% trans "Granted third party applications" %}
{% endblock %}
{% set selected = "applications" %}
{% block content %}
-
-
-
-
{% trans 'Vous avez autorise ces applications a acceder a votre compte' %}
- {% if applications|length > 0 %}
-
- {% for application in applications %}
- -
-
- {% set account = application.get_user_account(app['authentication'].getUser()) %}
- {% if account.is_revoked() is empty %}
-
- {% else %}
-
- {% endif %}
-
-
- {{application.get_name()}}
-
- {% if application.get_creator() is not none %}
- {% set user_name = application.get_creator().get_display_name() %}
- {% trans %}
- par {{user_name}}
- {% endtrans %}
- {% endif%}
-
-
- {{ app['date-formatter'].getPrettyString(application.get_created_on()) }}
-
-
{{ application.get_description()|truncate(80, true, '...') }}
-
-
- {%endfor%}
-
- {% else %}
-
- {% trans 'Aucune application n\'a accés à vos données.' %}
-
- {% endif %}
+
+
+
+
{% trans "Vous avez autorise ces applications a acceder a votre compte" %}
+ {% if applications|length > 0 %}
+
+ {% for application in applications %}
+ -
+
+ {% set account = application.get_user_account(app["authentication"].getUser()) %}
+
{% trans "Revoquer l\'access" %}
+
{% trans "Authoriser l\'access" %}
+
+
+ {{ application.get_name() }}
+
+ {% if application.get_creator() is not none %}
+
+ {% set user_name = application.get_creator().get_display_name() %}
+ {% trans %}
+ par {{ user_name }}
+ {% endtrans %}
+
+ {% endif%}
+
+
+ {% trans "Not Allowed"%}
+ {% trans "Allowed"%}
+
+
{{ application.get_description()|truncate(120, true, "...") }}
+
+
+ {%endfor%}
+
+ {% else %}
+
+ {% trans "Aucune application n\'a accés à vos données." %}
+
+ {% endif %}
+
+
+
+
+
{% trans "Third-party applications" %}
+
+ {% trans "A third-party application is a product developed apart from Phraseanet and that would access Phraseanet data." %}
+
+
+
+
+
{% trans "Developpeurs" %}
+
+ {% trans "Les developpeurs peuvent editer l\'enregistrement de leurs application grace a l\'onglet 'developpeurs' ci-dessus" %}
+
+
-
-
{% trans 'Applications' %}
-
- {% trans 'Naviguez et gerez les applications que vous souhaitez autoriser a acceder a vos informations Phraseanet' %}
-
-
{% trans 'Developpeurs' %}
-
- {% trans 'Les developpeurs peuvent editer l\'enregistrement de leurs application grace a l\'onglet "developpeurs" ci-dessus' %}
-
-
-
{% endblock %}
diff --git a/templates/web/account/base.html.twig b/templates/web/account/base.html.twig
index 1ac6745de8..a2ab883e41 100644
--- a/templates/web/account/base.html.twig
+++ b/templates/web/account/base.html.twig
@@ -1,8 +1,8 @@
-
+
-
{{ app['phraseanet.registry'].get('GV_homeTitle') }} {% block title %}{% endblock %}
+
{{ app["phraseanet.registry"].get("GV_homeTitle") }} {% block title %}{% endblock %}
-
+
{% block head %}{% endblock %}
@@ -13,13 +13,13 @@
{% block menu %}
-
{{ app['phraseanet.registry'].get('GV_homeTitle') }} {{ block('title') }}
+
{{ app["phraseanet.registry"].get("GV_homeTitle") }} {{ block("title") }}
diff --git a/templates/web/account/reset-email.html.twig b/templates/web/account/reset-email.html.twig
index a210b688ae..2c34e3dc13 100644
--- a/templates/web/account/reset-email.html.twig
+++ b/templates/web/account/reset-email.html.twig
@@ -1,7 +1,7 @@
-{% extends 'account/base.html.twig' %}
+{% extends "account/base.html.twig" %}
{% block title %}
- {% trans 'Change my email address' %}
+ {% trans "Change my email address" %}
{% endblock %}
{% block head %}
@@ -20,25 +20,25 @@ $(document).ready(function() {
},
form_email_confirm : {
required:true,
- equalTo:'#form_email'
+ equalTo:"#form_email"
}
},
messages: {
form_password : {
- required : "{% trans 'forms::ce champ est requis' %}"
+ required : "{% trans "forms::ce champ est requis" %}"
},
form_email : {
- required : "{% trans 'forms::ce champ est requis' %}",
- email:"{% trans 'forms::l\'email semble invalide' %}"
+ 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' %}"
+ required : "{% trans "forms::ce champ est requis" %}",
+ equalTo : "{% trans "forms::les emails ne correspondent pas" %}"
}
},
errorPlacement: function(error, element) {
- error.appendTo(element.closest('.controls').find('.form_alert'));
+ error.appendTo(element.closest(".controls").find(".form_alert"));
}
});
});
@@ -52,58 +52,58 @@ $(document).ready(function() {
{% if updateMsg is not none %}
{% else %}
{% if noticeMsg is not none %}
- {% trans 'phraseanet::erreur : oups ! une erreur est survenue pendant l\'operation !' %}
+ {% trans "phraseanet::erreur : oups ! une erreur est survenue pendant l\'operation !" %}
{{ noticeMsg }}
-
{% trans 'admin::compte-utilisateur retour a mon compte'%}
+
{% trans "admin::compte-utilisateur retour a mon compte" %}
{% endif %}
-
- {% trans 'admin::compte-utilisateur: Pourquoi me demande-t-on mon mot de passe pour changer mon adresse email ?'%}
+ {% trans "admin::compte-utilisateur: Pourquoi me demande-t-on mon mot de passe pour changer mon adresse email ?"%}
- {% 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.'%}
+ {% 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."%}
{% endif %}
{% endblock %}
diff --git a/templates/web/account/sessions.html.twig b/templates/web/account/sessions.html.twig
index ed38285ab7..369d28326a 100644
--- a/templates/web/account/sessions.html.twig
+++ b/templates/web/account/sessions.html.twig
@@ -7,75 +7,75 @@
{% set selected = "sessions" %}
{% block content %}
-
-
-
-
-
- |
-
- {% trans 'Date de connexion' %}
- |
-
- {% trans 'Dernier access' %}
- |
-
- {% trans 'IP' %}
- |
-
- {% trans 'Browser' %}
- |
-
- {% trans 'ecran' %}
- |
-
- {% trans 'Session persistante' %}
- |
-
-
-
- {% for row in sessions %}
-
-
- {% if app['session'].get('phrasea_session_id') != row.Id() %}
-
- {% endif %}
- |
-
- {{ app['date-formatter'].getDate(row.getCreated()) }}
- |
-
- {{ app['date-formatter'].getDate(row.getUpdated()) }}
- |
-
- {% set geoname = app['geonames'].find_geoname_from_ip(row.getIpAddress()) %}
-
- {% if geoname['city'] %}
- {% set ip_infos = geoname['city'] ~ ' (' ~ geoname['country'] ~ ')' %}
- {% elseif geoname['fips'] %}
- {% set ip_infos = geoname['fips'] ~ ' (' ~ geoname['country'] ~ ')' %}
- {% elseif geoname['country'] %}
- {% set ip_infos = geoname['country'] %}
- {% else %}
- {% set ip_infos = '' %}
- {% endif %}
-
- {{ row.getIpAddress() }}
- {{ ip_infos }}
- |
-
- {{ row.getBrowserName() }} {{ row.getBrowserVersion() }}
- |
-
- {{ row.getScreenWidth() }} x {{ row.getScreenHeight() }}
- |
-
- {% if row.getToken %}{{ yes }}{% endif %}
- |
+
+
+
+
+
+ |
+
+ {% trans 'Date de connexion' %}
+ |
+
+ {% trans 'Dernier access' %}
+ |
+
+ {% trans 'IP' %}
+ |
+
+ {% trans 'Browser' %}
+ |
+
+ {% trans 'ecran' %}
+ |
+
+ {% trans 'Session persistante' %}
+ |
- {% endfor %}
-
-
+
+
+ {% for row in sessions %}
+
+
+ {% if app['session'].get('phrasea_session_id') != row.Id() %}
+
+ {% endif %}
+ |
+
+ {{ app['date-formatter'].getDate(row.getCreated()) }}
+ |
+
+ {{ app['date-formatter'].getDate(row.getUpdated()) }}
+ |
+
+ {% set geoname = app['geonames'].find_geoname_from_ip(row.getIpAddress()) %}
+
+ {% if geoname['city'] %}
+ {% set ip_infos = geoname['city'] ~ ' (' ~ geoname['country'] ~ ')' %}
+ {% elseif geoname['fips'] %}
+ {% set ip_infos = geoname['fips'] ~ ' (' ~ geoname['country'] ~ ')' %}
+ {% elseif geoname['country'] %}
+ {% set ip_infos = geoname['country'] %}
+ {% else %}
+ {% set ip_infos = '' %}
+ {% endif %}
+
+ {{ row.getIpAddress() }}
+ {{ ip_infos }}
+ |
+
+ {{ row.getBrowserName() }} {{ row.getBrowserVersion() }}
+ |
+
+ {{ row.getScreenWidth() }} x {{ row.getScreenHeight() }}
+ |
+
+ {% if row.getToken %}{{ yes }}{% endif %}
+ |
+
+ {% endfor %}
+
+
+
-
{% endblock %}
diff --git a/templates/web/developers/application.html.twig b/templates/web/developers/application.html.twig
index 66b29e6b11..69be12dc5c 100644
--- a/templates/web/developers/application.html.twig
+++ b/templates/web/developers/application.html.twig
@@ -1,13 +1,7 @@
-{% extends 'account/base.html.twig' %}
-
-{% use "developers/header.html.twig" with header as parent_header %}
+{% extends "account/base.html.twig" %}
{% block title %}
- {% trans 'Client application' %}
-{% endblock %}
-
-{% block head %}
- {{ block('parent_header') }}
+ {% trans "Client application" %}
{% endblock %}
{% set selected = "" %}
@@ -15,84 +9,91 @@
{% block content %}
-
{% trans 'Application' %}
-
+
{% trans "Application" %}
+
-
-
{{application.get_description }}
+
+
{{ application.get_description() }}
-
{% trans 'settings OAuth' %}
-
{% trans 'Les parametres oauth de votre application.' %}
+
{% trans "settings OAuth" %}
+
{% trans "Les parametres oauth de votre application." %}
-
{% trans 'Votre token d\'access' %}
-
{% trans 'Les paramétres oauth de votre application.' %}
+
{% trans "Votre token d\'access" %}
+
{% trans "Les paramétres oauth de votre application." %}
|
- {% trans 'Token' %}
+ {% trans "Token" %}
|
{% if not token is none %}
- {{token|default('')}}
+ {{ token|default("") }}
{% else %}
- {% trans 'Le token n\'a pas encore ete genere' %}
+ {% trans "Le token n\'a pas encore ete genere" %}
{% endif %}
-
+ {% trans "boutton::generer" %}
|
diff --git a/templates/web/developers/application_form.html.twig b/templates/web/developers/application_form.html.twig
index 3a2db272d2..8dd2a8c9d1 100644
--- a/templates/web/developers/application_form.html.twig
+++ b/templates/web/developers/application_form.html.twig
@@ -1,38 +1,32 @@
-{% extends 'account/base.html.twig' %}
-
-{% use "developers/header.html.twig" with header as parent_header %}
+{% extends "account/base.html.twig" %}
{% block title %}
- {% trans 'new client application' %}
-{% endblock %}
-
-{% block head %}
- {{ block('parent_header') }}
+ {% trans "new client application" %}
{% endblock %}
{% set selected = "" %}
{# form input macro #}
-{% macro input(name, value, violations, property, class='', type, size) %}
+{% macro input(name, value, violations, property, class="", type, size) %}
{% if violations is none %}
-
+
{% else %}
{% set hasError = "false" %}
{% for violation in violations %}
{% if violation.getPropertyPath == property and hasError == "false" %}
{% set hasError = "true" %}
-
+
{{ violation.getInvalidValue }} - {{violation.getMessage}}
{% endif %}
{% endfor %}
{% if hasError == "false" %}
-
+
{% endif %}
{% endif %}
{% endmacro %}
{# form textare macro #}
-{% macro textarea(name, value, violations,property, rows, cols, class='') %}
+{% macro textarea(name, value, violations,property, rows, cols, class="") %}
{% if violations is none %}
{% else %}
@@ -45,16 +39,16 @@
{% endif %}
{% endfor %}
{% if hasError == "false" %}
-
+
{% endif %}
{% endif %}
{% endmacro %}
{% block content %}
-
diff --git a/templates/web/developers/applications.html.twig b/templates/web/developers/applications.html.twig
index bdf86b0e75..740cd30e11 100644
--- a/templates/web/developers/applications.html.twig
+++ b/templates/web/developers/applications.html.twig
@@ -1,13 +1,7 @@
-{% extends 'account/base.html.twig' %}
-
-{% use "developers/header.html.twig" with header as parent_header %}
+{% extends "account/base.html.twig" %}
{% block title %}
- {% trans 'Client applications' %}
-{% endblock %}
-
-{% block head %}
- {{ block('parent_header') }}
+ {% trans "Client applications" %}
{% endblock %}
{% set selected = "developer" %}
@@ -17,61 +11,58 @@
Phraseanet Developer Center
-
{% trans 'Mes applications' %}
+
{% trans "Mes applications" %}
{% if applications|length > 0 %}
-
-
diff --git a/templates/web/developers/header.html.twig b/templates/web/developers/header.html.twig
deleted file mode 100644
index bab80a9de3..0000000000
--- a/templates/web/developers/header.html.twig
+++ /dev/null
@@ -1,128 +0,0 @@
-{% block header %}
-
-{% endblock %}
\ No newline at end of file
diff --git a/www/skins/account/account.js b/www/skins/account/account.js
new file mode 100644
index 0000000000..7a56e9f3c1
--- /dev/null
+++ b/www/skins/account/account.js
@@ -0,0 +1,125 @@
+$(document).ready(function() {
+ // revoke third party application access
+ $("a.app-btn").bind("click", function(e) {
+ e.preventDefault();
+ var $this = $(this);
+ $.ajax({
+ type:"GET",
+ url : $this.attr("href"),
+ dataType: 'json',
+ data : {revoke : $this.hasClass("authorize") ? 1 : 0},
+ success : function(data) {
+ if(data.success) {
+ var li = $this.closest('li');
+
+ var hidden = $('.app-btn.hidden , .status.hidden', li);
+ var notHidden = $('.app-btn:not(.hidden), .status:not(.hidden)', li);
+
+ hidden.removeClass('hidden');
+ notHidden.addClass('hidden');
+ }
+ }
+ });
+ });
+
+ // generate new access token
+ $("a#generate_access").bind("click", function(e) {
+ e.preventDefault();
+ var $this = $(this);
+ $.ajax({
+ type:"POST",
+ url : $this.attr("href"),
+ dataType: 'json',
+ data : {
+ usr_id : $this.closest("div").attr("id")
+ },
+ success : function(data){
+ if(data.success) {
+ $("#my_access_token").empty().append(data.token);
+ }
+ }
+ });
+ });
+
+ //modify application callback url
+ $(".modifier_callback").bind("click", function() {
+ var modifierBtn = $(this);
+ var saveBtn = $("a.save_callback");
+ var input = $(".url_callback_input");
+ var inputVal = input.html();
+
+ modifierBtn.hide();
+ saveBtn.show();
+ // wrapp current calback in an input
+ input
+ .empty()
+ .wrapInner(''
+ + '
'
+ );
+
+ $(".url_callback").die();
+
+ // save new callback
+ saveBtn.bind("click", function(e) {
+ e.preventDefault();
+ var callback = $("input[name=oauth_callback]").val();
+ $.ajax({
+ type:"POST",
+ url : saveBtn.attr("href"),
+ dataType: 'json',
+ data :{callback : callback},
+ success : function(data) {
+ if(data.success) {
+ input.empty().append(callback);
+ } else {
+ input.empty().append(inputVal);
+ }
+ }
+ });
+ });
+ });
+
+ // hide or show callback url input whether user choose a web or dektop application
+ $("#form_create input[name=type]").bind("click", function() {
+ if($(this).val() === "desktop") {
+ $("#form_create .callback td").hide().find("input").val('');
+ } else {
+ $("#form_create .callback td").show();
+ }
+ });
+
+ // authorize password grant type or not
+ $('.grant-type').bind('click', function(){
+ var $this = $(this);
+ $.ajax({
+ type:"POST",
+ url : $this.attr("value") ,
+ dataType: 'json',
+ data : {grant : $this.is(":checked") ? "1": "0"},
+ success : function(data){}
+ });
+ });
+
+ // delete an application
+ $("a.delete-app").bind("click", function(e) {
+ e.preventDefault();
+ var $this = $(this);
+ var li = $this.closest("li");
+
+ $.ajax({
+ type:"DELETE",
+ url : $this.attr('href'),
+ dataType: 'json',
+ data : {},
+ success : function(data){
+ if(data.success) {
+ li.find('.modal').modal('hide');
+ li.remove();
+ }
+ }
+ });
+ });
+});
+
+
diff --git a/www/skins/account/skin.less b/www/skins/account/skin.less
index 7ae9a1a8e5..5e42085d4e 100644
--- a/www/skins/account/skin.less
+++ b/www/skins/account/skin.less
@@ -334,18 +334,43 @@ h1, h2, h3, h4 {
color: @black;
}
+.app-list {
+ border: 1px solid @grayDark;
+ background: lighten(@background, 2%);
+ .border-radius(@baseBorderRadius);
+}
+
.app-list li {
- padding: 10px 0;
+ padding: 10px;
+ border-top: 1px solid @grayDark;
+}
+
+.app-list li:first-child {
+ border-top:none;
}
.app-list li .app-row {
line-height: @fontSizeLarge * 1.25;
+ padding-bottm: 5px;
}
.app-list li .app-row a {
font-size: @fontSizeLarge * 1.25;
}
+.text-success {
+ color: @green;
+}
+
+.text-error {
+ color: @red;
+}
+
+.control-span {
+ padding-top: 5px;
+ line-height: 20px;
+}
+
/* Landscape phones and down */
@media (max-width: 480px) {
diff --git a/www/skins/account/variables.less b/www/skins/account/variables.less
index 12025b894d..976e2cadd5 100644
--- a/www/skins/account/variables.less
+++ b/www/skins/account/variables.less
@@ -211,7 +211,7 @@
// Wells
// -------------------------
-@wellBackground: #f5f5f5;
+@wellBackground: @grayDarker;
// Navbar