Url loading the login page again after login in Laravel4 - laravel-4.2

I have this link
http://ideconnect.com/rescom_summit_bangalore_2016/login
When I try to Login
id:meaaow#gmail.com
pass:123456
it redirects me to the main page . Can any one let me know whats the problem
My Routes
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
// Route::get('/', function()
// {
// return View::make('hello');
// });
Route::get('logout',function(){
Session::flush();
Auth::logout();
return Redirect::to('login');
});
Route::get('admin/logout',function(){
Session::flush();
Auth::logout();
return Redirect::to('admin/login');
});
Route::get('fileupload',function(){
return View::make('fileinclude');
});
Route::post('fileupload','FiletestController#indx');
Route::get('admin/emergencyUse','AdminController#emergencyUse');
Route::get('admin/emergencyUse12','AdminController#emergencyUse12');
Route::get('admin/listusers/(:any)/(:any)', function($event,$userid){
return Controller::call('AdminController#singleuser',array('event'=>$event,'userid'=>$userid));
});
Route::controller('admin','AdminController');
Route::controller('sales','SalesController');
Route::controller('event1/rankingform','RankingformController');
Route::controller('event2/rankingform','RankingformController');
Route::controller('rescom_summit_bangalore_2016/rankingform','RankingformController');
Route::controller('hotelier_summit_mumbai_2016/rankingform','RankingformController');
Route::controller('hotelier_summit_africa_2016/rankingform','RankingformController');
Route::controller('design_mission_saudi_arabia_2016/rankingform','RankingformController');
Route::controller('design_mission_north_east_2016/rankingform','RankingformController');
Route::controller('design_mission_south_west_2016/rankingform','RankingformController');
Route::controller('design_mission_middle_east_2016/rankingform','RankingformController');
Route::controller('design_mission_south_africa_2016/rankingform','RankingformController');
Route::controller('design_mission_turkey_2016/rankingform','RankingformController');
Route::controller('design_mission_asia_2016/rankingform','RankingformController');
Route::controller('design_mission_russia_2016/rankingform','RankingformController');
Route::controller('healthscape_series_2016/rankingform','RankingformController');
Route::controller('event1/form','FormController');
Route::controller('event2/form','FormController');
Route::controller('rescom_summit_bangalore_2016/form','FormController');
Route::controller('hotelier_summit_mumbai_2016/form','FormController');
Route::controller('hotelier_summit_africa_2016/form','FormController');
Route::controller('design_mission_saudi_arabia_2016/form','FormController');
Route::controller('design_mission_north_east_2016/form','FormController');
Route::controller('design_mission_south_west_2016/form','FormController');
Route::controller('design_mission_middle_east_2016/form','FormController');
Route::controller('design_mission_south_africa_2016/form','FormController');
Route::controller('design_mission_turkey_2016/form','FormController');
Route::controller('design_mission_asia_2016/form','FormController');
Route::controller('design_mission_russia_2016/form','FormController');
Route::controller('healthscape_series_2016/form','FormController');
Route::controller('rescom_summit_bangalore_2016/login','LoginController');
Route::controller('hotelier_summit_mumbai_2016/login','LoginController');
Route::controller('hotelier_summit_africa_2016/login','LoginController');
Route::controller('design_mission_saudi_arabia_2016/login','LoginController');
Route::controller('design_mission_north_east_2016/login','LoginController');
Route::controller('design_mission_south_west_2016/login','LoginController');
Route::controller('design_mission_middle_east_2016/login','LoginController');
Route::controller('design_mission_south_africa_2016/login','LoginController');
Route::controller('design_mission_turkey_2016/login','LoginController');
Route::controller('design_mission_asia_2016/login','LoginController');
Route::controller('design_mission_russia_2016/login','LoginController');
Route::controller('healthscape_series_2016/login','LoginController');
Route::get('login',function(){
return View::make('mainLogin');
});
Route::controller('hotelbookingform','HotelbookingformController');
Route::controller('hotelbooking','HotelbookingController');
Route::get('/',function(){
return Redirect::to('/login');
});
Thanks

