Merge branch '2013.10' into 2014.11
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 2 Sep 2015 14:05:32 +0000 (16:05 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 2 Sep 2015 14:05:32 +0000 (16:05 +0200)
tine20/Courses/Controller/Course.php
tine20/Courses/Frontend/Json.php

index a76e071..a8b6ac9 100644 (file)
@@ -494,7 +494,7 @@ class Courses_Controller_Course extends Tinebase_Controller_Record_Abstract
             'accountEmailDomain'            => (isset($this->_config->domain)) ? $this->_config->domain : '',
             'accountHomeDirectoryPrefix'    => (isset($this->_config->basehomedir)) ? $this->_config->basehomedir . $schoolName . '/'. $course->name . '/' : '',
             'userNameSchema'                => $this->_config->get(Courses_Config::STUDENTS_USERNAME_SCHEMA, 1),
-            'password'                      => strtolower($course->name) . $this->_config->get(Courses_Config::STUDENT_PASSWORD_SUFFIX, ''),
+            'password'                      => $this->getStudentPassword($course->name),
             'course'                        => $course,
             'accountLoginShell'             => '/bin/false',
             'samba'                         => (isset($this->_config->samba)) ? array(
@@ -508,6 +508,18 @@ class Courses_Controller_Course extends Tinebase_Controller_Record_Abstract
         );
     }
     
+    
+    /**
+     * Returns default student password
+     * 
+     * @param string $courseName
+     * @return string
+     */
+    public function getStudentPassword($courseName)
+    {
+        return strtolower($courseName) . $this->_config->get(Courses_Config::STUDENT_PASSWORD_SUFFIX, '');
+    }
+    
     /**
      * add new member to course
      * 
index 3a17513..732bb5a 100644 (file)
@@ -299,6 +299,7 @@ class Courses_Frontend_Json extends Tinebase_Frontend_Json_Abstract
      */
     public function resetPassword($account, $password, $mustChange)
     {
+        $password = $this->_controller->getStudentPassword($password);
         $adminJson = new Admin_Frontend_Json();
         return $adminJson->resetPassword($account, $password, (bool)$mustChange);
     }