Example #1
0
 private function success()
 {
     Helper_Message::setSuccess($this->app, "Password successfuly reset. Check your email.");
     $this->app->redirect('/login/forgot');
     die;
 }
Example #2
0
 public function POST()
 {
     $policy = new Policy_LoggedIn($this->app);
     $policy->ensure();
     $userid = $policy->getData();
     $app = Config::get('app');
     $request = $this->app->request();
     $user_settings = $app->user_settings;
     foreach ($user_settings as $setting) {
         $val = trim($request->post($setting['name']));
         $newVal = $setting['default'];
         if ($setting['validate'] == 'boolean') {
             if ($val == 'on') {
                 $newVal = 1;
             } else {
                 $newVal = 0;
             }
         } else {
             if ($setting['validate'] == 'height') {
                 $newVal = $val;
                 if (!is_numeric($newVal)) {
                     $newVal = 0;
                 } else {
                     if ($newVal < 0) {
                         $newVal = 0;
                     } else {
                         if ($newVal > 120) {
                             $newVal = 120;
                         }
                     }
                 }
                 $newVal = round($newVal, 1);
             } else {
                 if ($setting['validate'] == 'weight') {
                     $newVal = $val;
                     if (!is_numeric($newVal)) {
                         $newVal = 0;
                     } else {
                         if ($newVal < 0) {
                             $newVal = 0;
                         } else {
                             if ($newVal > 1000) {
                                 $newVal = 1000;
                             }
                         }
                     }
                     $newVal = round($newVal, 1);
                 } else {
                     if ($setting['validate'] == 'timezone') {
                         $zones = DateTimeZone::listIdentifiers();
                         if (in_array($val, $zones)) {
                             $newVal = $val;
                         }
                     }
                 }
             }
         }
         $settings_mapper = new Mapper_Settings();
         $settings_mapper->updateSettingForUserid($userid, $setting['name'], $newVal);
     }
     Helper_Message::setSuccess($this->app, "Your settings were updated.");
     $this->app->redirect('/settings');
     die;
 }
Example #3
0
 private function success($string)
 {
     Helper_Message::setSuccess($this->app, $string);
     $this->app->redirect('/tools');
     die;
 }
Example #4
0
 public function success()
 {
     Helper_Message::setSuccess($this->app, "Your account settings were updated.");
     $this->app->redirect('/account');
     die;
 }