Use password suffix on student password reset
authorsstamer <s.stamer@metaways.de>
Wed, 2 Sep 2015 07:12:45 +0000 (09:12 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 2 Sep 2015 12:06:08 +0000 (14:06 +0200)
Change-Id: I92dc856de6c35c2f2fdfc329c521c777c9b42fff
Reviewed-on: http://gerrit.tine20.com/customers/2156
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Courses/Controller/Course.php
tine20/Courses/Frontend/Json.php

index 294c03c..e227891 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);
     }