Skip to content

Commit

Permalink
Updated for the framework change
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Mar 28, 2011
1 parent 8fb46bc commit 9b9eb2f
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 71 deletions.
12 changes: 6 additions & 6 deletions Controller/GroupController.php
Expand Up @@ -27,7 +27,7 @@ public function listAction()
{
$groups = $this->container->get('fos_user.group_manager')->findGroups();

return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:list.html.'.$this->getEngine(), array('groups' => $groups));
return $this->container->get('templating')->renderResponse('FOSUser:Group:list.html.'.$this->getEngine(), array('groups' => $groups));
}

/**
Expand All @@ -37,7 +37,7 @@ public function showAction($groupname)
{
$group = $this->findGroupBy('name', $groupname);

return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:show.html.'.$this->getEngine(), array('group' => $group));
return $this->container->get('templating')->renderResponse('FOSUser:Group:show.html.'.$this->getEngine(), array('group' => $group));
}

/**
Expand All @@ -50,7 +50,7 @@ public function editAction($groupname)

$form->process($group);

return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:edit.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:Group:edit.html.'.$this->getEngine(), array(
'form' => $form,
'groupname' => $group->getName()
));
Expand All @@ -71,7 +71,7 @@ public function updateAction($groupname)
return new RedirectResponse($groupUrl);
}

return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:edit.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:Group:edit.html.'.$this->getEngine(), array(
'form' => $form,
'groupname' => $group->getName()
));
Expand All @@ -86,7 +86,7 @@ public function newAction()

$form->process();

return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:new.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:Group:new.html.'.$this->getEngine(), array(
'form' => $form
));
}
Expand All @@ -106,7 +106,7 @@ public function createAction()
return new RedirectResponse($url);
}

return $this->container->get('templating')->renderResponse('FOSUserBundle:Group:new.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:Group:new.html.'.$this->getEngine(), array(
'form' => $form
));
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/SecurityController.php
Expand Up @@ -23,7 +23,7 @@ public function loginAction()
$error = $error->getMessage();
}

return $this->container->get('templating')->renderResponse('FOSUserBundle:Security:login.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:Security:login.html.'.$this->getEngine(), array(
// last username entered by the user
'last_username' => $this->container->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
'error' => $error,
Expand Down
30 changes: 15 additions & 15 deletions Controller/UserController.php
Expand Up @@ -33,7 +33,7 @@ public function listAction()
{
$users = $this->container->get('fos_user.user_manager')->findUsers();

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:list.html.'.$this->getEngine(), array('users' => $users));
return $this->container->get('templating')->renderResponse('FOSUser:User:list.html.'.$this->getEngine(), array('users' => $users));
}

/**
Expand All @@ -42,7 +42,7 @@ public function listAction()
public function showAction($username)
{
$user = $this->findUserBy('username', $username);
return $this->container->get('templating')->renderResponse('FOSUserBundle:User:show.html.'.$this->getEngine(), array('user' => $user));
return $this->container->get('templating')->renderResponse('FOSUser:User:show.html.'.$this->getEngine(), array('user' => $user));
}

/**
Expand All @@ -55,7 +55,7 @@ public function editAction($username)

$form->process($user);

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:edit.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:edit.html.'.$this->getEngine(), array(
'form' => $form,
'username' => $user->getUsername()
));
Expand All @@ -76,7 +76,7 @@ public function updateAction($username)
return new RedirectResponse($userUrl);
}

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:edit.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:edit.html.'.$this->getEngine(), array(
'form' => $form,
'username' => $user->getUsername()
));
Expand All @@ -91,7 +91,7 @@ public function newAction()

$form->process();

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:new.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:new.html.'.$this->getEngine(), array(
'form' => $form
));
}
Expand Down Expand Up @@ -129,7 +129,7 @@ public function createAction()
return new RedirectResponse($url);
}

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:new.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:new.html.'.$this->getEngine(), array(
'form' => $form
));
}
Expand All @@ -145,7 +145,7 @@ public function checkConfirmationEmailAction()

$this->setFlash('fos_user_user_confirm', 'success');

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:checkConfirmationEmail.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:checkConfirmationEmail.html.'.$this->getEngine(), array(
'user' => $user,
));
}
Expand Down Expand Up @@ -173,7 +173,7 @@ public function confirmedAction()
$user = $this->getUser();

$this->setFlash('fos_user_user_confirmed', 'success');
return $this->container->get('templating')->renderResponse('FOSUserBundle:User:confirmed.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:confirmed.html.'.$this->getEngine(), array(
'user' => $user,
));
}
Expand All @@ -199,7 +199,7 @@ public function changePasswordAction()
$form = $this->container->get('fos_user.form.change_password');
$form->process($user);

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:changePassword.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:changePassword.html.'.$this->getEngine(), array(
'form' => $form
));
}
Expand All @@ -219,7 +219,7 @@ public function changePasswordUpdateAction()
return new RedirectResponse($url);
}

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:changePassword.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:changePassword.html.'.$this->getEngine(), array(
'form' => $form
));
}
Expand All @@ -229,7 +229,7 @@ public function changePasswordUpdateAction()
*/
public function requestResetPasswordAction()
{
return $this->container->get('templating')->renderResponse('FOSUserBundle:User:requestResetPassword.html.'.$this->getEngine());
return $this->container->get('templating')->renderResponse('FOSUser:User:requestResetPassword.html.'.$this->getEngine());
}

