Skip to content
Permalink
Browse files
Cleaning and restructuring PGA
  • Loading branch information
scnakandala committed Jun 4, 2015
1 parent 71890a7 commit 2fbd92892f9e4460dcaa65c72981a7b1017da832
Show file tree
Hide file tree
Showing 67 changed files with 7,599 additions and 7,927 deletions.
@@ -91,6 +91,11 @@
*/
'server-allowed-file-size' => 64,

/**
* directory in the web server where experiment data is staged. This path should be a relative path from app root
*/
'experiment-data-root' => '/../experimentData/',

/**
* Advanced experiments options
*/
@@ -1,29 +1,30 @@
<?php

class AccountController extends BaseController {

public function createAccountView()
{
return View::make('account/create');
}

public function createAccountSubmit()
{
$rules = array(
"username" => "required|min:6",
"password" => "required|min:6",
"confirm_password" => "required|same:password",
"email" => "required",
);

$validator = Validator::make( Input::all(), $rules);
if( $validator->fails()){
$messages = $validator->messages();

return Redirect::to("create")
->withInput(Input::except('password', 'password_confirm'))
->withErrors( $validator);
}
class AccountController extends BaseController
{

public function createAccountView()
{
return View::make('account/create');
}

public function createAccountSubmit()
{
$rules = array(
"username" => "required|min:6",
"password" => "required|min:6",
"confirm_password" => "required|same:password",
"email" => "required",
);

$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
$messages = $validator->messages();

return Redirect::to("create")
->withInput(Input::except('password', 'password_confirm'))
->withErrors($validator);
}

$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
@@ -40,60 +41,62 @@ public function createAccountSubmit()
$url = $_POST['url'];

if (WSIS::usernameExists($username)) {
return Redirect::to("create")
->withInput(Input::except('password', 'password_confirm'))
->with("username_exists", true);
}
else{
return Redirect::to("create")
->withInput(Input::except('password', 'password_confirm'))
->with("username_exists", true);
} else {
WSIS::addUser($username, $password, $first_name, $last_name, $email, $organization,
$address, $country,$telephone, $mobile, $im, $url);
Utilities::print_success_message('New user created!');
$address, $country, $telephone, $mobile, $im, $url);
CommonUtilities::print_success_message('New user created!');

return View::make('home');
}
}
}
}

public function loginView(){
return View::make('account/login');
}
public function loginView()
{
return View::make('account/login');
}

public function loginSubmit(){
public function loginSubmit()
{

if ( Utilities::form_submitted() ) {
if (CommonUtilities::form_submitted()) {
$username = $_POST['username'];
$password = $_POST['password'];
try {
if (WSIS::authenticate($username, $password)) {
if( in_array(Config::get('pga_config.wsis')['admin-role-name'], (array)WSIS::getUserRoles($username)))
{
if (in_array(Config::get('pga_config.wsis')['admin-role-name'], (array)WSIS::getUserRoles($username))) {
Session::put("admin", true);
}

Utilities::store_id_in_session($username);
Utilities::print_success_message('Login successful! You will be redirected to your home page shortly.');
Session::put("gateway_id", Config::get('pga_config.wsis')['gateway-id']);
//TODO::If this option is not safe, have to find a better method to send credentials to identity server on every connection.
Session::put("password", $_POST["password"]);
return Redirect::to( "home");
CommonUtilities::store_id_in_session($username);
CommonUtilities::print_success_message('Login successful! You will be redirected to your home page shortly.');
Session::put("gateway_id", Config::get('pga_config.wsis')['gateway-id']);
//TODO::If this option is not safe, have to find a better method to send credentials to identity server on every connection.
Session::put("password", $_POST["password"]);

return Redirect::to("home");

} else {
return Redirect::to("login")->with("invalid-credentials", true);
return Redirect::to("login")->with("invalid-credentials", true);
}
} catch (Exception $ex) {
return Redirect::to("login")->with("invalid-credentials", true);
return Redirect::to("login")->with("invalid-credentials", true);
}
}

}
}

public function forgotPassword()
{
return View::make("account/forgot-password");
}

public function forgotPassword(){
return View::make("account/forgot-password");
}
public function logout()
{
Session::flush();
return Redirect::to('home');
}

public function logout(){
Session::flush();
return Redirect::to('home');
}

}

0 comments on commit 2fbd928

Please sign in to comment.