Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: xmmedia/XMSecurityBundle
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.2.12
Choose a base ref
...
head repository: xmmedia/XMSecurityBundle
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 7 commits
  • 14 files changed
  • 1 contributor

Commits on Sep 11, 2018

  1. fixing margins in views

    darrylhein committed Sep 11, 2018
    Copy the full SHA
    39073a3 View commit details

Commits on Jan 16, 2019

  1. Copy the full SHA
    ee71a1b View commit details

Commits on Feb 5, 2020

  1. update composer requirements

    mainly to allow for 2.0+ versions of fos user bundle
    darrylhein committed Feb 5, 2020
    Copy the full SHA
    e3d23c2 View commit details

Commits on Feb 6, 2020

  1. Copy the full SHA
    afec211 View commit details
  2. more _target_path changes

    darrylhein committed Feb 6, 2020
    Copy the full SHA
    2f33776 View commit details

Commits on Jul 3, 2020

  1. Copy the full SHA
    e0091ef View commit details

Commits on Mar 18, 2021

  1. Copy the full SHA
    92fc035 View commit details
8 changes: 7 additions & 1 deletion Controller/ActivateController.php
Original file line number Diff line number Diff line change
@@ -102,7 +102,13 @@ protected function getTargetPath(Request $request)
if (!$targetPath) {
$targetPath = $request->query->get('target_path');
}
if (!$targetPath) {
$targetPath = $request->request->get('_target_path');
}
if (!$targetPath) {
$targetPath = $request->query->get('_target_path');
}

return $targetPath;
}
}
}
9 changes: 5 additions & 4 deletions Controller/RegistrationConfirmationController.php
Original file line number Diff line number Diff line change
@@ -50,16 +50,17 @@ public function resendAction(Request $request, User $user = null)
$this->addFlash('warning', 'Your account is already enabled.');
} else {
$this->addFlash('warning', 'The user is already enabled.');

}

return $this->redirect($redirect);
}

if (null === $user->getConfirmationToken()) {
throw new \InvalidArgumentException(
'The user does not have a confirmation token and therefore cannot be activated.'
$user->setConfirmationToken(
$this->get('fos_user.util.token_generator')
->generateToken()
);
$this->get('fos_user.user_manager')->updateUser($user);
}

$this->get('fos_user.mailer')->sendConfirmationEmailMessage($user);
@@ -78,4 +79,4 @@ public function resendAction(Request $request, User $user = null)

return $this->redirect($redirect);
}
}
}
16 changes: 15 additions & 1 deletion Controller/SecurityController.php
Original file line number Diff line number Diff line change
@@ -5,9 +5,12 @@
use FOS\UserBundle\Controller\SecurityController as BaseSecurityController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Http\Util\TargetPathTrait;

