summaryrefslogtreecommitdiff
path: root/includes/password
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:02 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:02 -0400
commit1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch)
treef1fdd326034e05177596851be6a7127615d81498 /includes/password
parent9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff)
parentf6d65e533c62f6deb21342d4901ece24497b433e (diff)
Merge commit 'f6d65'
# Conflicts: # skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'includes/password')
-rw-r--r--includes/password/PasswordFactory.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/includes/password/PasswordFactory.php b/includes/password/PasswordFactory.php
index 3b4ebb1a..86a3fefd 100644
--- a/includes/password/PasswordFactory.php
+++ b/includes/password/PasswordFactory.php
@@ -69,6 +69,15 @@ final class PasswordFactory {
}
/**
+ * Get the default password type
+ *
+ * @return string
+ */
+ public function getDefaultType() {
+ return $this->default;
+ }
+
+ /**
* Initialize the internal static variables using the global variables
*
* @param Config $config Configuration object to load data from
@@ -141,11 +150,15 @@ final class PasswordFactory {
* If no existing object is given, make a new default object. If one is given, clone that
* object. Then pass the plaintext to Password::crypt().
*
- * @param string $password Plaintext password
+ * @param string|null $password Plaintext password, or null for an invalid password
* @param Password|null $existing Optional existing hash to get options from
* @return Password
*/
public function newFromPlaintext( $password, Password $existing = null ) {
+ if ( $password === null ) {
+ return new InvalidPassword( $this, array( 'type' => '' ), null );
+ }
+
if ( $existing === null ) {
$config = $this->types[$this->default];
$obj = new $config['class']( $this, $config );