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']; $username = $_POST['username']; $password = $_POST['password']; $confirm_password = $_POST['confirm_password']; $email = $_POST['email']; $organization = $_POST['organization']; $address = $_POST['address']; $country = $_POST['country']; $telephone = $_POST['telephone']; $mobile = $_POST['mobile']; $im = $_POST['im']; $url = $_POST['url']; if (WSIS::usernameExists($username)) { 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); CommonUtilities::print_success_message('New user created!'); return View::make('account/login'); } }
public function createAccountSubmit() { $rules = array("username" => "required|min:6", "password" => "required|min:6|max:48|regex:/^.*(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[@!\$#%*]).*\$/", "confirm_password" => "required|same:password", "email" => "required|email"); $messages = array('password.regex' => 'Password needs to contain at least (a) One lower case letter (b) One Upper case letter and (c) One number (d) One of the following special characters - !@#$%&*'); $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { return Redirect::to("create")->withInput(Input::except('password', 'password_confirm'))->withErrors($validator); } $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $username = $_POST['username']; $password = $_POST['password']; $email = $_POST['email']; // Fixme - Save these user information // $organization = $_POST['organization']; // $address = $_POST['address']; // $country = $_POST['country']; // $telephone = $_POST['telephone']; // $mobile = $_POST['mobile']; // $im = $_POST['im']; // $url = $_POST['url']; $organization = ""; $address = ""; $country = ""; $telephone = ""; $mobile = ""; $im = ""; $url = ""; if (WSIS::usernameExists($username)) { return Redirect::to("create")->withInput(Input::except('password', 'password_confirm'))->with("username_exists", true); } else { // We are using account confirmation now // WSIS::addUser($username, $password); // // //update user profile // WSIS::updateUserProfile($username, $email, $first_name, $last_name); // // CommonUtilities::print_success_message('New user created!'); // // if(Config::get('pga_config.wsis')['auth-mode']=="oauth"){ // return View::make('home'); // }else{ // return View::make('account/login'); // } WSIS::registerUserAccount($username, $password, $email, $first_name, $last_name, Config::get('pga_config.wsis')['tenant-domain']); /*add user to role - user_pending */ $allRoles = WSIS::getAllRoles(); if (!in_array("user_pending", $allRoles)) { WSIS::addRole("user_pending"); } //$userRoles = (array)WSIS::getUserRoles( $username); $userRoles["new"] = "user_pending"; $userRoles["deleted"] = array(); WSIS::updateUserRoles($username, $userRoles); CommonUtilities::print_success_message('Account confirmation request was sent to your email account'); return View::make('home'); } }
public function addGatewayAdminSubmit() { //check if username exists if (WSIS::usernameExists(Input::get("username"))) { WSIS::updateUserRoles(Input::get("username"), array("new" => array(Config::get('wsis::admin-role-name')), "deleted" => array())); return Redirect::to("admin/dashboard/users?role=" . Config::get('wsis::admin-role-name'))->with("Gateway Admin has been added."); } else { echo "username doesn't exist only."; exit; } }