Related

Where is the option to set maxParticipantDuration in JavaScript SDK?

I used the backend to obtain the Access Token, and connect (auto-create) to a room like this -
room = await Video.connect(accessToken, {
video: true,
audio: true,
name: "Room1",
});
I looked at ConnectOptions and I don't see anywhere that I can set the maxParticipantDuration for the room. Does anyone know where to set this? I know this can be set if the room is created using Rest API. Is this option not available if using the JavaScript SDK?
Rest API to Set maxParticipantDuration
No option in JavaScript SDK for the maximum Participant duration
From the manual
If you wish to configure the maximum Participant duration for you
Video Rooms, you can do so in two ways: via the Twilio REST API, or
via the Twilio Console.
BY API
// Download the helper library from https://www.twilio.com/docs/node/install
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);
client.video.v1.rooms
.create({
maxParticipantDuration: 86400,
uniqueName: 'My Video Room'
})
.then(room => console.log(room.sid));
By Twilio Console
So no option for maximum Participant duration in ConnectOptions here from JavaScript SDK
export interface ConnectOptions {
audio?: boolean | CreateLocalTrackOptions| CreateLocalAudioTrackOptions;
automaticSubscription?: boolean;
bandwidthProfile?: BandwidthProfileOptions;
dominantSpeaker?: boolean;
/**
* #deprecated use enableDscp
*/
dscpTagging?: boolean;
enableDscp?: boolean;
/**
* #deprecated use Video.Logger
*/
loggerName?: string;
eventListener?: EventListener;
iceServers?: Array<RTCIceServer>;
iceTransportPolicy?: RTCIceTransportPolicy;
insights?: boolean;
maxAudioBitrate?: number | null;
maxVideoBitrate?: number | null;
name?: string | null;
networkQuality?: boolean | NetworkQualityConfiguration;
notifyWarnings?: Array<NotifyWarning>;
region?: string;
preferredAudioCodecs?: Array<AudioCodec | AudioCodecSettings | OpusCodecSettings>;
preferredVideoCodecs?: Array<VideoCodec | VideoCodecSettings | VP8CodecSettings> | VideoEncodingMode;
/**
* #deprecated use Video.Logger.
*/
logLevel?: LogLevel | LogLevels;
tracks?: Array<LocalTrack | MediaStreamTrack>;
video?: boolean | CreateLocalTrackOptions;
}

Xero Oauth2 Node Examples

