本文整理汇总了PHP中sfGuardUser::setFirstName方法的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardUser::setFirstName方法的具体用法?PHP sfGuardUser::setFirstName怎么用?PHP sfGuardUser::setFirstName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfGuardUser
的用法示例。
在下文中一共展示了sfGuardUser::setFirstName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerUser
private function registerUser($username, $data = NULL)
{
try {
$gingerKey = sfConfig::get('app_portail_ginger_key');
if ($gingerKey != "abc") {
$ginger = new \Ginger\Client\GingerClient(sfConfig::get('app_portail_ginger_key'));
$cotisants = $ginger->getUser($username);
} else {
$cotisants = new stdClass();
$cotisants->mail = $username . "@etu.utc.fr";
$cotisants->prenom = "Le";
$cotisants->nom = "Testeur";
$cotisants->type = "etu";
}
if (!$data) {
$data = new sfGuardUser();
}
$data->setUsername($username);
$data->setEmailAddress($cotisants->mail);
$data->setFirstName($cotisants->prenom);
$data->setLastName($cotisants->nom);
$data->setIsActive(true);
$data->save();
$profile = new Profile();
$profile->setUser($data);
$profile->setDomain($cotisants->type);
$profile->save();
return $data;
} catch (\Ginger\Client\ApiException $ex) {
$this->setFlash('error', "Il n'a pas été possible de vous identifier. Merci de contacter simde@assos.utc.fr en précisant votre login et le code d'erreur " . $ex->getCode() . ".");
}
return false;
}
示例2: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$user = new sfGuardUser();
$user->setEmailAddress($arguments['email_address']);
$user->setUsername($arguments['username']);
$user->setPassword($arguments['password']);
$user->setFirstName($arguments['first_name']);
$user->setLastName($arguments['last_name']);
$user->setIsActive(true);
$user->setIsSuperAdmin($options['is-super-admin']);
$user->save();
$this->logSection('guard', sprintf('Create user "%s"', $arguments['username']));
}
示例3: createUser
public function createUser(array $guard_tab, $ei_user_tab)
{
$new_guard = new sfGuardUser();
$new_guard->setId($guard_tab['id']);
$new_guard->setUsername($guard_tab['username']);
$new_guard->setFirstName($guard_tab['first_name']);
$new_guard->setLastName($guard_tab['last_name']);
$new_guard->setEmailAddress($guard_tab['email_address']);
$new_guard->setPassword($guard_tab['password']);
$new_guard->save();
/* Création du EiUser */
EiUserTable::createUser($ei_user_tab, $new_guard->getId());
return $new_guard;
}
示例4: updateOrCreateUser
/**
* Updates or creates a sfGuardUser for the logged in Facebook usser
*
* @param array $me
* @return sfGuardUser
*/
public static function updateOrCreateUser(array $me) {
// Try by Facebook ID
$sfGuardUser = Doctrine_Core::getTable('sfGuardUser')->findOneByFacebookId($me['id']);
if (!$sfGuardUser) {
// Try by email address
$sfGuardUser = Doctrine_Core::getTable('sfGuardUser')->findOneByEmailAddress($me['email']);
if (!$sfGuardUser) {
$sfGuardUser = new sfGuardUser();
$sfGuardUser->setUsername('Facebook_' . $me['id']);
}
}
$sfGuardUser->setFacebookId($me['id']);
$sfGuardUser->setFacebookLink($me['link']);
$sfGuardUser->setFirstName($me['first_name']);
$sfGuardUser->setLastName($me['last_name']);
if (array_key_exists('verified', $me)) {
$sfGuardUser->setFacebookVerified($me['verified']);
}
if (array_key_exists('location', $me)) {
$sfGuardUser->setLocation($me['location']['name']);
$sfGuardUser->setFacebookLocationId($me['location']['id']);
}
if (array_key_exists('hometown', $me)) {
$sfGuardUser->setHometown($me['hometown']['name']);
$sfGuardUser->setFacebookHometownId($me['hometown']['id']);
}
$sfGuardUser->setGender($me['gender']);
$sfGuardUser->setLocale($me['locale']);
$sfGuardUser->setTimezone($me['timezone']);
if (array_key_exists('email', $me)) {
$sfGuardUser->setEmailAddress($me['email']);
}
$sfGuardUser->save();
return $sfGuardUser;
}
开发者ID:rosbif-fr,项目名称:kdDoctrineGuardFacebookConnectPlugin,代码行数:43,代码来源:kdDoctrineGuardFacebookConnect.class.php
示例5: processForm
protected function processForm(sfWebRequest $request, sfForm $form)
{
$form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
if ($form->isValid()) {
$peticion = $form->save();
$newUser = new sfGuardUser();
$newUser->setUsername($form->getObject()->getUsername());
$newUser->setFirstName($form->getObject()->getFirstName());
$newUser->setLastName($form->getObject()->getLastName());
$newUser->setSexo($form->getObject()->getSexo());
$newUser->setDireccion($form->getObject()->getDireccion());
$newUser->setTelefono($form->getObject()->getTelefono());
$newUser->setTelefonoMovil($form->getObject()->getTelefonoMovil());
$newUser->setEmailAddress($form->getObject()->getEmailAddress());
$newUser->setPassword($form->getObject()->getPassword());
try {
$newUser->save();
$peticion->delete();
$this->redirect('sfGuardUser/editagregar?id=' . $newUser->getId());
} catch (Exception $e) {
$this->redirect('peticion/edit?id=' . $peticion->getId());
}
}
}
示例6: executeFacebookLogin
/**
* Accepts proof of identity from the client side Facebook SDK.
* https://developers.facebook.com/docs/howtos/login/signed-request/#step2
* This will not work if your site doesn't have a proper
* domain name (it will not work in dev, in most cases).
*/
public function executeFacebookLogin(sfWebRequest $request)
{
$fb = sfConfig::get('app_sfApplyPlugin_facebook');
$secret = isset($fb['secret']) ? $fb['secret'] : null;
if (!$secret) {
throw new sfException('app_sfApplyPlugin_facebook not configured, secret missing');
}
$signed_request = $request->getParameter('signed_request');
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
// decode the data
$sig = $this->base64UrlDecode($encoded_sig);
$data = json_decode($this->base64UrlDecode($payload), true);
// Contrary to FB docs we're not done yet, we have to
// trade the 'code' in for an access token and then we
// can query for information about the user
$code = $data['code'];
$url = "https://graph.facebook.com/oauth/access_token?" . http_build_query(array('client_id' => $fb['id'], 'redirect_uri' => '', 'client_secret' => $secret, 'code' => $code));
$accessToken = file_get_contents($url);
parse_str($accessToken, $result);
$accessToken = $result['access_token'];
$me = json_decode(file_get_contents("https://graph.facebook.com/me?" . http_build_query(array('access_token' => $accessToken))), true);
if (!isset($me['email'])) {
$this->forward404();
}
$email = $me['email'];
$first_name = $me['first_name'];
$last_name = $me['last_name'];
$username = 'fb_' . (isset($me['username']) ? $me['username'] : $me['id']);
if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
$this->forward404();
}
// Adding the verification of the signed_request below
$expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
if ($sig !== $expected_sig) {
$this->forward404();
}
$user = Doctrine::getTable('sfGuardUser')->findOneByEmailAddress($email);
if (!$user) {
$user = new sfGuardUser();
$user->setIsActive(true);
$user->setPassword(aGuid::generate());
$user->setEmailAddress($email);
$user->setUsername($username);
}
$user->setFirstName($firstName);
$user->setLastName($lastName);
$user->setEmailAddress($email);
$user->save();
$this->getUser()->signIn($user);
return $this->renderText('OK');
}
示例7: executeIdentification
public function executeIdentification(sfWebRequest $request)
{
if (!$this->getUser()->isAuthenticated()) {
$this->formInscription = new InscriptionForm();
$class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin');
$this->form = new $class();
if ($request->ismethod('post')) {
if ($request->getParameter('send') == "signin") {
$this->form->bind($request->getParameter('signin'));
if ($this->form->isValid()) {
$values = $this->form->getValues();
$this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false);
if ($this->getUser()->getAttribute('montantLocation')) {
$paypal = new PayPal();
$ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
print_r($ret);
} else {
$this->redirect('espace_membre_profil');
}
}
} else {
if ($request->getParameter('send') == "signup") {
$this->formInscription->bind($request->getParameter('signup'));
if ($this->formInscription->isValid()) {
$values = $this->formInscription->getValues();
//print_r($values);
//exit;
$user = new sfGuardUser();
$user->setEmailAddress($values['email_address']);
$user->setUsername($values['email_address']);
$user->setLastName($values['nom']);
$user->setFirstName($values['prenom']);
$user->setPassword($values['password1']);
$user->setIsActive(1);
$user->getProfile()->setAdresse($values['adresse']);
$user->getProfile()->setCodepostal($values['codepostal']);
$user->getProfile()->setVille($values['ville']);
$user->getProfile()->setFixe($values['fixe']);
$user->getProfile()->setMobile($values['mobile']);
$user->getProfile()->setDateNaissance($values['date_naissance']);
$user->getProfile()->setNumeroPermis($values['numero_permis']);
$user->getProfile()->setVilleDelivrance($values['ville_permis']);
$user->getProfile()->setPaysDelivrance($values['pays_permis']);
$user->getProfile()->setDateDelivrance($values['date_delivrance_permis']);
$user->getProfile()->setIsActivated(1);
$user->addGroupByName("client");
$user->save();
$this->getUser()->setAttribute('email_address', $values['email_address']);
$message = $this->getMailer()->compose(sfConfig::get('app_mail_saidi'), $values['email_address'], '[Mobilyrent] - Inscription Mobilyrent location de voiture', '[Mobilyrent] - Inscription Mobilyrent location de voiture');
$this->getMailer()->send($message);
//echo $this->getUser()->getAttribute('montantLocation');exit;
if ($this->getUser()->getAttribute('montantLocation')) {
$paypal = new PayPal();
$ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
print_r($ret);
}
//$this->getUser()->setFlash('notice', sprintf('Inscription terminée.<br/>Un email vous a été envoyé. Connectez vous et continuer votre reservation.'));
}
}
}
}
} else {
$paypal = new PayPal();
$ret = $paypal->doExpressCheckout($this->getUser()->getAttribute('montantLocation'), 'Location de la voiture');
print_r($ret);
}
}
示例8: mergeFacebookInfo
/**
* Merge a users data with that from Facebook, updating fields where
* appropriate
*
* @param array $facebookUserInfo
* @param sfGuardUser $user
* @return self
*/
public function mergeFacebookInfo(array $facebookUserInfo, sfGuardUser $user)
{
if (!$this->getUserSetName()) {
if (isset($facebookUserInfo['name']) && $this->getFullName() != $facebookUserInfo['name']) {
$this->setFullName($facebookUserInfo['name']);
}
if (isset($facebookUserInfo['first_name']) && $user->getFirstName() != $facebookUserInfo['first_name']) {
$user->setFirstName($facebookUserInfo['first_name']);
}
if (isset($facebookUserInfo['last_name']) && $user->getLastName() != $facebookUserInfo['last_name']) {
$user->setLastName($facebookUserInfo['last_name']);
}
}
if (!$this->getUserSetEmailAddress()) {
$email = isset($facebookUserInfo['email']) ? $facebookUserInfo['email'] : '';
if (sfConfig::get('app_facebook_dont_store_proxy_emails', false)) {
if (sfFacebookGraph::checkProxyEmail($email)) {
$email = '';
}
}
if ($email != $user->getEmailAddress()) {
$user->setEmailAddress($email);
}
}
return $this;
}
开发者ID:passkey1510,项目名称:sfFacebookGraphPlugin,代码行数:34,代码来源:PluginsfFacebookGraphUserProfile.class.php
示例9: processLdap
/**
*
* @param sfWebRequest $request
* @param LdapForm $form
*/
protected function processLdap(sfWebRequest $request, LdapForm $form)
{
$form->bind($request->getParameter('signin'));
if ($form->isValid()) {
$values = $form->getValues();
// Check if user already exists in the DB
$user = Doctrine::getTable('sfGuardUser')->findOneByUsername($values["username"]);
// If not, create an account for him
if (empty($user)) {
$datetime = date("Y-m-d H:i:s");
// Create entry in sfGuardUser
$sfGuardUser = new sfGuardUser();
$sfGuardUser->setEmailAddress($values["username"]);
$sfGuardUser->setUsername($values["username"]);
$sfGuardUser->setFirstName($values["firstname"]);
$sfGuardUser->setLastName($values["lastname"]);
$sfGuardUser->setCreatedAt($datetime);
$sfGuardUser->setUpdatedAt($datetime);
$sfGuardUser->save();
// Additional informations for user's profile
$sfGuardUserProfile = new sfGuardUserProfile();
$sfGuardUserProfile->setUserId($sfGuardUser->getId());
$sfGuardUserProfile->setToken(MiscUtils::generateToken());
$sfGuardUserProfile->setSecurityLevel(sfConfig::get("app_security_level_new_user", 0));
$sfGuardUserProfile->save();
$permission = Doctrine_Core::getTable("sfGuardPermission")->findOneByName(sfConfig::get("app_permission_new_user", "User"));
if (!$permission) {
$this->getUser()->setFlash("error", "Unable to set permissions for this account! Contact your administrator.");
$sfGuardUserProfile->delete();
$sfGuardUser->delete();
return;
}
// Give basic permissions for user
$sfGuardPermission = new sfGuardUserPermission();
$sfGuardPermission->setUserId($sfGuardUser->getId());
$sfGuardPermission->setPermissionId($permission->getId());
$sfGuardPermission->setCreatedAt($datetime);
$sfGuardPermission->setUpdatedAt($datetime);
$sfGuardPermission->save();
$userGroup = Doctrine_Core::getTable("sfGuardGroup")->findOneByName(sfConfig::get("app_project_group"));
if (!$userGroup) {
$this->getUser()->setFlash("error", "Unable to set project group for this account! Contact your administrator.");
$sfGuardUserProfile->delete();
$sfGuardUser->delete();
$sfGuardPermission->delete();
return;
}
// Create new entry into sfGuardUserGroup table
$sfGuardGroup = new sfGuardUserGroup();
$sfGuardGroup->setUserId($sfGuardUser->getId());
$sfGuardGroup->setGroupId($userGroup->getId());
$sfGuardGroup->setCreatedAt($datetime);
$sfGuardGroup->setUpdatedAt($datetime);
$sfGuardGroup->save();
$user = $sfGuardUser;
}
$this->getUser()->signIn($user, array_key_exists('remember', $values) ? $values['remember'] : false);
// Set the tow previous referer to the same value for:
// 1) redirect to previous user's location
// 2) avoid redirect loop in signin
$this->getUser()->setReferer($this->getUser()->getReferer());
// Redirect to referer
return $this->redirect($this->getUser()->getReferer());
}
}
示例10: ajouterUtilisateur
public function ajouterUtilisateur($values)
{
$user = new sfGuardUser();
$user->setEmailAddress($values['email_address']);
$user->setUsername($values['email_address']);
$user->setLastName($values['nom']);
$user->setFirstName($values['prenom']);
$user->setPassword($values['password1']);
$user->setIsActive(1);
$user->getProfile()->setAdresse($values['adresse']);
$user->getProfile()->setCodepostal($values['codepostal']);
$user->getProfile()->setVille($values['ville']);
$user->getProfile()->setFixe($values['fixe']);
$user->getProfile()->setMobile($values['mobile']);
$user->getProfile()->setDateNaissance($values['date_naissance']);
$user->getProfile()->setNumeroPermis($values['numero_permis']);
$user->getProfile()->setVilleDelivrance($values['ville_permis']);
$user->getProfile()->setPaysDelivrance($values['pays_permis']);
$user->getProfile()->setDateDelivrance($values['date_delivrance_permis']);
$user->getProfile()->setIsActivated(1);
$user->addGroupByName("client");
$user->save();
$this->getUser()->setAttribute('email_address', $values['email_address']);
return $user;
}