示例#1
0
    \User::val('email', $_POST['email']);
    if (!empty($_POST['new_pass'])) {
        \User::val('password', \User::encrypt_pass($_POST['new_pass']));
    }
    \User::save();
    if (is_uploaded_file($_FILES['photo']['tmp_name'])) {
        $acct->save_photo($_FILES['photo']);
    }
    if ($acct->type === 'owner') {
        // update customer too
        $customer->name = $_POST['customer_name'];
        if ($customer->subdomain !== $_POST['subdomain']) {
            $customer->subdomain = $_POST['subdomain'];
            $domain_has_changed = true;
        } else {
            $domain_has_changed = false;
        }
        if (!$customer->put()) {
            return false;
        }
        if (is_uploaded_file($_FILES['customer_logo']['tmp_name'])) {
            $customer->save_logo($_FILES['customer_logo']);
        }
        if ($domain_has_changed) {
            echo \View::render('saasy/account_redirect', array('redirect' => $form->controller->is_https() ? 'https://' . $customer->subdomain . '.' . App::base_domain() . '/' : 'http://' . $customer->subdomain . '.' . App::base_domain() . '/'));
            return;
        }
    }
    \Notifier::add_notice(__('Your settings have been updated.'));
    $form->controller->redirect(App::href() . '/account');
});