Commit f6ba55b5 authored by hlarget's avatar hlarget 👹
Browse files

Merge branch 'release/2.0.7'

parents 2597a025 5b00b57d
<?php
namespace Aboutgoods\KonnectBundle\Controller;
use Symfony\Bundle\TwigBundle\Controller\ExceptionController;
use Symfony\Component\HttpFoundation\Request;
class CustomExceptionController extends ExceptionController
{
protected function findTemplate(Request $request, $format, $code, $showException) {
$name = $showException ? 'exception' : 'error';
if ($showException && 'html' == $format) {
$name = 'exception_full';
}
// For error pages, try to find a template for the specific HTTP status code and format
if (!$showException) {
$template = sprintf('@KonnectBundle/errors/%s%s.%s.twig', $name, $code, $format);
if ($this->templateExists($template)) {
return $template;
}
}
// try to find a template for the given format
$template = sprintf('@KonnectBundle/errors/%s.%s.twig', $name, $format);
if ($this->templateExists($template)) {
return $template;
}
// default to a generic HTML exception
$request->setRequestFormat('html');
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
}
}
\ No newline at end of file
.logo-kweeri {
display: flex;
width: 100%;
margin: 36px 0;
text-align: center;
}
.logo-kweeri img {
height: 190px;
}
.image-status {
display: flex;
width: 100%;
z-index: 100;
}
.status-code{
display: inline-flex;
width: 100%;
margin-top: 2rem;
}
.status-code-error{
display: inline-flex;
width: 100%;
}
.status-content{
margin: auto;
display: flex;
justify-content: center;
height: 20rem;
position:relative;
align-items: center;
margin-bottom:10px;
}
.width-500{
width: 39rem;
height: 19.4rem;
}
.width-404{
width: 42rem;
height: 21.3rem;
padding-top: 2rem;
}
.status-image{
max-width: 320px;
z-index: 100;
}
.first-number-position{
position:absolute;
left:60px;
}
.error-number{
font-family: Rubik;
font-style: normal;
font-weight: 500;
color: #FFFFFF;
text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
font-size: 370px;
line-height: 24rem;
letter-spacing: -1.5rem;
}
.second-number-position{
position:absolute;
right:60px;
}
.image-position{
z-index: 50;
}
.status-number{
font-family: Rubik;
font-style: normal;
font-weight: 500;
font-size: 400px;
line-height: 22rem;
color: #FFFFFF;
text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}
.n-404{
line-height: 17rem;
}
.planet-position{
}
.image-planet{
}
.center-image {
margin: auto;
}
.ant-layout {
position: relative;
min-height: 95vh;
}
.error-card {
padding: 48px 0px;
max-width: 754px;
margin: 0px auto;
text-align: -webkit-center;
}
.error-card-500 {
padding: 48px;
max-width: 754px;
margin: -5px auto 0px auto;
text-align: -webkit-center;
}
.text-error {
font-size: 1.3rem;
line-height: 2rem;
text-align: center;
}
.content {
justify-content: space-around;
display: flex;
width: 70%;
margin-top: 2rem;
}
.exception-message {
font-weight: bold;
}
.footer {
position: relative;
}
@media screen and (max-width: 660px) {
.status-number {
font-size: 300px;
}
.status-image {
max-width: 280px;
}
.error-number {
font-size: 270px;
}
}
@media screen and (max-width: 500px) {
.width-404 {
padding-top: 1rem;
height: 15rem;
}
.content {
flex-direction: column;
align-items: center;
}
.text-error {
margin: 10px;
}
.status-image {
max-width: 190px;
}
.status-number {
font-size: 200px;
}
.first-number-position {
left: 45px;
}
.second-number-position {
right: 45px;
}
.error-number {
font-size: 190px;
}
}
\ No newline at end of file
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext" target-language="en">
<body>
<group id="error404">
<trans-unit id="error404.notFound">
<source>error404.notFound</source>
<target>It looks like nothing was found in this location. Maybe try to:</target>
</trans-unit>
<trans-unit id="error404.visit">
<source>error404.visit</source>
<target>or visit our</target>
</trans-unit>
<trans-unit id="error404.goHomePage">
<source>error404.goHomePage</source>
<target>HOME PAGE</target>
</trans-unit>
</group>
<group id="errorPage">
<trans-unit id="errorPage.getBackButton">
<source>errorPage.getBackButton</source>
<target>GET BACK</target>
</trans-unit>
<trans-unit id="errorPage.messageText">
<source>errorPage.messageText</source>
<target>Something is broken.</target>
</trans-unit>
<trans-unit id="errorPage.messageTextLink">
<source>errorPage.messageTextLink</source>
<target>Send us an email to report this issue.</target>
</trans-unit>
<trans-unit id="errorPage.messageTextSecond">
<source>errorPage.messageTextSecond</source>
<target>Please let us know what you were doing when this error occurred ? We will fix it as soon as possible. Sorry for any inconvenience caused.</target>
</trans-unit>
</group>
<group id="error500">
<trans-unit id="error500.internalServerText">
<source>error500.internalServerText</source>
<target>The server has been deserted for a while. Please be patient or try again later, or send us a </target>
</trans-unit>
<trans-unit id="error500.internalServerMail">
<source>error500.internalServerMail</source>
<target>email to fix it.</target>
</trans-unit>
</group>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext" target-language="fr">
<body>
<group id="error404">
<trans-unit id="error404.notFound">
<source>error404.notFound</source>
<target>On dirait que rien ne se trouve ici ! Essayez de :</target>
</trans-unit>
<trans-unit id="error404.visit">
<source>error404.visit</source>
<target>ou visitez notre</target>
</trans-unit>
<trans-unit id="error404.goHomePage">
<source>error404.goHomePage</source>
<target>PAGE D'ACCUEIL</target>
</trans-unit>
</group>
<group id="errorPage">
<trans-unit id="errorPage.getBackButton">
<source>errorPage.getBackButton</source>
<target>RETOUR</target>
</trans-unit>
<trans-unit id="errorPage.messageText">
<source>errorPage.messageText</source>
<target>Quelque chose ne marche pas.</target>
</trans-unit>
<trans-unit id="errorPage.messageTextLink">
<source>errorPage.messageTextLink</source>
<target>Envoyez-nous un mail pour signaler ce problème.</target>
</trans-unit>
<trans-unit id="errorPage.messageTextSecond">
<source>errorPage.messageTextSecond</source>
<target>Veuillez nous indiquer que vouliez vous faire lorsque l'erreur est apparue ? Nous allons corriger ce problème aussitôt que possible. Nous sommes désolé pour la gêne occasionnée.</target>
</trans-unit>
</group>
<group id="error500">
<trans-unit id="error500.internalServerText">
<source>error500.internalServerText</source>
<target>Il y a eu un problème de notre coté ! Vous pouvez re-tenter plus tard ou nous signaler</target>
</trans-unit>
<trans-unit id="error500.internalServerMail">
<source>error500.internalServerMail</source>
<target>le problème par message.</target>
</trans-unit>
</group>
</body>
</file>
</xliff>
\ No newline at end of file
<!DOCTYPE html>
<html lang="{{ app.request.locale|split('_')[0] }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" type="image/png" href="{{ asset('favicon.png') }}" />
{{ encore_entry_link_tags("app") }}
{% block stylesheets %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
<script src="{{ path("utils_routing_js") }}"></script>
{% block javascripts %}{% endblock %}
{{ encore_entry_script_tags("app") }}
</body>
</html>
{% extends '@KonnectBundle/errors/error_base.html.twig' %}
{% trans_default_domain "translations" %}
{% block title %}
An Error Occurred: {{ status_text }} - {{ exception.statusCode }}
{% endblock %}
{% block body %}
<div class="ant-layout">
<div class="logo-kweeri">
<img class="center-image" src="{{ asset('bundles/konnect/images/kweeri-text.png') }}">
</div>
<div class="status-code-error">
<div class="status-content">
<div class="error-number">{{ exception.statusCode }}</div>
</div>
</div>
<div class="container">
<div class="ant-card error-card-500">
<h2>😵 {{ status_text }} 😵</h2>
<p class="exception-message">{{ exception.message }}</p>
<p>
{% trans %}errorPage.messageTextSecond{% endtrans %}
</p>
<p>
{% if(app.token.user != "anon.") %}
<a href="mailto:support%40aboutgoods.net?cc={{ app.token.user.email }}&subject=Kweeri%20-%20Error%20{{ exception.statusCode }}%20-%20{{ exception.message }}%20-%20{{ app.request.uri }}">
{% trans %}errorPage.messageTextLink{% endtrans %}
</a>
{% else %}
<a href="mailto:support%40aboutgoods.net?&subject=Kweeri%20-%20Error%20{{ exception.statusCode }}%20-%20{{ exception.message }}%20-%20{{ app.request.uri }}">
{% trans %}errorPage.messageTextLink{% endtrans %}
</a>
{% endif %}
</p>
<div class="content">
<button type="button" class="ant-btn ant-btn-dashed"
onclick="goBack()">{% trans %}errorPage.getBackButton{% endtrans %}</button>
</div>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends '@KonnectBundle/errors/error_base.html.twig' %}
{% trans_default_domain "translations" %}
{% block title %}
An Error Occurred: {{ status_text }} - {{ exception.statusCode }}
{% endblock %}
{% block body %}
<div class="ant-layout">
<div class="logo-kweeri">
<img class="center-image" src="{{ asset('bundles/konnect/images/kweeri-text.png') }}">
</div>
<div class="status-code">
<div class="status-content width-404">
<div class="status-number n-404 first-number-position">4</div>
<div class="status-image image-position planet-position">
<img src="{{ asset('bundles/konnect/images/planet.png') }}" class="status-image image-planet">
</div>
<div class="status-number n-404 second-number-position">4</div>
</div>
</div>
<div class="container">
<div class="ant-card error-card">
<h1>😵 {{ status_text }} 😵</h1>
<p class="text-error">{% trans %}error404.notFound{% endtrans %}</p>
<div class="content">
<button type="button" class="ant-btn ant-btn-dashed" onclick="goBack()">{% trans %}errorPage.getBackButton{% endtrans %}</button>
<p class="text-error">{% trans %}error404.visit{% endtrans %}</p>
<a href="/"><button type="button" class="ant-btn ant-btn-default" href="">{% trans %}error404.goHomePage{% endtrans %}</button></a>
</div>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends '@KonnectBundle/errors/error_base.html.twig' %}
{% trans_default_domain "translations" %}
{% block title %}
An Error Occurred: {{ status_text }} - {{ exception.statusCode }}
{% endblock %}
{% block body %}
<div class="ant-layout">
<div class="logo-kweeri">
<img class="center-image" src="{{ asset('bundles/konnect/images/kweeri-text.png') }}">
</div>
<div class="status-code">
<div class="status-content width-500">
<div class="status-number first-number-position">5</div>
<div class="status-image image-position">
<img src="{{ asset('bundles/konnect/images/robot.png') }}" class="status-image">
</div>
<div class="status-number second-number-position">0</div>
</div>
</div>
<div class="container">
<div class="ant-card error-card-500">
<h1>😵 {{ status_text }} 😵</h1>
<p class="text-error">{% trans %}error500.internalServerText{% endtrans %}
{% if(app.token.user != "anon.") %}
<a href="mailto:support%40aboutgoods.net?cc={{ app.token.user.email }}&subject=Kweeri%20-%20Error%20{{ exception.statusCode }}%20-%20{{ exception.message }}%20-%20{{ app.request.uri }}">
{% trans %}error500.internalServerMail{% endtrans %}
</a>
{% else %}
<a href="mailto:support%40aboutgoods.net?&subject=Kweeri%20-%20Error%20{{ exception.statusCode }}%20-%20{{ exception.message }}%20-%20{{ app.request.uri }}">
{% trans %}error500.internalServerMail{% endtrans %}
</a>
{% endif %}
</p>
<div class="content">
<button type="button" class="ant-btn ant-btn-dashed" onclick="goBack()">{% trans %}errorPage.getBackButton{% endtrans %}</button>
</div>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends '@KonnectBundle/base.html.twig' %}
{% block stylesheets %}
<link rel="stylesheet" href="{{ asset('bundles/konnect/style/error-pages.css') }}"/>
{% endblock %}
{% block javascripts %}
<script>
function goBack() {
window.history.back();
}
</script>
{% endblock %}
\ No newline at end of file
......@@ -2,12 +2,13 @@ Konnect Bundle
====================
This project aims to mutualize the code used by konnect and its modules.
Konnect Bundle have two main goals:
Konnect Bundle have three main goals:
- Give the project a way to authenticate using Auth0
- All the common Auth0 files are stored here to avoid duplicating them in all project
- Allow Requests to Konnect API and get informations about user and service.
- Allow Requests to Konnect API and get informations about user and service.
Take a look at [the Konnect Bundle API documentation](https://doc.agoods.fr/v2/api/konnectBundle.html)
- Centralize errors templates in order to have same errors pages on each Kweeri Modules.
Konnect Bundle import some classes in your module:
- Auth0ResourceOwner that make call to Auth0 for the Authentication
- User entity to have a common User across all our modules
......@@ -34,10 +35,10 @@ Aboutgoods\KonnectBundle\KonnectBundle::class => ['all' => true],
```
in `/config/bundles.php`
## Configuration
##Configuration
If you need to make request to the API of Konnect you need to configure Konnect-bundle
##### If you need to make request to the API of Konnect you need to configure Konnect-bundle
In your `konnect.yml`:
```yaml
......@@ -58,7 +59,28 @@ KONNECT_URI=127.0.0.1:10080
For the basic services you can find their `TOKEN` and `SECRET` [on the Konnect readme](https://gitlab.agoods.fr/presentation/kweeri/Kweeri-Konnect/blob/dev/README.md#token-and-secret-for-each-services-).
##Usage
##### If you need to use error templates, you need to add this configuration :
In your `twig.yaml` :
```yaml
twig:
paths:
'%kernel.project_dir%/templates': DefaultTemplates
'%kernel.root_dir%/../vendor/aboutgoods/konnect-bundle/Resources/templates': KonnectBundle
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'