Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
a7495dae
Commit
a7495dae
authored
Feb 07, 2019
by
Marc Egger
Browse files
Password.php: make Password functions static, run Typo3 bootstrap
parent
4cc6bd5c
Pipeline
#1497
passed with stage
in 2 minutes and 5 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Source/core/typo3/Password.php
View file @
a7495dae
...
...
@@ -25,10 +25,10 @@ class Password {
* @param string $newPassword
* @return string
*/
public
function
getHash
(
$newPassword
)
{
public
static
function
getHash
(
$newPassword
)
{
$saltedPassword
=
md5
(
$newPassword
);
// Use md5 as fallback
$this
->
t3AutoloadIfNotRunning
();
self
::
t3AutoloadIfNotRunning
();
if
(
\
TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility
::
isUsageEnabled
(
'FE'
))
{
$objSalt
=
\
TYPO3\CMS\Saltedpasswords\Salt\SaltFactory
::
getSaltingInstance
(
NULL
);
if
(
is_object
(
$objSalt
))
{
...
...
@@ -46,9 +46,9 @@ class Password {
* @param string $password
* @return bool
*/
public
function
checkPassword
(
$saltedPassword
,
$password
)
{
public
static
function
checkPassword
(
$saltedPassword
,
$password
)
{
$this
->
t3AutoloadIfNotRunning
();
self
::
t3AutoloadIfNotRunning
();
$success
=
FALSE
;
if
(
\
TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility
::
isUsageEnabled
(
'FE'
))
{
$objSalt2
=
\
TYPO3\CMS\Saltedpasswords\Salt\SaltFactory
::
getSaltingInstance
(
$saltedPassword
);
...
...
@@ -62,11 +62,21 @@ class Password {
/**
* Load Typo3 autoloader if Typo3 is not instantiated
*/
public
function
t3AutoloadIfNotRunning
()
{
public
static
function
t3AutoloadIfNotRunning
()
{
if
(
!
isset
(
$GLOBALS
[
'TSFE'
]
))
{
if
(
!
class_exists
(
'\TYPO3\CMS\Saltedpasswords\Utility\SaltedPasswordsUtility'
))
{
//TODO: Get absolute 'path' via QFQ config
require
__DIR__
.
'/../../../../../../typo3_src/vendor/autoload.php'
;
// run typo3 bootstrap if not yet happened. Necessary if run in unittest.
if
(
!
defined
(
'TYPO3_MODE'
))
{
\
TYPO3\CMS\Core\Core\Bootstrap
::
getInstance
()
->
setRequestType
(
TYPO3_REQUESTTYPE_AJAX
)
->
baseSetup
(
0
);
// Alternate error fix if you don't want to run Typo3 bootstrap:
// error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED));
define
(
'TYPO3_MODE'
,
'FE'
);
}
}
}
}
\ No newline at end of file
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