本文整理汇总了PHP中Application_Model_User::setPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::setPassword方法的具体用法?PHP Application_Model_User::setPassword怎么用?PHP Application_Model_User::setPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application_Model_User
的用法示例。
在下文中一共展示了Application_Model_User::setPassword方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: recoverPassword
public function recoverPassword(Application_Model_User $user)
{
$new_password = $this->passwordGenerator();
$user->setPassword(md5($new_password));
$user->save();
$options['email'] = $user->getEmail();
$options['password'] = $new_password;
$options['firstName'] = $user->getFirstName();
$options['lastName'] = $user->getLastName();
$Mail = new Base_Mail();
$Mail->sendForgotMail($options);
}
示例2: addUserAction
public function addUserAction()
{
global $CC_CONFIG;
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$js_files = array('/js/datatables/js/jquery.dataTables.js?', '/js/datatables/plugin/dataTables.pluginAPI.js?', '/js/airtime/user/user.js?');
foreach ($js_files as $js) {
$this->view->headScript()->appendFile($baseUrl . $js . $CC_CONFIG['airtime_version'], 'text/javascript');
}
$this->view->headLink()->appendStylesheet($baseUrl . '/css/users.css?' . $CC_CONFIG['airtime_version']);
$form = new Application_Form_AddUser();
$this->view->successMessage = "";
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$formdata = $form->getValues();
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1 && $formdata['login'] == 'admin' && $formdata['user_id'] != 0) {
$this->view->successMessage = "<div class='errors'>Specific action is not allowed in demo version!</div>";
} elseif ($form->validateLogin($formdata)) {
$user = new Application_Model_User($formdata['user_id']);
$user->setFirstName($formdata['first_name']);
$user->setLastName($formdata['last_name']);
$user->setLogin($formdata['login']);
// We don't allow 6 x's as a password.
// The reason is because we that as a password placeholder
// on the client side.
if ($formdata['password'] != "xxxxxx") {
$user->setPassword($formdata['password']);
}
$user->setType($formdata['type']);
$user->setEmail($formdata['email']);
$user->setCellPhone($formdata['cell_phone']);
$user->setSkype($formdata['skype']);
$user->setJabber($formdata['jabber']);
$user->save();
$form->reset();
if (strlen($formdata['user_id']) == 0) {
$this->view->successMessage = "<div class='success'>User added successfully!</div>";
} else {
$this->view->successMessage = "<div class='success'>User updated successfully!</div>";
}
}
}
}
$this->view->form = $form;
}
示例3: updateAction
/**
*
* Change password
*/
public function updateAction()
{
// display form
$request = $this->getRequest();
$form = new Application_Form_Update();
// process form
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$userMapper = new Application_Model_UserMapper();
$auth = Zend_Auth::getInstance();
$user = new Application_Model_User(get_object_vars($auth->getIdentity()));
$user->setPassword($form->getValue('password'));
$userMapper->save($user);
$form = null;
$this->view->msg = "Your password has been updated.";
}
}
$this->view->form = $form;
}
示例4: editUserAction
public function editUserAction()
{
$request = $this->getRequest();
$form = new Application_Form_EditUser();
if ($request->isPost()) {
$formData = $request->getPost();
if ($form->isValid($formData) && $form->validateLogin($formData['cu_login'], $formData['cu_user_id'])) {
$user = new Application_Model_User($formData['cu_user_id']);
$user->setFirstName($formData['cu_first_name']);
$user->setLastName($formData['cu_last_name']);
// We don't allow 6 x's as a password.
// The reason is because we use that as a password placeholder
// on the client side.
if ($formData['cu_password'] != "xxxxxx") {
$user->setPassword($formData['cu_password']);
}
$user->setEmail($formData['cu_email']);
$user->setCellPhone($formData['cu_cell_phone']);
$user->setSkype($formData['cu_skype']);
$user->setJabber($formData['cu_jabber']);
$user->save();
Application_Model_Preference::SetUserLocale($formData['cu_locale']);
Application_Model_Preference::SetUserTimezone($formData['cu_timezone']);
//configure localization with new locale setting
Application_Model_Locale::configureLocalization($formData['cu_locale']);
//reinitialize form so language gets translated
$form = new Application_Form_EditUser();
$this->view->successMessage = "<div class='success'>" . _("Settings updated successfully!") . "</div>";
}
$this->view->form = $form;
$this->view->html = $this->view->render('user/edit-user.phtml');
}
$this->view->form = $form;
$this->view->html = $this->view->render('user/edit-user.phtml');
}
示例5: doFacebookLogin
public function doFacebookLogin()
{
$view = new Zend_view();
$view->addHelperPath('Base/View/Helper/', 'Base_View_Helper');
$facebook = $view->facebook();
$session = $facebook->getSession();
if ($session) {
try {
$Auth = new Base_Auth_Auth();
$uid = $facebook->getUser();
$user = new Application_Model_User();
$where = "facebook_id='{$uid}'";
$user = $user->fetchRow($where);
if (false === $user) {
//create new user
$me = $facebook->api('/me');
$password = md5($Auth->passwordGenerator());
$user = new Application_Model_User();
if ($me['email'] != "") {
$where = "email='{$me['email']}'";
$user = $user->fetchRow($where);
if (false === $user) {
//insertex
$user = new Application_Model_User();
$user->setEmail($me['email']);
$user->setUsername($me['id']);
$user->setPassword($password);
$user->setfirstName($me['first_name']);
$user->setLastName($me['last_name']);
$user->setSex($me['gender']);
$user->setGapperOrFriend('gapper');
$user->setFacebookId($me['id']);
$user->setStatus('active');
$user->setDob('0000-00-00');
$user->setUserLevelId(1);
} else {
//update
$user->setFacebookId($me['id']);
}
} else {
$user = new Application_Model_User();
$user->setEmail($me['email']);
$user->setUsername($me['id']);
$user->setPassword($password);
$user->setfirstName($me['first_name']);
$user->setLastName($me['last_name']);
$user->setSex($me['gender']);
$user->setGapperOrFriend('gapper');
$user->setFacebookId($me['id']);
$user->setStatus('active');
$user->setDob('0000-00-00');
$user->setUserLevelId(1);
}
$user_id = $user->save();
if ($user_id > 0) {
$user->setDefaultPermissions($user_id);
if ($params['email'] != "") {
//send registration mail
}
}
}
//--do login --
$params['email'] = $user->getEmail();
//$params['username']=$user->getUsername();
$params['password'] = $user->getPassword();
$params['md5'] = "false";
$Auth->doLogout();
$loginStatus = true;
if ($params['email'] != "") {
$loginStatus = $Auth->doLogin($params, 'email');
} else {
$params['email'] = $user->getUsername();
$loginStatus = $Auth->doLogin($params, 'username');
}
if ($user->getEmail() == "" || is_null($user->getEmail())) {
//echo "<a href='/gapper/update-your-email' >Click here</a>";
//$this->_helper->redirector('update-your-email','gapper');
$result['email'] = "no";
return $result;
}
if ($loginStatus) {
$result['email'] = "ok";
return $result;
//echo "<a href='/gapper/where-i-am' >Click here</a>";
//$this->_helper->redirector('where-i-am','gapper');
} else {
if ($user->getStatus() == "inactive") {
exit("Please activate your account. <br><a href='#' onclick='window.close();'>Close</a>");
} else {
if ($user->getStatus() == "deleted") {
exit("Your account status is deleted. Please contact administrator.");
} else {
exit("error while login");
}
}
}
} catch (FacebookApiException $e) {
error_log($e);
}
}
//.........这里部分代码省略.........