mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add optional login server url to use forwarded url for example by using forwarding domain for dynamicDNS
This commit is contained in:
parent
5821d7261c
commit
ad1788a3ee
@ -33,7 +33,8 @@ use Cake\I18n\I18n;
|
||||
*/
|
||||
class AppController extends Controller
|
||||
{
|
||||
|
||||
|
||||
var $loginServerUrl = '';
|
||||
/**
|
||||
* Initialization hook method.
|
||||
*
|
||||
@ -128,6 +129,15 @@ class AppController extends Controller
|
||||
if($this->Auth->user('id')) {
|
||||
$GLOBALS['ServerUser'] = $this->Auth->user();
|
||||
}
|
||||
|
||||
// login server url
|
||||
$loginServer = Configure::read('LoginServer');
|
||||
if($loginServer && isset($loginServer['url'])) {
|
||||
$this->loginServerUrl = $loginServer['url'] . '/';
|
||||
} else {
|
||||
$this->loginServerUrl = Router::url('/', true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -221,7 +231,7 @@ class AppController extends Controller
|
||||
// we haven't get a pubkey? something seems to gone wrong on the login-server
|
||||
$this->Flash->error(__('no pubkey'));
|
||||
//var_dump($json);
|
||||
return $this->redirect(Router::url('/', true) . 'account/error500/noPubkey', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account/error500/noPubkey', 303);
|
||||
}
|
||||
} else {
|
||||
if($json['state'] === 'not found' ) {
|
||||
@ -229,7 +239,7 @@ class AppController extends Controller
|
||||
} else {
|
||||
$this->Flash->error(__('Konto ist nicht aktiviert!'));
|
||||
}
|
||||
return $this->redirect(Router::url('/', true) . 'account/', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account/', 303);
|
||||
}
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
@ -244,7 +254,7 @@ class AppController extends Controller
|
||||
if(isset($loginServer['path'])) {
|
||||
return $this->redirect($loginServer['path'], 303);
|
||||
} else {
|
||||
return $this->redirect(Router::url('/', true) . 'account/', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account/', 303);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -109,7 +109,7 @@ class StateUsersController extends AppController
|
||||
if($dataJson['state'] != 'success') {
|
||||
if($dataJson['msg'] == 'session not found') {
|
||||
$session->destroy();
|
||||
return $this->redirect(Router::url('/', true) . 'account', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account', 303);
|
||||
}
|
||||
}
|
||||
//var_dump($dataJson);
|
||||
|
||||
@ -151,7 +151,7 @@ class TransactionCreationsController extends AppController
|
||||
if($json['state'] != 'success') {
|
||||
if($json['msg'] == 'session not found') {
|
||||
$session->destroy();
|
||||
return $this->redirect(Router::url('/', true) . 'account', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account', 303);
|
||||
} else {
|
||||
$this->addAdminError('TransactionCreations', 'create', $json, $user['id']);
|
||||
$this->Flash->error(__('Login Server Error, please wait for the admin to fix it'));
|
||||
@ -166,7 +166,7 @@ class TransactionCreationsController extends AppController
|
||||
$session->write('Transactions.pending', $pendingTransactionCount);
|
||||
//echo "pending: " . $pendingTransactionCount;
|
||||
if($mode === 'next') {
|
||||
return $this->redirect(Router::url('/', true) . 'account/checkTransactions', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account/checkTransactions', 303);
|
||||
} else {
|
||||
$this->Flash->success(__('Transaction submitted for review.'));
|
||||
}
|
||||
@ -392,7 +392,7 @@ class TransactionCreationsController extends AppController
|
||||
if($json['state'] != 'success') {
|
||||
if($json['msg'] == 'session not found') {
|
||||
$session->destroy();
|
||||
return $this->redirect(Router::url('/', true) . 'account', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account', 303);
|
||||
} else {
|
||||
$this->addAdminError('TransactionCreations', 'createMulti', $json, $user['id']);
|
||||
$this->Flash->error(__('Login Server Error, please wait for the admin to fix it'));
|
||||
@ -407,7 +407,7 @@ class TransactionCreationsController extends AppController
|
||||
$session->write('Transactions.pending', $pendingTransactionCount);
|
||||
//echo "pending: " . $pendingTransactionCount;
|
||||
if($mode === 'next') {
|
||||
return $this->redirect(Router::url('/', true) . 'account/checkTransactions', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account/checkTransactions', 303);
|
||||
} else {
|
||||
$this->Flash->success(__('Transaction submitted for review.'));
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ class TransactionSendCoinsController extends AppController
|
||||
if($json['state'] != 'success') {
|
||||
if($json['msg'] == 'session not found') {
|
||||
$session->destroy();
|
||||
return $this->redirect(Router::url('/', true) . 'account', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account', 303);
|
||||
//$this->Flash->error(__('session not found, please login again'));
|
||||
} else {
|
||||
$this->Flash->error(__('login server return error: ' . json_encode($json)));
|
||||
@ -259,7 +259,7 @@ class TransactionSendCoinsController extends AppController
|
||||
$session->write('Transactions.pending', $pendingTransactionCount);
|
||||
//echo "pending: " . $pendingTransactionCount;
|
||||
if($mode === 'next') {
|
||||
return $this->redirect(Router::url('/', true) . 'account/checkTransactions', 303);
|
||||
return $this->redirect($this->loginServerUrl . 'account/checkTransactions', 303);
|
||||
} else {
|
||||
$this->Flash->success(__('Transaction submitted for review.'));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user