summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobiasKaminsky <tobias@kaminsky.me>2016-11-24 19:30:36 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-02-15 17:45:35 -0600
commitc3fe8f6cf27f45d3fbcdc625ba547e3736edd07a (patch)
tree4c4a71255cea5e1fef490efabe4472fdf41ef2ac
parentbe139c85a8ea7809a710a4be57b40a9001026117 (diff)
downloadnextcloud-server-c3fe8f6cf27f45d3fbcdc625ba547e3736edd07a.tar.gz
nextcloud-server-c3fe8f6cf27f45d3fbcdc625ba547e3736edd07a.zip
use random password if "password link" is enabled
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r--lib/private/User/Manager.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php
index 39845fba88d..b1f328b6f1b 100644
--- a/lib/private/User/Manager.php
+++ b/lib/private/User/Manager.php
@@ -281,9 +281,11 @@ class Manager extends PublicEmitter implements IUserManager {
if (strlen(trim($uid, "\t\n\r\0\x0B\xe2\x80\x8b")) !== strlen(trim($uid))) {
throw new \Exception($l->t('Username contains whitespace at the beginning or at the end'));
}
- // empty password only allowed if password link is sent
+ // if password link is sent use random password; permit empty password
if (trim($password) == '' && $this->config->getAppValue('core', 'umgmt_send_passwordlink', 'false') === 'false') {
throw new \Exception($l->t('A valid password must be provided'));
+ } else {
+ $password = \OC::$server->getSecureRandom()->generate(32);
}
// Check if user already exists