/**
Expand All @@ -240,7 +240,7 @@ public function sendResettingEmailAction()
$user = $this->findUserBy('username', $this->container->get('request')->get('username'));

if ($user->isPasswordRequestNonExpired($this->getPasswordRequestTtl())) {
return $this->container->get('templating')->renderResponse('FOSUserBundle:User:passwordAlreadyRequested.html.'.$this->getEngine());
return $this->container->get('templating')->renderResponse('FOSUser:User:passwordAlreadyRequested.html.'.$this->getEngine());
}

$user->generateConfirmationToken();
Expand All @@ -266,7 +266,7 @@ public function checkResettingEmailAction()

$this->setFlash('fos_user_user_reset', 'success');

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:checkResettingEmail.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:checkResettingEmail.html.'.$this->getEngine(), array(
'user' => $user,
));
}
Expand All @@ -285,7 +285,7 @@ public function resetPasswordAction($token)
$form = $this->container->get('fos_user.form.reset_password');
$form->process($user);

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:resetPassword.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:resetPassword.html.'.$this->getEngine(), array(
'token' => $token,
'form' => $form
));
Expand Down Expand Up @@ -313,7 +313,7 @@ public function resetPasswordUpdateAction($token)
return new RedirectResponse($url);
}

return $this->container->get('templating')->renderResponse('FOSUserBundle:User:resetPassword.html.'.$this->getEngine(), array(
return $this->container->get('templating')->renderResponse('FOSUser:User:resetPassword.html.'.$this->getEngine(), array(
'token' => $token,
'form' => $form
));
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/Configuration.php
Expand Up @@ -188,13 +188,13 @@ private function addEmailSection(ArrayNodeDefinition $node)
->addDefaultsIfNotSet()
->children()
->booleanNode('enabled')->defaultFalse()->end()
->scalarNode('template')->defaultValue('FOSUserBundle:User:confirmationEmail')->end()
->scalarNode('template')->defaultValue('FOSUser:User:confirmationEmail')->end()
->end()
->end()
->arrayNode('resetting_password')
->addDefaultsIfNotSet()
->children()
->scalarNode('template')->defaultValue('FOSUserBundle:User:resettingPasswordEmail')->end()
->scalarNode('template')->defaultValue('FOSUser:User:resettingPasswordEmail')->end()
->scalarNode('token_ttl')->defaultValue(86400)->end()
->end()
->end()
Expand Down
35 changes: 15 additions & 20 deletions Resources/doc/index.rst
Expand Up @@ -148,8 +148,8 @@ along with the bundle containing your custom User class::
doctrine:
orm:
mappings:
FOSUserBundle: ~
MyProjectMyBundle: ~
FOSUser: ~
MyProjectMy: ~
# your other bundles

The above example assumes an ORM configuration, but the ``mappings``
Expand Down Expand Up @@ -253,18 +253,18 @@ routes:

# app/config/routing.yml
fos_user_security:
resource: @FOSUserBundle/Resources/config/routing/security.xml
resource: @FOSUser/Resources/config/routing/security.xml

fos_user_user:
resource: @FOSUserBundle/Resources/config/routing/user.xml
resource: @FOSUser/Resources/config/routing/user.xml
prefix: /user

::

# app/config/routing.xml

<import resource="@FOSUserBundle/Resources/config/routing/security.xml"/>
<import resource="@FOSUserBundle/Resources/config/routing/user.xml" prefix="/user" />
<import resource="@FOSUser/Resources/config/routing/security.xml"/>
<import resource="@FOSUser/Resources/config/routing/user.xml" prefix="/user" />

You now can login at http://app.com/login

Expand Down Expand Up @@ -578,20 +578,14 @@ Templating
----------

The template names are not configurable, however Symfony2 makes it possible
to extend a bundle by creating a new Bundle and implementing a getParent()
method inside that new Bundle's definition::

class MyProjectUserBundle extends Bundle
{
public function getParent()
{
return 'FOSUserBundle';
}
}
to extend a bundle by defining a template in the app/ directory.

For example ``vendor/bundles/FOS/UserBundle/Resources/views/User/new.twig`` can be
replaced inside an application by putting a file with alternative content in
``src/MyProject/UserBundle/Resources/views/User/new.twig``.
``app/Resources/FOSUser/views/User/new.twig``.

You could also create a bundle defined as child of FOSUserBundle and placing the
templates in it.

You can use a different templating engine by configuring it but you will have to
create all the needed templates as only twig templates are provided.
Expand Down Expand Up @@ -621,9 +615,10 @@ Canonicalization
----------------

``Canonicalizer`` services are used to canonicalize the username and the email
fields for database storage. By default, username and email fields are canonicalized
in the same manner using ``mb_convert_case()``. You may configure your own class
for each field provided it implements ``FOS\UserBundle\Util\CanonicalizerInterface``.
fields for database storage. By default, username and email fields are
canonicalized in the same manner using ``mb_convert_case()``. You may configure
your own class for each field provided it implements
``FOS\UserBundle\Util\CanonicalizerInterface``.

Note::

Expand Down
4 changes: 2 additions & 2 deletions Resources/views/Group/edit.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:Group:edit_content.html.twig" %}
{% include "FOSUser:Group:edit_content.html.twig" %}
{% endblock content %}
4 changes: 2 additions & 2 deletions Resources/views/Group/list.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:Group:list_content.html.twig" %}
{% include "FOSUser:Group:list_content.html.twig" %}
{% endblock content %}
4 changes: 2 additions & 2 deletions Resources/views/Group/new.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:Group:new_content.html.twig" %}
{% include "FOSUser:Group:new_content.html.twig" %}
{% endblock content %}
4 changes: 2 additions & 2 deletions Resources/views/Group/show.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:Group:show_content.html.twig" %}
{% include "FOSUser:Group:show_content.html.twig" %}
{% endblock content %}
2 changes: 1 addition & 1 deletion Resources/views/Security/login.html.twig
@@ -1,4 +1,4 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% if error %}
Expand Down
4 changes: 2 additions & 2 deletions Resources/views/User/changePassword.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:User:changePassword_content.html.twig" %}
{% include "FOSUser:User:changePassword_content.html.twig" %}
{% endblock content %}
2 changes: 1 addition & 1 deletion Resources/views/User/checkResettingEmail.html.twig
@@ -1,4 +1,4 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% set email = user.getEmail() %}
Expand Down
4 changes: 2 additions & 2 deletions Resources/views/User/edit.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:User:edit_content.html.twig" %}
{% include "FOSUser:User:edit_content.html.twig" %}
{% endblock content %}
4 changes: 2 additions & 2 deletions Resources/views/User/list.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:User:list_content.html.twig" %}
{% include "FOSUser:User:list_content.html.twig" %}
{% endblock content %}
4 changes: 2 additions & 2 deletions Resources/views/User/new.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:User:new_content.html.twig" %}
{% include "FOSUser:User:new_content.html.twig" %}
{% endblock content %}
2 changes: 1 addition & 1 deletion Resources/views/User/passwordAlreadyRequested.html.twig
@@ -1,4 +1,4 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
The password for this user has already been requested within the last 24 hours.
Expand Down
4 changes: 2 additions & 2 deletions Resources/views/User/requestResetPassword.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:User:requestResetPassword_content.html.twig" %}
{% include "FOSUser:User:requestResetPassword_content.html.twig" %}
{% endblock content %}
4 changes: 2 additions & 2 deletions Resources/views/User/resetPassword.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:User:resetPassword_content.html.twig" %}
{% include "FOSUser:User:resetPassword_content.html.twig" %}
{% endblock content %}
4 changes: 2 additions & 2 deletions Resources/views/User/show.html.twig
@@ -1,5 +1,5 @@
{% extends "FOSUserBundle::layout.html.twig" %}
{% extends "FOSUser::layout.html.twig" %}

{% block content %}
{% include "FOSUserBundle:User:show_content.html.twig" %}
{% include "FOSUser:User:show_content.html.twig" %}
{% endblock content %}

0 comments on commit 9b9eb2f

Please sign in to comment.