Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
edd768ea
Commit
edd768ea
authored
Nov 25, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add message after pswd update & small code fixes
parent
61e6ce3e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
18 deletions
+40
-18
app.css
assets/css/app.css
+0
-1
app.js
assets/js/app.js
+5
-3
IndexController.php
src/Controller/IndexController.php
+29
-4
UserAdherentController.php
src/Controller/UserAdherentController.php
+1
-2
UserController.php
src/Controller/UserController.php
+4
-7
UserListener.php
src/EventListener/UserListener.php
+1
-1
No files found.
assets/css/app.css
View file @
edd768ea
...
@@ -73,7 +73,6 @@ legend.required:after {
...
@@ -73,7 +73,6 @@ legend.required:after {
text-align
:
center
;
text-align
:
center
;
text-decoration
:
none
;
text-decoration
:
none
;
margin
:
4px
2px
;
margin
:
4px
2px
;
/* margin: 6px 4px; */
border-radius
:
50%
;
border-radius
:
50%
;
}
}
...
...
assets/js/app.js
View file @
edd768ea
...
@@ -472,10 +472,12 @@ $(function() {
...
@@ -472,10 +472,12 @@ $(function() {
$
(
".paiementDate"
).
toggle
(
this
.
checked
);
$
(
".paiementDate"
).
toggle
(
this
.
checked
);
});
});
// Reset value on page loading (in case of second try)
$
(
"#formEncaissement_payment_code"
).
val
(
''
);
if
(
$
(
"form[name='formEncaissement']"
).
length
>
0
)
{
if
(
$
(
"form[name='formEncaissement']"
).
length
>
0
)
{
// Reset value on page loading (in case of second try)
$
(
"#formEncaissement_payment_code"
).
val
(
''
);
// Set payment summary on validation page
let
paymentValidationSubheaderText
=
`
${
$
(
"#formEncaissement_adherent option:selected"
).
text
()}
- Montant :
${
$
(
"#formEncaissement_montant"
).
val
()}
`
;
let
paymentValidationSubheaderText
=
`
${
$
(
"#formEncaissement_adherent option:selected"
).
text
()}
- Montant :
${
$
(
"#formEncaissement_montant"
).
val
()}
`
;
$
(
"#payment-validation-subheader"
).
text
(
paymentValidationSubheaderText
);
$
(
"#payment-validation-subheader"
).
text
(
paymentValidationSubheaderText
);
}
}
...
...
src/Controller/IndexController.php
View file @
edd768ea
...
@@ -39,6 +39,7 @@ use Symfony\Component\Security\Core\Security as Secur;
...
@@ -39,6 +39,7 @@ use Symfony\Component\Security\Core\Security as Secur;
use
Symfony\Component\Security\Csrf\CsrfTokenManagerInterface
;
use
Symfony\Component\Security\Csrf\CsrfTokenManagerInterface
;
use
Symfony\Component\Security\Guard\GuardAuthenticatorHandler
;
use
Symfony\Component\Security\Guard\GuardAuthenticatorHandler
;
use
Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken
;
use
Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken
;
use
Symfony\Component\Security\Core\Security
;
class
IndexController
extends
AbstractController
class
IndexController
extends
AbstractController
{
{
...
@@ -51,9 +52,20 @@ class IndexController extends AbstractController
...
@@ -51,9 +52,20 @@ class IndexController extends AbstractController
private
$session
;
private
$session
;
private
$tokenStorage
;
private
$tokenStorage
;
private
$router
;
private
$router
;
private
$security
;
public
function
__construct
(
EventDispatcherInterface
$eventDispatcher
,
EntityManagerInterface
$em
,
UserManagerInterface
$userManager
,
CsrfTokenManagerInterface
$tokenManager
=
null
,
GuardAuthenticatorHandler
$guard
,
SessionInterface
$session
,
LoginAuthenticator
$authenticator
,
TokenStorageInterface
$tokenStorage
,
RouterInterface
$router
)
{
public
function
__construct
(
EventDispatcherInterface
$eventDispatcher
,
EntityManagerInterface
$em
,
UserManagerInterface
$userManager
,
CsrfTokenManagerInterface
$tokenManager
=
null
,
GuardAuthenticatorHandler
$guard
,
SessionInterface
$session
,
LoginAuthenticator
$authenticator
,
TokenStorageInterface
$tokenStorage
,
RouterInterface
$router
,
Security
$security
)
{
$this
->
eventDispatcher
=
$eventDispatcher
;
$this
->
eventDispatcher
=
$eventDispatcher
;
$this
->
em
=
$em
;
$this
->
em
=
$em
;
$this
->
userManager
=
$userManager
;
$this
->
userManager
=
$userManager
;
...
@@ -63,7 +75,8 @@ class IndexController extends AbstractController
...
@@ -63,7 +75,8 @@ class IndexController extends AbstractController
$this
->
session
=
$session
;
$this
->
session
=
$session
;
$this
->
tokenStorage
=
$tokenStorage
;
$this
->
tokenStorage
=
$tokenStorage
;
$this
->
router
=
$router
;
$this
->
router
=
$router
;
}
$this
->
security
=
$security
;
}
/**
/**
* @Route("/", name="index")
* @Route("/", name="index")
...
@@ -91,6 +104,18 @@ class IndexController extends AbstractController
...
@@ -91,6 +104,18 @@ class IndexController extends AbstractController
$template
=
'index_wordpress.html.twig'
;
$template
=
'index_wordpress.html.twig'
;
}
}
if
(
isset
(
$_GET
[
"upswd"
])
&&
$_GET
[
"upswd"
]
==
"success"
&&
$this
->
security
->
isGranted
(
'ROLE_ADHERENT'
)
&&
$this
->
getParameter
(
'tav_env'
)
==
true
)
{
$this
->
addFlash
(
'warning'
,
'Suite à la modification de votre mot de passe, pensez à mettre à jour votre code de paiment pour pouvoir effectuer des achats.'
);
}
return
$this
->
render
(
'@kohinos/'
.
$template
,
[
return
$this
->
render
(
'@kohinos/'
.
$template
,
[
'news'
=>
[],
'news'
=>
[],
'last_username'
=>
$lastUsername
,
'last_username'
=>
$lastUsername
,
...
...
src/Controller/UserAdherentController.php
View file @
edd768ea
...
@@ -19,7 +19,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
...
@@ -19,7 +19,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\Routing\Annotation\Route
;
use
Symfony\Component\Routing\Annotation\Route
;
use
Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface
;
class
UserAdherentController
extends
FluxController
class
UserAdherentController
extends
FluxController
{
{
...
@@ -163,7 +162,7 @@ class UserAdherentController extends FluxController
...
@@ -163,7 +162,7 @@ class UserAdherentController extends FluxController
* @Route("/adherent/set-payment-code", name="adherentSetPaymentCode")
* @Route("/adherent/set-payment-code", name="adherentSetPaymentCode")
* @IsGranted("ROLE_ADHERENT")
* @IsGranted("ROLE_ADHERENT")
*/
*/
public
function
setPaymentCodeAction
(
Request
$request
,
UserPasswordEncoderInterface
$encoder
)
public
function
setPaymentCodeAction
(
Request
$request
)
{
{
$adherent
=
$this
->
getUser
()
->
getAdherent
();
$adherent
=
$this
->
getUser
()
->
getAdherent
();
$form
=
$this
->
createForm
(
SetPaymentCodeFormType
::
class
,
$adherent
);
$form
=
$this
->
createForm
(
SetPaymentCodeFormType
::
class
,
$adherent
);
...
...
src/Controller/UserController.php
View file @
edd768ea
...
@@ -29,7 +29,6 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
...
@@ -29,7 +29,6 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface;
use
Symfony\Component\Routing\Annotation\Route
;
use
Symfony\Component\Routing\Annotation\Route
;
use
Symfony\Component\Security\Core\Security
;
use
Symfony\Component\Security\Core\Security
;
use
Symfony\Component\Translation\TranslatorInterface
;
use
Symfony\Component\Translation\TranslatorInterface
;
use
Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface
;
use
Twig\Environment
;
use
Twig\Environment
;
class
UserController
extends
AbstractController
class
UserController
extends
AbstractController
...
@@ -247,11 +246,9 @@ class UserController extends AbstractController
...
@@ -247,11 +246,9 @@ class UserController extends AbstractController
* @Route("/encaissement", name="encaissement")
* @Route("/encaissement", name="encaissement")
* @IsGranted({"ROLE_CAISSIER", "ROLE_PRESTATAIRE"})
* @IsGranted({"ROLE_CAISSIER", "ROLE_PRESTATAIRE"})
*/
*/
public
function
encaissementAction
(
Request
$request
,
UserPasswordEncoderInterface
$encoder
)
public
function
encaissementAction
(
Request
$request
)
{
{
$options
=
[];
$form
=
$this
->
createForm
(
EncaissementFormType
::
class
,
null
,
[]);
$form
=
$this
->
createForm
(
EncaissementFormType
::
class
,
null
,
$options
);
$form
->
handleRequest
(
$request
);
$form
->
handleRequest
(
$request
);
$validation
=
false
;
$validation
=
false
;
...
@@ -260,7 +257,7 @@ class UserController extends AbstractController
...
@@ -260,7 +257,7 @@ class UserController extends AbstractController
if
(
$form
->
isValid
())
{
if
(
$form
->
isValid
())
{
$input_code
=
$data
[
"payment_code"
];
$input_code
=
$data
[
"payment_code"
];
$validation
=
true
;
// As soon as the form is
valid, we're in validation
$validation
=
true
;
// As soon as the form is
submitted & valid, we enter the validation process
if
(
empty
(
$input_code
))
{
if
(
empty
(
$input_code
))
{
// First step validated (set user & amount) -> go to validation
// First step validated (set user & amount) -> go to validation
...
@@ -281,7 +278,7 @@ class UserController extends AbstractController
...
@@ -281,7 +278,7 @@ class UserController extends AbstractController
}
}
// Check validation code
// Check validation code
//
TODO
as we use password salt, must change payment code if password changes
//
NOTE
as we use password salt, must change payment code if password changes
$encoded_input
=
crypt
(
$input_code
,
$adherent
->
getUser
()
->
getSalt
());
$encoded_input
=
crypt
(
$input_code
,
$adherent
->
getUser
()
->
getSalt
());
if
(
!
hash_equals
(
$adherent_code
,
$encoded_input
))
{
if
(
!
hash_equals
(
$adherent_code
,
$encoded_input
))
{
$this
->
addFlash
(
$this
->
addFlash
(
...
...
src/EventListener/UserListener.php
View file @
edd768ea
...
@@ -56,7 +56,7 @@ class UserListener implements EventSubscriberInterface
...
@@ -56,7 +56,7 @@ class UserListener implements EventSubscriberInterface
public
function
onChangePasswordSuccess
(
FormEvent
$event
)
public
function
onChangePasswordSuccess
(
FormEvent
$event
)
{
{
$url
=
$this
->
router
->
generate
(
'index'
);
$url
=
$this
->
router
->
generate
(
'index'
)
.
'?upswd=success'
;
$event
->
setResponse
(
new
RedirectResponse
(
$url
));
$event
->
setResponse
(
new
RedirectResponse
(
$url
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment