Ver código fonte

Merge branch 'feature/account' into unstable

bastien 12 anos atrás
pai
commit
817265b060

+ 7 - 0
app/Resources/FOSUserBundle/views/Resetting/email.txt.twig Ver arquivo

@@ -0,0 +1,7 @@
1
+{% autoescape false %}
2
+{{ 'resetting.email'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}, 'FOSUserBundle') }}
3
+
4
+Bonjour {{ user.username }},
5
+Vous avez demandé le changement de votre mot de passe, pour le modifier
6
+rendez-vous acette adresse: {{ confirmationUrl }}
7
+{% endautoescape %}

+ 5 - 0
app/Resources/FOSUserBundle/views/Resetting/request.html.twig Ver arquivo

@@ -0,0 +1,5 @@
1
+{% extends "MuzichUserBundle::layout.not_connected.html.twig" %}
2
+
3
+{% block fos_user_content %}
4
+  {% include "FOSUserBundle:Resetting:request_content.html.twig" %}
5
+{% endblock fos_user_content %}

+ 12 - 0
app/Resources/FOSUserBundle/views/Resetting/request_content.html.twig Ver arquivo

@@ -0,0 +1,12 @@
1
+<form action="{{ path('fos_user_resetting_send_email') }}" method="POST" class="fos_user_resetting_request">
2
+    <div>
3
+        {% if invalid_username is defined %}
4
+            <p>{{ 'resetting.request.invalid_username'|trans({'%username%': invalid_username}, 'FOSUserBundle') }}</p>
5
+        {% endif %}
6
+        <label for="username">{{ 'resetting.request.username'|trans({}, 'FOSUserBundle') }}</label>
7
+        <input type="text" id="username" name="username" />
8
+    </div>
9
+    <div>
10
+        <input type="submit" value="{{ 'resetting.request.submit'|trans({}, 'FOSUserBundle') }}" />
11
+    </div>
12
+</form>

+ 0 - 5
app/Resources/FOSUserBundle/views/layout.html.twig Ver arquivo

@@ -1,5 +0,0 @@
1
-{% extends 'MuzichCoreBundle::layout.html.twig' %}
2
-
3
-{% block content %}
4
-    {% block fos_user_content %}{% endblock %}
5
-{% endblock %}

+ 0 - 13
app/Resources/views/base.html.twig Ver arquivo

@@ -1,13 +0,0 @@
1
-<!DOCTYPE html>
2
-<html>
3
-    <head>
4
-        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
-        <title>{% block title %}Welcome!{% endblock %}</title>
6
-        {% block stylesheets %}{% endblock %}
7
-        <link rel="shortcut icon" href="{{ asset('favicon.ico') }}" />
8
-    </head>
9
-    <body>
10
-        {% block body %}{% endblock %}
11
-        {% block javascripts %}{% endblock %}
12
-    </body>
13
-</html>

+ 9 - 5
src/Muzich/CoreBundle/Resources/config/security.yml Ver arquivo

@@ -29,16 +29,20 @@ security:
29 29
     access_control:
30 30
         - { path: ^/hello, roles: IS_AUTHENTICATED_ANONYMOUSLY }
