Fixed bug preventing switching back to subdomain from website

This commit is contained in:
Hillel Coren 2016-07-05 12:49:09 +03:00
parent 1fe671bffb
commit 3c66c0166b

View File

@ -938,18 +938,18 @@ class AccountController extends BaseController
private function saveEmailSettings() private function saveEmailSettings()
{ {
if (Auth::user()->account->hasFeature(FEATURE_CUSTOM_EMAILS)) { if (Auth::user()->account->hasFeature(FEATURE_CUSTOM_EMAILS)) {
$rules = [];
$user = Auth::user(); $user = Auth::user();
$iframeURL = preg_replace('/[^a-zA-Z0-9_\-\:\/\.]/', '', substr(strtolower(Input::get('iframe_url')), 0, MAX_IFRAME_URL_LENGTH)); $subdomain = null;
$iframeURL = rtrim($iframeURL, '/'); $iframeURL = null;
$rules = [];
$subdomain = preg_replace('/[^a-zA-Z0-9_\-\.]/', '', substr(strtolower(Input::get('subdomain')), 0, MAX_SUBDOMAIN_LENGTH)); if (Input::get('custom_link') == 'subdomain') {
if ($iframeURL) { $subdomain = preg_replace('/[^a-zA-Z0-9_\-\.]/', '', substr(strtolower(Input::get('subdomain')), 0, MAX_SUBDOMAIN_LENGTH));
$subdomain = null;
}
if ($subdomain) {
$exclude = ['www', 'app', 'mail', 'admin', 'blog', 'user', 'contact', 'payment', 'payments', 'billing', 'invoice', 'business', 'owner', 'info', 'ninja']; $exclude = ['www', 'app', 'mail', 'admin', 'blog', 'user', 'contact', 'payment', 'payments', 'billing', 'invoice', 'business', 'owner', 'info', 'ninja'];
$rules['subdomain'] = "unique:accounts,subdomain,{$user->account_id},id|not_in:" . implode(',', $exclude); $rules['subdomain'] = "unique:accounts,subdomain,{$user->account_id},id|not_in:" . implode(',', $exclude);
} else {
$iframeURL = preg_replace('/[^a-zA-Z0-9_\-\:\/\.]/', '', substr(strtolower(Input::get('iframe_url')), 0, MAX_IFRAME_URL_LENGTH));
$iframeURL = rtrim($iframeURL, '/');
} }
$validator = Validator::make(Input::all(), $rules); $validator = Validator::make(Input::all(), $rules);