public function actionRegistration() { if (Yii::app()->user->id) { $this->redirect(array($this->module->profileUrl)); return; } $form = $this->createRegistrationForm(); $this->performAjaxValidation($form, 'RegistrationForm'); if ($this->request->isPostRequest) { if (!isset($_POST['RegistrationForm'])) { throw new CHttpException(403); } $form->attributes = $_POST['RegistrationForm']; if ($form->validate()) { $registration = new UserRegistration($form); $registration->onAfterRecordsCreated = array($this, 'afterRecordsCreated'); try { $registration->run(); Yii::app()->user->setFlash('success', "We have created account especially for you! Please check your mail, and confirm registration"); $this->redirect(array($this->module->loginUrl)); } catch (Exception $exc) { throw $exc; // Yii::app()->user->setFlash('error', "Sorry, but something went wrong during registration process. Try later or contact with administrator"); } } } $this->render($this->module->registrationView, array('model' => $form)); }
public function actionRegistration() { if (Yii::app()->user->id) { $this->redirect(array($this->module->profileUrl)); return; } $regForm = $this->createRegistrationForm(); $personIdent = new PersonIdentifier('userApply'); if (isset($_POST['PersonIdentifier']['type'])) { $personIdent->type = $_POST['PersonIdentifier']['type']; } else { $personIdent->type = Yii::app()->getModule('personIdentifier')->defaultIdentifierType; } // $this->performAjaxValidation($regForm, 'RegistrationForm'); // $this->performAjaxValidation($personIdent, 'PersonIdentifier'); if ($this->request->isPostRequest) { if (!isset($_POST['RegistrationForm'])) { throw new CHttpException(403); } $regForm->attributes = $_POST['RegistrationForm']; $personIdent->attributes = $_POST['PersonIdentifier']; $valid = $regForm->validate(); $valid = $personIdent->validate() && $valid; $this->personIdent = $personIdent; if ($valid) { $registration = new UserRegistration($regForm); $registration->onAfterRecordsCreated = array($this, 'afterRecordsCreated'); try { $registration->run(); Yii::app()->user->setFlash('success', "We have created account especially for you! Please check your mail, and confirm registration"); $this->redirect(array($this->module->loginUrl)); } catch (Exception $exc) { throw $exc; // Yii::app()->user->setFlash('error', "Sorry, but something went wrong during registration process. Try later or contact with administrator"); } } } $this->render($this->module->registrationView, array('model' => $regForm, 'personIdent' => $personIdent)); }
public function run() { $controller = $this->getController(); try { if (isset($_GET['activation_code'])) { $this->_activationcode = trim($_GET['activation_code']); $userArray = UserRegistration::model()->find(array('select' => '*', 'condition' => 'user_activation_code=:user_activation_code', 'params' => array(':user_activation_code' => $this->_activationcode))); $this->_userid = $userArray['uid']; if ($userArray['user_email_status'] == '0') { $userRedis = new UserRedis(); $userInfo = $userRedis->getUserinfo($this->_userid); $userRArray = json_decode($userInfo, TRUE); $userRArray['email_status'] = '1'; $userRedis->setUserinfo($this->_userid, json_encode($userRArray)); $emailverified = UserRegistration::model()->updateByPk($this->_userid, array('user_email_status' => '1')); if ($emailverified != '1') { $response_array = array('status' => 'failure', 'message' => 'Email Status Not Update Successfully.'); echo json_encode($response_array); exit; } } if ($userArray['user_pass'] == '') { echo $controller->renderPartial('/layouts/auth/_user_email_verify_form', array('set_password' => 'yes', 'userid' => $this->_userid), TRUE); } else { if (isset($_GET['forgot_password'])) { echo $controller->renderPartial('/layouts/auth/_user_email_verify_form', array('set_password' => 'yes', 'userid' => $this->_userid), TRUE); } else { echo $controller->renderPartial('/layouts/auth/_user_email_verify_form', array('userid' => $this->_userid), TRUE); } } } } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; exit; } }
function send_user_activation_email(&$xml_string, &$xslt_file) { UserRegistration::send_user_activation_email(); }
// if current user has no login then only show registration dialog if ($gValidLogin == false) { $getNewUser = 2; } // save form data in session for back navigation $_SESSION['profile_request'] = $_POST; if (!isset($_POST['usr_login_name'])) { $_POST['usr_login_name'] = ''; } if (!isset($_POST['reg_org_id'])) { $_POST['reg_org_id'] = $gCurrentOrganization->getValue('org_id'); } // read user data if ($getNewUser == 2 || $getNewUser == 3) { // create user registration object and set requested organization $user = new UserRegistration($gDb, $gProfileFields, $getUserId); $user->setOrganization($_POST['reg_org_id']); } else { $user = new User($gDb, $gProfileFields, $getUserId); } // pruefen, ob Modul aufgerufen werden darf switch ($getNewUser) { case 0: // prueft, ob der User die notwendigen Rechte hat, das entsprechende Profil zu aendern if ($gCurrentUser->hasRightEditProfile($user) == false) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } break; case 1: // prueft, ob der User die notwendigen Rechte hat, neue User anzulegen if ($gCurrentUser->editUsers() == false) {
<?php //error_reporting(E_ALL); include "include/config.php"; $regis = new UserRegistration(); $regis->action = $common->replaceEmpty('action', ''); switch ($regis->action) { case 'userregistration': $regis->Registration(); break; case 'editprofile': $regis->UpdateProfile(); break; case 'forgotpassword': $regis->ForgotPassword(); break; }
public function run() { $controller = $this->getController(); $model = new LoginForm(); $userredis = new UserRedis(); try { if (isset($_POST['UserLogin'])) { $model->attributes = $_POST['UserLogin']; if ($model->validate()) { $user = UserRegistration::model()->find('LOWER(user_email)=?', array(strtolower($model->user_email))); $userInfo = $userredis->getUserinfo(trim($user->uid)); $user_array = json_decode($userInfo, TRUE); Yii::app()->session->open(); Yii::app()->session['userid'] = $user->uid; Yii::app()->session['username'] = $user->user_name; Yii::app()->session['mobile'] = $user->user_mobile; Yii::app()->session['email'] = $user->user_email; if (isset($_POST['UserLogin']['form_name'])) { $state = 'mob_notchanged'; $this->seller_type = ''; $this->listingid = ''; $mobileno = ''; $mob_sta = ''; if ($_POST['UserLogin']['form_name'] == 'register_user') { $html = $controller->renderPartial('/layouts/auth/_user_logout_form', array(), TRUE); $html_ano = ""; } else { if ($_POST['UserLogin']['form_name'] == 'contact_user') { $html = $controller->renderPartial('/contactseller/_user_mobile_confirm_form', array('listingid' => $_POST['listingid']), TRUE); $html_ano = $controller->renderPartial('/layouts/auth/_user_logout_form', array(), TRUE); } else { if ($_POST['UserLogin']['form_name'] == 'mobile_change') { /*Yii::import('application.controllers.contact_seller.UpdateusermobileAction'); $mobileno_changed = 'mobile_changed'; $obj =new UpdateusermobileAction($_POST['userid'],$_POST['mobileno']); $result = $obj->run();*/ $userRedis = new UserRedis(); $userInfo = $userRedis->getUserinfo($_POST['userid']); $user_array = json_decode($userInfo, TRUE); $useridArray = UserRegistration::model()->findAll(array('select' => 'uid', 'condition' => 'user_mobile=:user_mobile', 'params' => array(':user_mobile' => $_POST['mobileno']))); $user_array['mobile_status'] = '1'; $user_array['mobile'] = $_POST['mobileno']; $userRedis->setUserinfo($_POST['userid'], json_encode($user_array)); UserRegistration::model()->updateByPk($_POST['userid'], array('user_mobile' => $_POST['mobileno'])); UserRegistration::model()->updateByPk($_POST['userid'], array('user_mobile_status' => '1')); if (!empty($useridArray)) { foreach ($useridArray as $key => $value) { if ($value['uid'] != '' && $_POST['userid'] != $value['uid']) { $userRinfo = $userRedis->getUserinfo($value['uid']); $userRarray = json_decode($userRinfo, TRUE); $userRarray['mobile_status'] = '0'; $userRedis->setUserinfo($value['uid'], json_encode($userRarray)); UserRegistration::model()->updateByPk($value['uid'], array('user_mobile_status' => '0')); } } } $html = $controller->renderPartial('/layouts/auth/_user_logout_form', array(), TRUE); $json_array = array('status' => 'sucess', 'html' => $html); echo json_encode($json_array); exit; } } } } if (isset($_POST['result_user_mobile'])) { $state = 'mob_changed'; $mob_sta = 'notverified'; if (isset($_POST['listingid'])) { $this->listingid = $_POST['listingid']; $this->currentDateTime = date('H:i'); $this->newDateTime = date('h:i A', strtotime($this->currentDateTime)); if ($this->currentDateTime >= Yii::app()->params['starttime'] && $this->currentDateTime <= Yii::app()->params['endtime']) { $this->seller_type = 'view'; } else { if ($userredis->getListingDetails($this->listingid, 'status')) { $this->seller_type = 'view'; } else { $this->seller_type = 'call'; } } } if ($_POST['result_user_mobile'] != $user->user_mobile) { $mobileno = $_POST['result_user_mobile']; $user_array['mobile'] = $mobileno; $sms_result = Yii::app()->sms->send_message($mobileno, $this->sms_type, $user->uid); $html = $controller->renderPartial('/contactseller/_otp_form', array('seller_type' => $this->seller_type, 'user_array' => $user_array), TRUE); $html_ano = $controller->renderPartial('/layouts/auth/_user_logout_form', array(), TRUE); } } $json_array = array('status' => 'sucess', 'state' => $state, 'message' => 'User Details Verified Sucessfully', 'html' => $html, 'html_ano' => $html_ano, 'listingid' => $this->listingid, 'userid' => $user->uid, 'mobile_number' => $mobileno, 'mob_sta' => $mob_sta, 'url' => $controller->createUrl('contactseller/mobilenumberverification')); echo json_encode($json_array); } else { $_error = $model->getErrors(); $_error['status'] = 'error'; echo json_encode($_error); } } } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; exit; } }
require_once '../../system/common.php'; require_once '../../system/login_valid.php'; // Initialize and check the parameters $getMode = admFuncVariableIsValid($_GET, 'mode', 'numeric', array('requireValue' => true)); $getNewUserId = admFuncVariableIsValid($_GET, 'new_user_id', 'numeric', array('requireValue' => true)); $getUserId = admFuncVariableIsValid($_GET, 'user_id', 'numeric'); // nur Webmaster duerfen User bestaetigen, ansonsten Seite verlassen if ($gCurrentUser->approveUsers() == false) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } // pruefen, ob Modul aufgerufen werden darf if ($gPreferences['registration_mode'] == 0) { $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } // create user objects $registrationUser = new UserRegistration($gDb, $gProfileFields, $getNewUserId); if ($getUserId > 0) { $user = new User($gDb, $gProfileFields, $getUserId); } if ($getMode == 1 || $getMode == 2) { // User-Account einem existierenden Mitglied zuordnen // Daten kopieren, aber nur, wenn noch keine Logindaten existieren if (strlen($user->getValue('usr_login_name')) == 0 && strlen($user->getValue('usr_password')) == 0) { $user->setValue('EMAIL', $registrationUser->getValue('EMAIL')); $user->setValue('usr_login_name', $registrationUser->getValue('usr_login_name')); $user->setValue('usr_password', $registrationUser->getValue('usr_password')); } try { // zuerst den neuen Usersatz loeschen, dann den alten Updaten, // damit kein Duplicate-Key wegen dem Loginnamen entsteht $registrationUser->notSendEmail();
public function run() { try { $controller = $this->getController(); $userRedis = new UserRedis(); if (isset($_POST['listingid'])) { $this->listingid = $_POST['listingid']; $this->currentDateTime = date('H:i'); $this->newDateTime = date('h:i A', strtotime($this->currentDateTime)); if ($this->currentDateTime >= Yii::app()->params['starttime'] || $this->currentDateTime <= Yii::app()->params['endtime']) { $this->seller_type = 'view'; } else { if ($userRedis->getListingDetails($this->listingid, 'status')) { $this->seller_type = 'view'; } else { $this->seller_type = 'call'; } } $listingInfo = $userRedis->getListingDetails($this->listingid, 'sellerinfo'); $listing_array = json_decode($listingInfo, TRUE); } if (isset($_POST['userid'])) { $userInfo = $userRedis->getUserinfo(trim($_POST['userid'])); $user_array = json_decode($userInfo, TRUE); $userid = $user_array['uid']; if (isset($_POST['mobileno'])) { if ($_POST['mobileno'] != $user_array['mobile']) { $mobileno = $_POST['mobileno']; } else { $mobileno = $user_array['mobile']; } } if ($mobileno != '') { $user_deatail = array('userid' => $user_array['uid'], 'user_email' => $user_array['email_id'], 'user_mobile' => $mobileno, 'user_username' => $user_array['user_name']); if (isset($_POST['otp_number'])) { $_otpValue = $userRedis->getOtpinfo($userid, $mobileno); if (isset($_otpValue) && $_otpValue != '') { if ($_POST['otp_number'] == $_otpValue) { if (isset($_POST['user_registration'])) { $html = $controller->renderPartial('/layouts/auth/_mobile_verified_form', array(), TRUE); } if ($this->seller_type == 'call') { $html = $controller->renderPartial('_connect_seller_form', $user_deatail, TRUE); } else { if ($this->seller_type == 'view') { if (isset(Yii::app()->request->cookies['cookie_id'])) { $cookieid = Yii::app()->request->cookies['cookie_id']; $userRedis->setUserContacted($cookieid, $this->listingid); } $html = $controller->renderPartial('_view_contact_details_form', array('listing_array' => $listing_array, 'user' => $user_array, 'mobileno' => $mobileno), TRUE); } } if ($_POST['mobileno'] == $user_array['mobile']) { Yii::app()->session->open(); Yii::app()->session['userid'] = $user_array['uid']; Yii::app()->session['username'] = $user_array['user_name']; Yii::app()->session['mobile'] = $user_array['mobile']; Yii::app()->session['email'] = $user_array['email_id']; $useridArray = UserRegistration::model()->findAll(array('select' => 'uid', 'condition' => 'user_mobile=:user_mobile', 'params' => array(':user_mobile' => $mobileno))); $user_array['mobile_status'] = '1'; $userRedis->setUserinfo($userid, json_encode($user_array)); $updatemobilestatus = UserRegistration::model()->updateByPk($userid, array('user_mobile_status' => '1')); if (!empty($useridArray)) { foreach ($useridArray as $key => $value) { if ($value['uid'] != '' && $userid != $value['uid']) { $userRinfo = $userRedis->getUserinfo($value['uid']); $userRarray = json_decode($userRinfo, TRUE); $userRarray['mobile_status'] = '0'; $userRedis->setUserinfo($value['uid'], json_encode($userRarray)); UserRegistration::model()->updateByPk($value['uid'], array('user_mobile_status' => '0')); } } } $html_ano = $controller->renderPartial('/layouts/auth/_user_logout_form', array(), TRUE); $state = "loggedin"; } else { $html_ano = ""; $state = "notloggedin"; } $json_array = array('status' => 'sucess', 'state' => $state, 'html' => $html, 'html_ano' => $html_ano, 'url' => $controller->createUrl('contactseller/call'), 'userid' => $userid, 'listingid' => $this->listingid, 'seller_type' => $this->seller_type, 'mobile_number' => $mobileno, 'message' => Yii::t('app', 'site_otpverified')); echo json_encode($json_array); } else { $json_array = array('status' => 'failure', 'message' => Yii::t('app', 'site_wrongotp')); echo json_encode($json_array); } } else { $json_array = array('status' => 'failure', 'message' => Yii::t('app', 'site_validotp')); echo json_encode($json_array); } } else { $_misscallvalue = $userRedis->getMissedcallverification($mobileno); if ($_misscallvalue != '' && $_misscallvalue == '1') { if (isset($_POST['user_registration'])) { $html = $controller->renderPartial('/layouts/auth/_mobile_verified_form', array(), TRUE); } if ($this->seller_type == 'call') { $html = $controller->renderPartial('_connect_seller_form', $user_deatail, TRUE); } else { if ($this->seller_type == 'view') { if (isset(Yii::app()->request->cookies['cookie_id'])) { $cookieid = Yii::app()->request->cookies['cookie_id']; $userRedis->setUserContacted($cookieid, $this->listingid); } $html = $controller->renderPartial('_view_contact_details_form', array('listing_array' => $listing_array, 'user' => $user_array, 'mobileno' => $mobileno), TRUE); } } if ($_POST['mobileno'] == $user_array['mobile']) { Yii::app()->session->open(); Yii::app()->session['userid'] = $user_array['uid']; Yii::app()->session['username'] = $user_array['user_name']; Yii::app()->session['mobile'] = $user_array['mobile']; Yii::app()->session['email'] = $user_array['email_id']; $user_array['mobile_status'] = '1'; $userRedis->setUserinfo($userid, json_encode($user_array)); $updatemobilestatus = UserRegistration::model()->updateByPk($userid, array('user_mobile_status' => '1')); if (!empty($useridArray)) { foreach ($useridArray as $key => $value) { if ($value['uid'] != '' && $userid != $value['uid']) { $userRinfo = $userRedis->getUserinfo($value['uid']); $userRarray = json_decode($userRinfo, TRUE); $userRarray['mobile_status'] = '0'; $userRedis->setUserinfo($value['uid'], json_encode($userRarray)); UserRegistration::model()->updateByPk($value['uid'], array('user_mobile_status' => '0')); } } } $html_ano = $controller->renderPartial('/layouts/auth/_user_logout_form', array(), TRUE); $state = "loggedin"; } else { $html_ano = ""; $state = "notloggedin"; } $json_array = array('status' => 'sucess', 'state' => $state, 'html' => $html, 'html_ano' => $html_ano, 'message' => Yii::t('app', 'site_missedcallverification'), 'userid' => $userid, 'listingid' => $this->listingid, 'seller_type' => $this->seller_type, 'mobile_number' => $mobileno, 'url' => $controller->createUrl('contactseller/call')); echo json_encode($json_array); } else { if ($_misscallvalue == '') { $json_array = array('status' => 'failure', 'message' => Yii::t('app', 'site_missedcallnotverified')); echo json_encode($json_array); } } } } } } catch (Exception $e) { Yii::app()->session->destroy(); echo 'Caught exception: ', $e->getMessage(), "\n"; exit; } }
function register_user() { //validation //user name $subject = trim($_REQUEST['pi7epi0ron0']); //user id $pattern = '/^[ \\.A-Za-z0-9_!@\\-#$^&*()?]*$/'; $matched = preg_match($pattern, $subject); if (!$matched) { $_SESSION["process_result"] = "Invalid user name. Please try again."; return; } //password $subject = trim($_REQUEST['pi8epi0ron0']); //password $allowedchars = "[ A-Za-z0-9_!@\\*\\(\\)\\?]"; //$allowedchars = "[ a-z]"; $required1 = "[\\d]"; $required2 = "[A-Za-z]"; $required = "(?:{$allowedchars}*{$required1})(?:{$allowedchars}*{$required2})|(?:{$allowedchars}*{$required2})(?:{$allowedchars}*{$required1})"; $pattern = "/^{$allowedchars}*{$required}{$allowedchars}*\$/"; //$pattern = "/^$allowedchars*(?:$allowedchars{6,30})(?:$allowedchars*$required1)$allowedchars*$/"; //$pattern = "/^[ a-z]*(?:[ a-z]*)(?:[ a-z]*[\d])[ a-z]*$/"; //echo "subject=$subject<br>".$pattern."<br>"; $matched = preg_match($pattern, $subject); if (!$matched or strlen($subject) < 6 or strlen($subject) > 30) { $_SESSION["process_result"] = "Invalid password. Please try again. Use both letter(s) and number(s). Minimum 6 characters. The following special characters are also allowed: _!@*()?"; return; } else { $_REQUEST['pi8epi0ron0'] = md5($subject); } //end password validation and md5 $account_no = $_REQUEST['acctno']; $eids = EntityManagementSystems::get_eids($account_no, EntDict::get_prop_id("accountno"), EntDict::get_type_id("user")); if (count($eids) == 1) { $eid = $eids[0]; //assumes only 1 matching user in the database $_REQUEST['eid'] = $eid; $_REQUEST['type_id'] = 3; $rec_xml = SecurityOperations_RecordSys::get_record_xml(); $xml = new SimpleXMLElement($rec_xml); $passelem = $xml->xpath('/record/property[@prop_id=8]'); $passffi = $passelem[0]['ffi']; $useridelem = $xml->xpath('/record/property[@prop_id=7]'); $useridffi = $useridelem[0]['ffi']; $regidelem = $xml->xpath('/record/property[@prop_id=34]'); $regidffi = $regidelem[0]['ffi']; $registered = UserRegistration::is_registered($eid); if ($registered) { $_SESSION["process_result"] = "Error. Account already registered"; } else { $_REQUEST['rec_eid'] = $eid; $_REQUEST['rec_type_id'] = 3; $_POST["{$useridffi}"] = $_REQUEST['pi7epi0ron0']; $_POST["{$passffi}"] = $_REQUEST['pi8epi0ron0']; $_POST["{$regidffi}"] = 1; SecurityOperations_RecordSys::update_user(); //$_SESSION["process_result"] = "passed:".$eid." - pi7epi0ron0=" . $_REQUEST['pi7epi0ron0']." - pi8epi0ron0=" . $_REQUEST['pi8epi0ron0']; $_SESSION["process_result"] = "Thank you for registering. When you have received confirmation by email from New England Trade, you may then log in."; //." - passffi: ".$passffi." , useridffi: ".$useridffi." - pi7epi0ron0=" . $_POST["$useridffi"]." - pi8epi0ron0=" . $_POST["$passffi"]; } } else { $eids = EntityManagementSystems::get_eids($_REQUEST['pi7epi0ron0'], EntDict::get_prop_id("userid"), EntDict::get_type_id("user")); if (count($eids) > 0) { $_SESSION["process_result"] = "User account already in use. Please choose another."; return; } $_REQUEST['eid'] = 0; $_REQUEST['type_id'] = 3; $_REQUEST['pi34epi0ron0'] = 1; $_REQUEST['pi25epi0ron0'] = -1; //user auth level $_REQUEST['pi33epi0ron0'] = $account_no; SecurityOperations_RecordSys::update_user(); $new_user_eid = $_REQUEST['eid']; //this global variable gets set in Glue $app_entities = AppEntities_Facade::getAppEntitiesInstance(); $email_info = AppEntities_Facade::get_email_info($app_entities->user_registration_email_to_approver); $email_info["email_message"] = str_replace("[eid]", $new_user_eid, $email_info["email_message"]); NotificationSys::email_to_defined_email_address("registration_approver_email", $email_info["email_subject"], $email_info["email_message"]); //$_SESSION["process_result"] = "passed:".$eid." - pi7epi0ron0=" . $_REQUEST['pi7epi0ron0']." - pi8epi0ron0=" . $_REQUEST['pi8epi0ron0']; $_SESSION["process_result"] = "Thank you for registering. When you have received confirmation by email from New England Trade, you may then log in."; //." - passffi: ".$passffi." , useridffi: ".$useridffi." - pi7epi0ron0=" . $_POST["$useridffi"]." - pi8epi0ron0=" . $_POST["$passffi"]; //$_SESSION["process_result"] = "Error. Account doesn't exist"; } }