31 31
         - { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
32
+        - { path: ^/resetting, roles: IS_AUTHENTICATED_ANONYMOUSLY }
33
+        
34
+        
35
+        - { path: ^/_wdt/, role: IS_AUTHENTICATED_ANONYMOUSLY }
36
+        - { path: ^/_profiler/, role: IS_AUTHENTICATED_ANONYMOUSLY }
37
+        - { path: ^/js/, role: IS_AUTHENTICATED_ANONYMOUSLY }
38
+        - { path: ^/css/, role: IS_AUTHENTICATED_ANONYMOUSLY }
39
+        - { path: ^/bundles/, role: IS_AUTHENTICATED_ANONYMOUSLY }
40
+        
32 41
         - { path: ^/, roles: ROLE_USER }
33 42
 #        # Liste des pages accessibles à tous les utilisateurs (ne pas toucher)
34
-#        - { path: ^/_wdt/, role: IS_AUTHENTICATED_ANONYMOUSLY }
35
-#        - { path: ^/_profiler/, role: IS_AUTHENTICATED_ANONYMOUSLY }
36
-#        - { path: ^/js/, role: IS_AUTHENTICATED_ANONYMOUSLY }
37
-#        - { path: ^/css/, role: IS_AUTHENTICATED_ANONYMOUSLY }
38 43
 #        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
39 44
 #        - { path: ^/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
40 45
 #        - { path: ^/register$, role: IS_AUTHENTICATED_ANONYMOUSLY }
41
-#        - { path: ^/resseting$, role: IS_AUTHENTICATED_ANONYMOUSLY }
42 46
 #        
43 47
 #        # PAGES ACCESSIBLES AUX ADMINISTRATEURS
44 48
 #        - { path: ^/myapp/admin/, role: ROLE_ADMIN }

+ 1 - 0
src/Muzich/CoreBundle/Resources/views/layout.html.twig Ver arquivo

@@ -27,6 +27,7 @@
27 27
   
28 28
   <div id="container">
29 29
     {% block main_content %}{% endblock %}
30
+    {% block fos_user_content %}{% endblock %}
30 31
   </div>
31 32
   
32 33
   

+ 0 - 5
src/Muzich/IndexBundle/MuzichIndexBundle.php Ver arquivo

@@ -7,9 +7,4 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
7 7
 class MuzichIndexBundle extends Bundle
8 8
 {
9 9
   
10
-  public function getParent()
11
-  {
12
-    return 'FOSUserBundle';
13
-  }
14
-  
15 10
 }

+ 65 - 0
src/Muzich/UserBundle/Controller/ResettingController.php Ver arquivo

@@ -0,0 +1,65 @@
1
+<?php
2
+
3
+namespace Muzich\UserBundle\Controller;
4
+
5
+use FOS\UserBundle\Controller\ResettingController as BaseResettingController;
6
+
7
+use Symfony\Component\HttpFoundation\RedirectResponse;
8
+use FOS\UserBundle\Model\UserInterface;
9
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
10
+
11
+/**
12
+ *
13
+ * @author bux
14
+ */
15
+class ResettingController extends BaseResettingController
16
+{
17
+  
18
+  /**
19
+   * Reset user password
20
+   */
21
+  public function resetAction($token)
22
+  {
23
+      $user = $this->container->get('fos_user.user_manager')->findUserByConfirmationToken($token);
24
+
25
+      if (null === $user){
26
+          throw new NotFoundHttpException(sprintf('The user with "confirmation token" does not exist for value "%s"', $token));
27
+      }
28
+
29
+      if (!$user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) {
30
+          return new RedirectResponse($this->container->get('router')->generate('fos_user_resetting_request'));
31
+      }
32
+
33
+      $form = $this->container->get('fos_user.resetting.form');
34
+      $formHandler = $this->container->get('fos_user.resetting.form.handler');
35
+      $process = $formHandler->process($user);
36
+
37
+      if ($process) {
38
+          $this->authenticateUser($user);
39
+
40
+          $this->setFlash('success', 'Votre mot de passe a été mis a jour avec succés.');
41
+
42
+          return new RedirectResponse($this->getRedirectionUrl($user));
43
+      }
44
+
45
+      return $this->container->get('templating')->renderResponse('FOSUserBundle:Resetting:reset.html.'.$this->getEngine(), array(
46
+          'token' => $token,
47
+          'form' => $form->createView(),
48
+          'theme' => $this->container->getParameter('fos_user.template.theme'),
49
+      ));
50
+  }
51
+
52
+  /**
53
+   * Generate the redirection url when the resetting is completed.
54
+   *
55
+   * @param UserInterface $user
56
+   * @return string
57
+   */
58
+  protected function getRedirectionUrl(UserInterface $user)
59
+  {
60
+      return $this->container->get('router')->generate('my_account');
61
+  }
62
+  
63
+}
64
+
65
+?>

+ 1 - 1
src/Muzich/UserBundle/DataFixtures/ORM/LoadUserData.php Ver arquivo

@@ -82,7 +82,7 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface, C
82 82
     
83 83
     // Création des Users
84 84
     $admin  = $this->createUser('admin', 'admin@root', 'toor');
85
-    $bux    = $this->createUser('bux', 'bux@root', 'toor');
85
+    $bux    = $this->createUser('bux', 'sevajol.bastien@gmail.com', 'toor');
86 86
     $jean   = $this->createUser('jean', 'jean@root', 'toor');
87 87
     $paul   = $this->createUser('paul', 'paul@root', 'toor');
88 88
     $bob    = $this->createUser('bob', 'bob@root', 'toor');

+ 4 - 4
src/Muzich/UserBundle/MuzichUserBundle.php Ver arquivo

@@ -7,9 +7,9 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
7 7
 class MuzichUserBundle extends Bundle
8 8
 {
9 9
   
10
-//  public function getParent()
11
-//  {
12
-//    return 'FOSUserBundle';
13
-//  }
10
+  public function getParent()
11
+  {
12
+    return 'FOSUserBundle';
13
+  }
14 14
 
15 15
 }

+ 11 - 0
src/Muzich/UserBundle/Resources/views/layout.not_connected.html.twig Ver arquivo

@@ -0,0 +1,11 @@
1
+{% extends 'MuzichCoreBundle::layout.html.twig' %}
2
+
3
+{% block css %}
4
+	<link href="{{ asset('bundles/muzichuser/css/user.css') }}" rel="stylesheet" media="screen" type="text/css" />
5
+{% endblock %}
6
+
7
+{% block main_content %}
8
+  
9
+    {% block content %}{% endblock %}
10
+  
11
+{% endblock %}

+ 1 - 0
web/.#app_dev.php Ver arquivo

@@ -0,0 +1 @@
1
+bux@here.3882