Commit 08dcfa08 authored by Ασπασία Κατσή's avatar Ασπασία Κατσή

Merge branch 'version2' into 'develop'

Version2

See merge request itminedu/e-epal!288
parents bfaaaf5c 520acea7
......@@ -112,7 +112,7 @@ class CurrentUser extends ControllerBase
$numAppSelf = $this->getNumApps($epalUser->user_id->target_id, "Μαθητής");
$numAppChildren = $this->getNumApps($epalUser->user_id->target_id, "Γονέας/Κηδεμόνας");
if ($numSelf === -1 || $numChildren === -1)
if ($numAppSelf === -1 || $numAppChildren === -1)
return $this->respondWithStatus([
'message' => t("num of children not found"),
], Response::HTTP_INTERNAL_SERVER_ERROR);
......@@ -169,7 +169,7 @@ class CurrentUser extends ControllerBase
$numAppSelf = $this->getNumApps($epalUser->user_id->target_id, "Μαθητής");
$numAppChildren = $this->getNumApps($epalUser->user_id->target_id, "Γονέας/Κηδεμόνας");
if ($numSelf === -1 || $numChildren === -1)
if ($numAppSelf === -1 || $numAppChildren === -1)
return $this->respondWithStatus([
'message' => t("num of children not found"),
], Response::HTTP_INTERNAL_SERVER_ERROR);
......@@ -363,6 +363,13 @@ class CurrentUser extends ControllerBase
$postData = json_decode($content);
$representRole = $postData->userProfile->representRole;
//validate representRole
/*
if ( $epalUser->name->value !== "" && intval($epalUser->representative->value) !== $representRole )
return $this->respondWithStatus([
"error_code" => 5001
], Response::HTTP_INTERNAL_SERVER_ERROR);
*/
$crypt = new Crypt();
try {
$name_encoded = $crypt->encrypt($postData->userProfile->userName);
......
......@@ -75,7 +75,7 @@ class CBController extends ControllerBase
$configRowName = $this->oauthostSession->configrowname->value;
} else {
$response = new Response();
$response->setContent('forbidden1');
$response->setContent('forbidden: no valid oauthostSessions');
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json');
return $response;
......@@ -116,7 +116,7 @@ class CBController extends ControllerBase
$this->redirect_url = $ostauthConfig->redirect_url->value;
} else {
$response = new Response();
$response->setContent('forbidden2');
$response->setContent('forbidden: no valid ostauthConfig');
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json');
return $response;
......@@ -142,7 +142,7 @@ class CBController extends ControllerBase
} else {
$this->logger->notice('epalToken false');
$response = new Response();
$response->setContent('forbidden3');
$response->setContent('forbidden: epalToken false');
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json');
return $response;
......@@ -155,6 +155,7 @@ class CBController extends ControllerBase
$taxis_userid = null;
$trx = $this->connection->startTransaction();
$oauth = new OAuth($this->consumer_key, $this->consumer_secret, OAUTH_SIG_METHOD_PLAINTEXT, OAUTH_AUTH_TYPE_URI);
$oauth->disableSSLChecks();
// $oauth->enableDebug();
$oauth->setToken($authToken, $this->requestTokenSecret);
$accessToken = $oauth->getAccessToken($this->access_token_url, '', $authVerifier);
......@@ -169,7 +170,10 @@ class CBController extends ControllerBase
}
$currentTime = time();
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('taxis_userid' => $taxis_userData['tin']));
$hashId = hash("sha256", $taxis_userData['tin']);
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('taxis_userid' => $hashId));
//$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('taxis_userid' => $taxis_userData['tin']));
$epalUser = reset($epalUsers);
$epalToken = md5(uniqid(mt_rand(), true));
......@@ -231,25 +235,19 @@ class CBController extends ControllerBase
}
unset($crypt);
$hashId = hash("sha256", $taxis_userData['tin']);
$epalUser = $this->entityTypeManager()->getStorage('epal_users')->create(array(
'langcode' => 'el',
'user_id' => $user->id(),
'drupaluser_id' => $user->id(),
'taxis_userid' => $taxis_userData['tin'],
'taxis_taxid' => $taxis_userData['tin'],
/* 'name' => $taxis_userData['firstName'],
'surname' => $taxis_userData['surname'],
'fathername' => $taxis_userData['fathersName'], */
//'name' => $unique_id,
//'surname' => $unique_id,
//'fathername' => $unique_id,
//'mothername' => $unique_id,
//'taxis_userid' => $taxis_userData['tin']),
'taxis_userid' => $hashId,
//'taxis_taxid' => $taxis_userData['tin'],
'taxis_taxid' => $hashId,
'name' => $name_encoded,
'surname' => $name_encoded,
'fathername' => $name_encoded,
'mothername' => $name_encoded,
'accesstoken' => $accessToken['oauth_token'],
'accesstoken_secret' => $accessToken['oauth_token_secret'],
'authtoken' => $epalToken,
......
......@@ -98,7 +98,7 @@ class OAuthLogin extends ControllerBase
$this->redirect_url = $ostauthConfig->redirect_url->value;
} else {
$response = new Response();
$response->setContent('forbidden1');
$response->setContent('forbidden: no valid ostauthConfig');
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json');
return $response;
......@@ -106,7 +106,7 @@ class OAuthLogin extends ControllerBase
try {
$oauth = new OAuth($this->consumer_key, $this->consumer_secret, OAUTH_SIG_METHOD_PLAINTEXT, OAUTH_AUTH_TYPE_URI);
$oauth->disableSSLChecks();
$oauth->enableDebug();
$uniqid = uniqid('sid');
......@@ -135,7 +135,7 @@ class OAuthLogin extends ControllerBase
} catch (OAuthException $e) {
$this->logger->warning($e->getMessage());
$response = new Response();
$response->setContent('forbidden2');
$response->setContent('forbidden: LoginGo: OAuthException');
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json');
return $response;
......
......@@ -31,9 +31,10 @@ export default class Main {
// deserializeState: reimmutify,
});
const storeEnhancers = _devTools.isEnabled() ?
[ _devTools.enhancer() ] :
[];
const storeEnhancers =
//_devTools.isEnabled() ?
//[ _devTools.enhancer() ] :
[];
_ngRedux.configureStore(
rootReducer,
......@@ -41,6 +42,7 @@ export default class Main {
[],
// _devTools.enhancer(),
storeEnhancers);
// middleware,
// tools ? [ ...enhancers, tools ] : enhancers);
// tools);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment