function recover()
 {
     // Get the email address from the request
     $email = Input::get('email');
     // Try to get the user from the email address
     $user = User::fromEmail($email);
     // If it's a guest just quietly allow it
     // but if it's not send the password to the email
     if (!$user->isGuest()) {
         $user->createTempPassword();
     }
     // Render the json with success no matter what
     View::renderJson();
 }
 function add_professor()
 {
     Auth::checkLoggedIn();
     // Get the course and make sure the user can edit it
     $course = Course::fromId(Input::get('courseid'));
     if (!$course->canEdit(Auth::getUser())) {
         throw new Exception('You cannot add users to this course.');
     }
     // Get the comma seperated list of emails
     $email = Input::get('list');
     // Make sure it is a valid address
     if (!Utils::isValidEmail($email)) {
         throw new Exception('Invalid email address given.');
     }
     // Get the user it belongs to
     $user = User::fromEmail($email);
     if ($user->isGuest()) {
         throw new Exception('Invalid email address given, no user found.');
     }
     // Add the user to the course
     $course->addProfessor($user);
     // Return the new context
     View::renderJson($course->getContext(Auth::getUser()));
 }