I am doing some expermenting with the xero API, however i cant seem to get past the Connect to Xero returning an error
"Sorry, something went wrong
Go back and try again.
If the issue continues, check out our Status Page."
I have setup my App in the xero dev center
I have tried these 2 repos
https://github.com/XeroAPI/xero-node-oauth2-app
https://github.com/XeroAPI/node-oauth2-example
Both yeld the same result just an error page, no information in console/dev tools
Any help would be amazing as im completely stuck with this
So that looks like the error you get when either API keys and/or callback urls are not setup correctly.
Have you swapped in all your api keys & callback urls to the .env (environment) files?
Create a .env file in the root of your project & replace the 3 variables
Create an .env file in the root of your project using touch .env or edit the sample prefix off sample.env and change out with your /myapps credentials of the app you just made.
CLIENT_ID=...
CLIENT_SECRET=...
REDIRECT_URI=...
Here is the library that is used successfully with ouath2.0 tokenization. The token is expired in 30 mints. After that, we need to refresh the token with old token objects.
First set up an app in developer.xero.com.
Add Company Name and Redirect URL while creating the app.
Setup environment configuration in your file.
X_CLIENT_ID=CD43E78278ED4BE68F35F155C3E708F7
X_CLIENT_SECRET=IuP5TrE70JoyYiezMRM2KwvcHFYoLy3qRbD3NFlOkYLN0Asy
X_REDIRECT_URL=https://baseredirecturl.com/xero/default/redirect
Step-1: Here is the code for creating a token and refresh token.
public function actionConnectXero()
{
$session = Yii::$app->session;
$request = Yii::$app->request;
if (empty($request->get('code'))) {
// If we don't have an authorization code then get one
$authUrl = $this->provider->getAuthorizationUrl([
'scope' => 'offline_access openid email profile accounting.settings accounting.transactions accounting.contacts accounting.reports.read projects accounting.journals.read'
]);
//offline_access openid email profile accounting.settings accounting.transactions accounting.contacts accounting.reports.read projects accounting.journals.read
$session->set('oauth2state', $this->provider->getState());
$this->redirect($authUrl);
// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($request->get('state')) || ($request->get('state') !== $session->get('oauth2state'))) {
$session->remove('oauth2state');
exit('Invalid state');
} else {
// Try to get an access token (using the authorization code grant)
$token = $this->provider->getAccessToken('authorization_code', [
'code' => $request->get('code')
]);
$session->set('access_token', $token);
//If you added the openid/profile scopes you can access the authorizing user's identity.
$identity = $this->provider->getResourceOwner($token);
echo "<pre>";
print_r($identity);
//Get the tenants that this user is authorized to access
$tenants = $this->provider->getTenants($token);
print_r($tenants);
$session->set('tenantId', $tenants[0]->tenantId);
exit;
}
}
Step-2: Redirect to URL.
public function actionRedirectXero()
{
$request = Yii::$app->request;
$codeStr = explode("?", $request->getUrl());
$token = $this->provider->getAccessToken('authorization_code', [
'code' => $request->get('code')
]);
$tenants = $this->provider->getTenants($token);
$exits = XeroConfigs::find()->where(['created_by' => Yii::$app->user->identity->id])->one();
$xeroConf = $exits ? XeroConfigs::findOne($exits->id) : new XeroConfigs();
$xeroConf->access_token = $token;
$xeroConf->refresh_token = $token->getRefreshToken();
$xeroConf->expiry = $token->getExpires();
$xeroConf->tenant_id = isset($tenants[0]) ? $tenants[0]->id : 0;
$xeroConf->token_object = serialize($token);
$xeroConf->created_by = Yii::$app->user->identity->id;
$xeroConf->save();
$this->redirect('/xero/default/get-xero-data?'.$codeStr[1]);
}
Step-3: Get data from xero. I just save and get contacts. for more examples, you can check the package documentation.
public function actionGetXeroData(){
$configs = XeroConfigs::find()->where(['created_by' => Yii::$app->user->identity->id])->one();
if($configs->expiry < time()){
$newAccessToken = $this->provider->getAccessToken('refresh_token', [
'grant_type' => 'refresh_token',
'refresh_token' => $configs->refresh_token
]);
$tenants = $this->provider->getTenants($newAccessToken);
$xeroConf = XeroConfigs::findOne($configs->id);
$xeroConf->access_token = $newAccessToken;
$xeroConf->refresh_token = $newAccessToken->getRefreshToken();
$xeroConf->expiry = $newAccessToken->getExpires();
$xeroConf->tenant_id = isset($tenants[0]) ? $tenants[0]->id : 0;;
$xeroConf->token_object = serialize($newAccessToken);;
$xeroConf->updated_at = Carbon::now()->toDateTimeString();
$xeroConf->created_by = Yii::$app->user->identity->id;
$xeroConf->save();
$configs = XeroConfigs::find()->where(['created_by' => Yii::$app->user->identity->id])->one();
}
$tokenObj = unserialize($configs->token_object);
$tenants = $this->provider->getTenants($tokenObj);
$xero = new \XeroPHP\Application($tokenObj, $tenants[0]->tenantId);
$contact = new Contact($xero);
$contact->setName('Hassan Raza')
->setAccountNumber('0245541574185741')
->setContactID('852986')
->setGUID('52552548-5585-8715-8888-871222554154')
->setBankAccountDetail('0245541574185741')
->setTaxNumber('55545352')
->setContactStatus('ACTIVE')
->setSkypeUserName('hassan_raza2010')
->setTrackingCategoryName('Manager')
->setFirstName('Hassan')
->setLastName('Raza')
->setEmailAddress('hassan#xero.com');
$response = $contact->save();
dd($response->getResponseBody());

'TypeError: currentSubs[i] is not a function' when using ports in Elm 0.19

I am attempting to send data from Elm 0.19 to JavaScript using ports.
Edit: The problem seems to be related to running/building with elm-app
In Elm, I declare an outgoing port:
port modelToJs : Json.Encode.Value -> Cmd msg
which I use in the update function to produce a Cmd that sends a JSON encoded value to JavaScript.
In JS, I instantiate the Elm app:
const app = Elm.Main.init({
node: document.getElementById('root')
});
and register the data handler:
app.ports.modelToJs.subscribe(function dataHandler(data) {
console.log("got from Elm:" + data);
});
When modelToJs is called, the data is not sent and printed to the console. Instead, I get the following JavasScript runtime error (which Elm claims to avoid by design):
TypeError: currentSubs[i] is not a function
var value = _Json_unwrap(converter(cmdList.a));
2160 | for (var i = 0; i < currentSubs.length; i++)
2161 | {
> 2162 | currentSubs[i](value);
2163 | }
2164 | }
2165 | return init;
I have also provided a full proof of concept project on GitHub: https://github.com/mpgirro/elm0.19-ports-issue
The repo also contains an image of the error message (sry, I lack the reputation to post images)
The error appears to be in dataHandler.js. It currently contains this:
function dataHandler(data) {
console.log("got from Elm:" + data);
}
If you declare the function as export default the problem goes away:
export default function dataHandler(data) {
console.log("got from Elm:" + data);
}

