adding more fields to the user registration process
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/84f06e99 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/84f06e99 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/84f06e99 Branch: refs/heads/master Commit: 84f06e9909ea41baa8ed14309cf2900fa1001241 Parents: 57ccfb3 Author: scnakandala <[email protected]> Authored: Tue Apr 12 15:37:07 2016 -0400 Committer: scnakandala <[email protected]> Committed: Tue Apr 12 15:37:07 2016 -0400 ---------------------------------------------------------------------- app/controllers/AccountController.php | 26 ++---- .../Stubs/UserInformationRecoveryManager.php | 65 ++++++++++++++- app/libraries/Wsis/Wsis.php | 4 +- app/views/account/create.blade.php | 84 ++++++++++---------- 4 files changed, 116 insertions(+), 63 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/84f06e99/app/controllers/AccountController.php ---------------------------------------------------------------------- diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 0ae5d00..8a95992 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -34,23 +34,13 @@ class AccountController extends BaseController $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 = ""; - + $organization = isset($_POST['organization']) ? $_POST['organization'] : null; + $address = isset($_POST['address']) ? $_POST['address'] : null; + $country = isset($_POST['country']) ? $_POST['country'] : null; + $telephone = isset($_POST['telephone']) ? $_POST['telephone'] : null; + $mobile = isset($_POST['mobile']) ? $_POST['mobile'] : null; + $im = isset($_POST['im']) ? $_POST['im'] : null; + $url = isset($_POST['url']) ? $_POST['url'] : null; if (WSIS::usernameExists($username)) { return Redirect::to("create") @@ -71,7 +61,7 @@ class AccountController extends BaseController // return View::make('account/login'); // } - WSIS::registerUserAccount($username, $password, $email, $first_name, $last_name, + WSIS::registerUserAccount($username, $password, $email, $first_name, $last_name, $organization, $address, $country, $telephone, $mobile, $im, $url, Config::get('pga_config.wsis')['tenant-domain']); /*add user to role - user_pending */ http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/84f06e99/app/libraries/Wsis/Stubs/UserInformationRecoveryManager.php ---------------------------------------------------------------------- diff --git a/app/libraries/Wsis/Stubs/UserInformationRecoveryManager.php b/app/libraries/Wsis/Stubs/UserInformationRecoveryManager.php index e62306c..2b971ae 100755 --- a/app/libraries/Wsis/Stubs/UserInformationRecoveryManager.php +++ b/app/libraries/Wsis/Stubs/UserInformationRecoveryManager.php @@ -107,7 +107,7 @@ class UserInformationRecoveryManager { * @param $tenantDomain * @return mixed */ - public function registerAccount($username, $password, $email,$firstName, $lastName, $tenantDomain){ + public function registerAccount($username, $password, $email,$firstName, $lastName, $organization, $address, $country, $telephone, $mobile, $im, $url, $tenantDomain){ $registerUser = new registerUser(); $registerUser->userName = $username; @@ -137,6 +137,69 @@ class UserInformationRecoveryManager { array_push($fieldValues, $lastNameDTO); $registerUser->claims = $fieldValues; + $lastNameDTO = new UserIdentityClaimDTO(); + $lastNameDTO->claimUri = "http://wso2.org/claims/lastname"; + $lastNameDTO->claimValue = $lastName; + array_push($fieldValues, $lastNameDTO); + $registerUser->claims = $fieldValues; + + //Todo Add other information too + if(!empty($organization)){ + $organizationDTO = new UserIdentityClaimDTO(); + $organizationDTO->claimUri = "http://wso2.org/claims/organization"; + $organizationDTO->claimValue = $organization; + array_push($fieldValues, $organizationDTO); + $registerUser->claims = $fieldValues; + } + + if(!empty($address)){ + $addressDTO = new UserIdentityClaimDTO(); + $addressDTO->claimUri = "http://wso2.org/claims/streetaddress"; + $addressDTO->claimValue = $address; + array_push($fieldValues, $addressDTO); + $registerUser->claims = $fieldValues; + } + + if(!empty($country)){ + $countryDTO = new UserIdentityClaimDTO(); + $countryDTO->claimUri = "http://wso2.org/claims/country"; + $countryDTO->claimValue = $countryDTO; + array_push($fieldValues, $countryDTO); + $registerUser->claims = $fieldValues; + } + + if(!empty($telephone)){ + $telephoneDTO = new UserIdentityClaimDTO(); + $telephoneDTO->claimUri = "http://wso2.org/claims/telephone"; + $telephoneDTO->claimValue = $telephone; + array_push($fieldValues, $telephoneDTO); + $registerUser->claims = $fieldValues; + } + + if(!empty($mobile)){ + $mobileDTO = new UserIdentityClaimDTO(); + $mobileDTO->claimUri = "http://wso2.org/claims/mobile"; + $mobileDTO->claimValue = $mobile; + array_push($fieldValues, $mobileDTO); + $registerUser->claims = $fieldValues; + } + + if(!empty($im)){ + $imDTO = new UserIdentityClaimDTO(); + $imDTO->claimUri = "http://wso2.org/claims/im"; + $imDTO->claimValue = $im; + array_push($fieldValues, $imDTO); + $registerUser->claims = $fieldValues; + } + + if(!empty($url)){ + $urlDTO = new UserIdentityClaimDTO(); + $urlDTO->claimUri = "http://wso2.org/claims/url"; + $urlDTO->claimValue = $url; + array_push($fieldValues, $urlDTO); + $registerUser->claims = $fieldValues; + } + $result = $this->serviceStub->registerUser($registerUser); return $result->return->verified; } http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/84f06e99/app/libraries/Wsis/Wsis.php ---------------------------------------------------------------------- diff --git a/app/libraries/Wsis/Wsis.php b/app/libraries/Wsis/Wsis.php index 1a69e91..bcf1353 100755 --- a/app/libraries/Wsis/Wsis.php +++ b/app/libraries/Wsis/Wsis.php @@ -435,10 +435,10 @@ class Wsis { * @param $lastName * @param $tenantDomain */ - public function registerUserAccount($username, $password, $email, $firstName, $lastName, $tenantDomain) + public function registerUserAccount($username, $password, $email, $firstName, $lastName, $organization, $address, $country, $telephone, $mobile, $im, $url, $tenantDomain) { $this->userInfoRecoveryManager->registerAccount($username, $password, $email, $firstName, - $lastName, $tenantDomain); + $lastName, $tenantDomain, $organization, $address, $country, $telephone, $mobile, $im, $url); } /** http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/84f06e99/app/views/account/create.blade.php ---------------------------------------------------------------------- diff --git a/app/views/account/create.blade.php b/app/views/account/create.blade.php index fe8def1..441935d 100644 --- a/app/views/account/create.blade.php +++ b/app/views/account/create.blade.php @@ -66,48 +66,48 @@ placeholder="Last Name" required="required" title="" type="text" value="{{Input::old('last_name') }}"/></div> </div> -<!-- <div class="form-group"><label class="control-label">Organization</label>--> -<!----> -<!-- <div><input class="form-control" id="organization" name="organization"--> -<!-- placeholder="Organization" title="" type="text" value="{{Input::old('organization') }}"/>--> -<!-- </div>--> -<!-- </div>--> -<!-- <div class="form-group"><label class="control-label">Address</label>--> -<!----> -<!-- <div><input class="form-control" id="address" name="address"--> -<!-- placeholder="Address" title="" type="text" value="{{Input::old('address') }}"/>--> -<!-- </div>--> -<!-- </div>--> -<!-- <div class="form-group"><label class="control-label">Country</label>--> -<!----> -<!-- <div><input class="form-control" id="country" name="country"--> -<!-- placeholder="Country" title="" type="text" value="{{Input::old('country') }}"/>--> -<!-- </div>--> -<!-- </div>--> -<!-- <div class="form-group"><label class="control-label">Telephone</label>--> -<!----> -<!-- <div><input class="form-control" id="telephone" name="telephone"--> -<!-- placeholder="Telephone" title="" type="tel" value="{{Input::old('telephone') }}"/>--> -<!-- </div>--> -<!-- </div>--> -<!-- <div class="form-group"><label class="control-label">Mobile</label>--> -<!----> -<!-- <div><input class="form-control" id="mobile" name="mobile"--> -<!-- placeholder="Mobile" title="" type="tel" value="{{Input::old('mobile') }}"/>--> -<!-- </div>--> -<!-- </div>--> -<!-- <div class="form-group"><label class="control-label">IM</label>--> -<!----> -<!-- <div><input class="form-control" id="im" name="im"--> -<!-- placeholder="IM" title="" type="text" value="{{Input::old('im') }}"/>--> -<!-- </div>--> -<!-- </div>--> -<!-- <div class="form-group"><label class="control-label">URL</label>--> -<!----> -<!-- <div><input class="form-control" id="url" name="url"--> -<!-- placeholder="URL" title="" type="text" value="{{Input::old('url') }}"/>--> -<!-- </div>--> -<!-- </div>--> + <div class="form-group"><label class="control-label">Organization</label> + + <div><input class="form-control" id="organization" name="organization" + placeholder="Organization" title="" type="text" value="{{Input::old('organization') }}"/> + </div> + </div> + <div class="form-group"><label class="control-label">Address</label> + + <div><input class="form-control" id="address" name="address" + placeholder="Address" title="" type="text" value="{{Input::old('address') }}"/> + </div> + </div> + <div class="form-group"><label class="control-label">Country</label> + + <div><input class="form-control" id="country" name="country" + placeholder="Country" title="" type="text" value="{{Input::old('country') }}"/> + </div> + </div> + <div class="form-group"><label class="control-label">Telephone</label> + + <div><input class="form-control" id="telephone" name="telephone" + placeholder="Telephone" title="" type="tel" value="{{Input::old('telephone') }}"/> + </div> + </div> + <div class="form-group"><label class="control-label">Mobile</label> + + <div><input class="form-control" id="mobile" name="mobile" + placeholder="Mobile" title="" type="tel" value="{{Input::old('mobile') }}"/> + </div> + </div> + <div class="form-group"><label class="control-label">IM</label> + + <div><input class="form-control" id="im" name="im" + placeholder="IM" title="" type="text" value="{{Input::old('im') }}"/> + </div> + </div> + <div class="form-group"><label class="control-label">URL</label> + + <div><input class="form-control" id="url" name="url" + placeholder="URL" title="" type="text" value="{{Input::old('url') }}"/> + </div> + </div> <br/> <input name="Submit" type="submit" class="btn btn-primary btn-block" value="Create"> </form>