class SecurityController extends BaseSecurityController
{
use TargetPathTrait;

/**
* The target path, used during the login and passed to the login view.
* @var string
@@ -33,6 +36,14 @@ public function loginAction(Request $request)
$this->pullUsernameFromQuery($request);
$this->pullTargetPathFromQuery($request);

if ($this->targetPath) {
$this->saveTargetPath(
$request->getSession(),
'main',
$this->targetPath
);
}

return parent::loginAction($request);
}

@@ -76,6 +87,9 @@ protected function pullUsernameFromQuery(Request $request)
protected function pullTargetPathFromQuery(Request $request)
{
$targetPath = $request->query->get('target_path');
if (!$targetPath) {
$targetPath = $request->query->get('_target_path');
}

if ($targetPath) {
$this->targetPath = $targetPath;
@@ -99,4 +113,4 @@ protected function isRegistrationEnabled()

return (null !== $routes->get('fos_user_registration_register'));
}
}
}
6 changes: 6 additions & 0 deletions Listener/ResettingListener.php
Original file line number Diff line number Diff line change
@@ -111,6 +111,12 @@ protected function getTargetPath(Request $request)
if (!$targetPath) {
$targetPath = $request->query->get('target_path');
}
if (!$targetPath) {
$targetPath = $request->request->get('_target_path');
}
if (!$targetPath) {
$targetPath = $request->query->get('_target_path');
}

return $targetPath;
}
6 changes: 3 additions & 3 deletions Resources/views/Activate/activate_content.html.twig
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% trans_default_domain 'FOSUserBundle' %}

<div class="form-wrap form-form_wrap">
<h1>{{ 'xm_security.activate.form_title'|trans([], 'XMSecurityBundle') }}</h1>
<h1 class="mt-0">{{ 'xm_security.activate.form_title'|trans([], 'XMSecurityBundle') }}</h1>

<p>{{ 'xm_security.activate.form_instructions'|trans([], 'XMSecurityBundle') }}</p>

{{ form_start(form, { 'action': path('xm_security_activate', {'token': token}) }) }}

{% if target_path is defined %}
<input type="hidden" name="target_path" value="{{ target_path }}">
<input type="hidden" name="_target_path" value="{{ target_path }}">
{% endif %}

<div class="field-wrap form-field_wrap">
@@ -26,4 +26,4 @@
<a href="{{ path('fos_user_security_login') }}" class="form-action form-action_link">{{ 'xm_security.activate.return_to_login'|trans([], 'XMSecurityBundle') }}</a>
</div>
{{ form_end(form) }}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% trans_default_domain 'FOSUserBundle' %}

<div class="form-wrap form-form_wrap">
<h1>{{ 'xm_security.change_password.form_title'|trans([], 'XMSecurityBundle') }}</h1>
<h1 class="mt-0">{{ 'xm_security.change_password.form_title'|trans([], 'XMSecurityBundle') }}</h1>

{{ form_start(form, { 'action': path('fos_user_change_password') }) }}
{{ form_errors(form) }}
2 changes: 1 addition & 1 deletion Resources/views/Profile/edit_content.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% trans_default_domain 'FOSUserBundle' %}

<div class="form-wrap form-form_wrap">
<h1>{{ 'xm_security.profile.form_title'|trans([], 'XMSecurityBundle') }}</h1>
<h1 class="mt-0">{{ 'xm_security.profile.form_title'|trans([], 'XMSecurityBundle') }}</h1>

{{ form_start(form, { 'action': path('fos_user_profile_edit') }) }}
{{ form_errors(form) }}
2 changes: 1 addition & 1 deletion Resources/views/Registration/check_email.html.twig
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
{% block page_title %}Register | {% endblock %}

{% block fos_user_content %}
<div class="alert alert-info alert-type-info">
<div class="alert alert-info alert-type-info mt-4">
{{ 'registration.check_email'|trans({'%email%': user.email}) }}
</div>
{% endblock fos_user_content %}
2 changes: 1 addition & 1 deletion Resources/views/Registration/register_content.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% trans_default_domain 'FOSUserBundle' %}

<div class="form-wrap form-form_wrap">
<h1>{{ 'xm_security.register.form_title'|trans([], 'XMSecurityBundle') }}</h1>
<h1 class="mt-0">{{ 'xm_security.register.form_title'|trans([], 'XMSecurityBundle') }}</h1>
<p>{{ 'xm_security.register.preamble'|trans([], 'XMSecurityBundle') }}</p>

{{ form_start(form, { 'method': 'post', 'action': path('fos_user_registration_register') }) }}
2 changes: 1 addition & 1 deletion Resources/views/Resetting/check_email.html.twig
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
{% block page_title %}{{ 'xm_security.resetting.page_title'|trans([], 'XMSecurityBundle') }} | {% endblock %}

{% block fos_user_content %}
<div class="alert alert-info alert-type-info">
<div class="alert alert-info alert-type-info mt-4">
{{ 'resetting.check_email'|trans({ '%tokenLifetime%': tokenLifetime })|nl2br }}
<br>
<a href="{{ path('fos_user_security_login') }}">{{ 'xm_security.resetting.return_to_login'|trans([], 'XMSecurityBundle') }}</a>
2 changes: 1 addition & 1 deletion Resources/views/Resetting/request_content.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% trans_default_domain 'FOSUserBundle' %}

<div class="form-wrap form-form_wrap">
<h1>{{ 'xm_security.resetting.form_title'|trans([], 'XMSecurityBundle') }}</h1>
<h1 class="mt-0">{{ 'xm_security.resetting.form_title'|trans([], 'XMSecurityBundle') }}</h1>

<form action="{{ path('fos_user_resetting_send_email') }}" method="POST">

2 changes: 1 addition & 1 deletion Resources/views/Resetting/reset_content.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% trans_default_domain 'FOSUserBundle' %}

<div class="form-wrap form-form_wrap">
<h1>{{ 'xm_security.resetting.form_title'|trans([], 'XMSecurityBundle') }}</h1>
<h1 class="mt-0">{{ 'xm_security.resetting.form_title'|trans([], 'XMSecurityBundle') }}</h1>

{{ form_start(form, { 'action': path('fos_user_resetting_reset', {'token': token}) }) }}

4 changes: 2 additions & 2 deletions Resources/views/Security/login.html.twig
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
{% endif %}

<div class="form-wrap form-form_wrap">
<h1>{{ 'xm_security.login.form_title'|trans([], 'XMSecurityBundle') }}</h1>
<h1 class="mt-0">{{ 'xm_security.login.form_title'|trans([], 'XMSecurityBundle') }}</h1>

<form action="{{ path('fos_user_security_check') }}" method="post">
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
@@ -43,7 +43,7 @@
</form>
</div>

{% if registration_is_enabled %}
{% if registration_is_enabled is defined and registration_is_enabled %}
<div class="content-wrap_inside -text-center mt-8 mb-4 text-center">
<a href="{{ path('fos_user_registration_register') }}" class="button">{{ 'registration.submit'|trans }}</a>
</div>
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -12,11 +12,11 @@
],
"require": {
"php": "^5.6 || ^7.0",
"friendsofsymfony/user-bundle": "~2.0.0-beta1",
"symfony/form": "~3.0",
"symfony/framework-bundle": "~3.0",
"doctrine/orm": "~2.5",
"xm/mail-manager-bundle": "~0.2"
"friendsofsymfony/user-bundle": "^2.0",
"symfony/form": "^3.0",
"symfony/framework-bundle": "^3.0",
"doctrine/orm": "^2.5",
"xm/mail-manager-bundle": "^0.2 || ^0.3"
},
"autoload": {
"psr-4": { "XM\\SecurityBundle\\": "" },