Update video with YOUTUBE google-api-php-client

I'm trying update the video metadata with Youtube API. The API which I'm using is google-api-php-client.
That API works perfectly in upload and delete processes, but when I want update the video info I don't know what parameters I have to use.
This is the code:
try
{
// Build the Needed Video Information
$snippet = new Google_VideoSnippet();
$snippet->setTitle($_POST['videoTitle']);
$snippet->setDescription($_POST['videoDescription']);
$snippet->setTags(array($_POST['videoTags']));
$snippet->setCategoryId(22);
// Set the Video Info and Status in the Main Tag
$video = new Google_Video();
$video->setSnippet($snippet);
// Send the video to the Google Youtube API
$created_file = $youtube->videos->update('snippet', $video, array(
WHAT PARAMETERS!!!???!!
));
// Get the information of the uploaded video
print_r($createdFile);
}
catch (Exception $ex)
{
echo $ex;
}
Someone knows this? ? i'd like keep using this API because all my aplication use it.
Thank you in advanced.
To update a video, first you need to use videos->list with id=video_id, then update the part intended, wrap all subparts till to the video itself into google objects, and send an update request. (We will work to make this simpler)
Here's an update tags sample which ultimately updates the video, you can use it.
/**
* This sample adds new tags to a YouTube video by:
*
* 1. Retrieving the video with "youtube.videos.list" method setting the "id" parameter
* 2. Appending new tags to Video Resource's snippet.tags[] list
* 3. Updating the video itself via youtube.videos.update API call, supplying a new video via a
* binary upload to replace the old one.
*
* #author Ibrahim Ulukaya
*/
// Call set_include_path() as needed to point to your client library.
require_once 'Google_Client.php';
require_once 'contrib/Google_YouTubeService.php';
session_start();
/* You can acquire an OAuth 2 ID/secret pair from the API Access tab on the Google APIs Console
<http://code.google.com/apis/console#access>
For more information about using OAuth2 to access Google APIs, please visit:
<https://developers.google.com/accounts/docs/OAuth2>
Please ensure that you have enabled the YouTube Data API for your project. */
$OAUTH2_CLIENT_ID = 'REPLACE ME';
$OAUTH2_CLIENT_SECRET = 'REPLACE ME';
$client = new Google_Client();
$client->setClientId($OAUTH2_CLIENT_ID);
$client->setClientSecret($OAUTH2_CLIENT_SECRET);
$redirect = filter_var('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'],
FILTER_SANITIZE_URL);
$client->setRedirectUri($redirect);
// YouTube object used to make all Data API requests.
$youtube = new Google_YoutubeService($client);
if (isset($_GET['code'])) {
if (strval($_SESSION['state']) !== strval($_GET['state'])) {
die('The session state did not match.');
}
$client->authenticate();
$_SESSION['token'] = $client->getAccessToken();
header('Location: ' . $redirect);
}
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
}
// Check if access token successfully acquired
if ($client->getAccessToken()) {
try{
// REPLACE with the video ID that you want to update
$videoId = "VIDEO_ID";
// Create a video list request
$listResponse = $youtube->videos->listVideos("snippet",
array('id' => $videoId));
$videoList = $listResponse['items'];
if (empty($videoList)) {
$htmlBody .= sprintf('<h3>Can\'t find a video with video id: %s</h3>', $videoId);
} else {
// Since a unique video id is given, it will only return 1 video.
$video = $videoList[0];
$videoSnippet = $video['snippet'];
$tags = $videoSnippet['tags'];
// $tags is null if the video didn't have any tags, so we will check for this and
// create a new list if needed
if (is_null($tags)) {
$tags = array("tag1", "tag2");
} else {
array_push($tags, "tag1", "tag2");
}
// Construct the Google_Video with the updated tags, hence the snippet
$updateVideo = new Google_Video($video);
$updateSnippet = new Google_VideoSnippet($videoSnippet);
$updateSnippet->setTags($tags);
$updateVideo -> setSnippet($updateSnippet);
// Create a video update request
$updateResponse = $youtube->videos->update("snippet", $updateVideo);
$responseTags = $updateResponse['snippet']['tags'];
$htmlBody .= "<h3>Video Updated</h3><ul>";
$htmlBody .= sprintf('<li>Tags "%s" and "%s" added for video %s (%s) </li>',
array_pop($responseTags), array_pop($responseTags),
$videoId, $updateResponse['snippet']['title']);
$htmlBody .= '</ul>';
}
} catch (Google_ServiceException $e) {
$htmlBody .= sprintf('<p>A service error occurred: <code>%s</code></p>',
htmlspecialchars($e->getMessage()));
} catch (Google_Exception $e) {
$htmlBody .= sprintf('<p>An client error occurred: <code>%s</code></p>',
htmlspecialchars($e->getMessage()));
}
$_SESSION['token'] = $client->getAccessToken();
} else {
// If the user hasn't authorized the app, initiate the OAuth flow
$state = mt_rand();
$client->setState($state);
$_SESSION['state'] = $state;
$authUrl = $client->createAuthUrl();
$htmlBody = <<<END
<h3>Authorization Required</h3>
<p>You need to authorize access before proceeding.<p>
END;
}
?>
<!doctype html>
<html>
<head>
<title>Video Updated</title>
</head>
<body>
<?=$htmlBody?>
</body>
</html>

i am having a issue with json codeigniter rest its not closing the tag

i am having a problem with json codeigniter rest
i am making this call to the server and the problem its that its not closing the json tags
s, USA","clientUID":"7","email":null,"idipad":"2","dateModified":null},{"id":"19","uid":null,"name":"Wayne Corporation, Inc.","phone":"932345324","address":"Second st. 312, Gotham City","clientUID":"7","email":"waynecorp#gmail.com","idipad":"1","dateModified":null}]
its missing the final }
this is the code that creates the response :
$this->response(array('login'=>'login success!','user_admin_id'=>$user_id,'client'=>$client,'users'=>$users,'projects'=>$projects,'plans'=>$plans,'meetings'=>$meetings,'demands'=>$demands,'tasks'=>$tasks,'presences'=>$presences,'contractors'=>$contractors,'companies'=>$companies), 200);
this is the client call using curl :
$this->curl->create('http://dev.onplans.ch/onplans/index.php/api/example/login/format/json');
// Option & Options
$this->curl->option(CURLOPT_BUFFERSIZE, 10);
$this->curl->options(array(CURLOPT_BUFFERSIZE => 10));
// More human looking options
$this->curl->option('buffersize', 10);
// Login to HTTP user authentication
$this->curl->http_login('admin', '1234');
// Post - If you do not use post, it will just run a GET request
//$post = array('remember'=>'true','email'=>'admin.architect#onplans.ch','password'=>'password');
$post = array('remember'=>'true','email'=>'admin.architect#onplans.ch','password'=>'password');
$this->curl->post($post);
// Cookies - If you do not use post, it will just run a GET request
$vars = array('remember'=>'true','email'=>'manuel#ffff.com','password'=>'password');
$this->curl->set_cookies($vars);
// Proxy - Request the page through a proxy server
// Port is optional, defaults to 80
//$this->curl->proxy('http://example.com', 1080);
//$this->curl->proxy('http://example.com');
// Proxy login
//$this->curl->proxy_login('username', 'password');
// Execute - returns responce
echo $this->curl->execute();
// Debug data ------------------------------------------------
// Errors
$this->curl->error_code; // int
$this->curl->error_string;
print_r('error :::::LOGINN REMOTE:::::'.$this->curl->error_string);
// Information
$this->curl->info; // array
print_r('info :::::::::::::'.$this->curl->info);
the response belong to the rest api codeigniter from phil
/**
* Response
*
* Takes pure data and optionally a status code, then creates the response.
*
* #param array $data
* #param null|int $http_code
*/
public function response($data = array(), $http_code = null)
{
global $CFG;
// If data is empty and not code provide, error and bail
if (empty($data) && $http_code === null)
{
$http_code = 404;
// create the output variable here in the case of $this->response(array());
$output = NULL;
}
// If data is empty but http code provided, keep the output empty
else if (empty($data) && is_numeric($http_code))
{
$output = NULL;
}
// Otherwise (if no data but 200 provided) or some data, carry on camping!
else
{
// Is compression requested?
if ($CFG->item('compress_output') === TRUE && $this->_zlib_oc == FALSE)
{
if (extension_loaded('zlib'))
{
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) AND strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE)
{
ob_start('ob_gzhandler');
}
}
}
is_numeric($http_code) OR $http_code = 200;
// If the format method exists, call and return the output in that format
if (method_exists($this, '_format_'.$this->response->format))
{
// Set the correct format header
header('Content-Type: '.$this->_supported_formats[$this->response->format]);
$output = $this->{'_format_'.$this->response->format}($data);
}
// If the format method exists, call and return the output in that format
elseif (method_exists($this->format, 'to_'.$this->response->format))
{
// Set the correct format header
header('Content-Type: '.$this->_supported_formats[$this->response->format]);
$output = $this->format->factory($data)->{'to_'.$this->response->format}();
}
// Format not supported, output directly
else
{
$output = $data;
}
}
header('HTTP/1.1: ' . $http_code);
header('Status: ' . $http_code);
// If zlib.output_compression is enabled it will compress the output,
// but it will not modify the content-length header to compensate for
// the reduction, causing the browser to hang waiting for more data.
// We'll just skip content-length in those cases.
if ( ! $this->_zlib_oc && ! $CFG->item('compress_output'))
{
header('Content-Length: ' . strlen($output));
}
exit($output);
}
This answer was referenced from Github issue. Also raised by Pedro Dinis, i guest.
I met this problem today and take me long hours to search for the solution. I share here with hope to help someone like me.
The key is to replace around line 430 in the library file: REST_Controller.php :
header('Content-Length: ' . strlen($output));
by
header('Content-Length: ' . strlen("'".$output."'"));
UPDATE: The problem was solved here
Or you can just comment out the code, it will run fine. :)