示例#1
0
 /**
  * Method to request a username reminder.
  *
  * @since	1.6
  */
 public function remind()
 {
     // Check the request token.
     Session::checkToken('post') or exit(Lang::txt('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $model = $this->getModel('Remind', 'UsersModel');
     $data = Request::getVar('jform', array(), 'post', 'array');
     // Submit the password reset request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if ($return == false) {
         // The request failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the request form.
         $message = Lang::txt('COM_USERS_REMIND_REQUEST_FAILED', $model->getError());
         $this->setRedirect(Route::url($route, false), $message, 'warning');
         return false;
     } else {
         // The request succeeded.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to step two.
         $message = Lang::txt('COM_USERS_REMIND_REQUEST_SUCCESS');
         $this->setRedirect(Route::url($route, false), $message);
         return true;
     }
 }
示例#2
0
 /**
  * Method to request a username reminder.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 public function remind()
 {
     // Check the request token.
     JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
     $model = $this->getModel('Remind', 'UsersModel');
     $data = $this->input->post->get('jform', array(), 'array');
     // Submit the password reset request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if ($return == false) {
         // The request failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the request form.
         $message = JText::sprintf('Request failed: Your account is not activated yet or is under review. Please contact the admin more for details.', $model->getError());
         $this->setRedirect(JRoute::_($route, false), $message, 'notice');
         return false;
     } else {
         // The request succeeded.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to step two.
         $message = JText::_('COM_USERS_REMIND_REQUEST_SUCCESS');
         $this->setRedirect(JRoute::_($route, false), $message);
         return true;
     }
 }
示例#3
0
 public static function getLogout($params)
 {
     $logout = new stdClass();
     $logout->menu = self::getMenu($params);
     $logout->profileLink = JRoute::_('index.php?option=com_users&view=profile&layout=edit&Itemid=' . UsersHelperRoute::getProfileRoute());
     $logout->option = 'com_users';
     $logout->task = 'user.logout';
     $logout->return = self::getReturnURL($params, 'logout');
     $logout->K2CommentsEnabled = JComponentHelper::getParams('com_k2')->get('comments');
     return $logout;
 }
示例#4
0
 /**
  * Method to display the view.
  *
  * @access	public
  * @param	string	$tpl	The template file to include
  * @since	1.0
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     // If the user is logged in, send them to their profile.
     if (!$user->get('guest')) {
         $itemid = UsersHelperRoute::getProfileRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $app->redirect(JRoute::_('index.php?option=com_users&view=profile' . $itemid, false));
         return false;
     }
     // Get the appropriate form.
     if ($this->_layout === 'confirm') {
         $form =& $this->get('ResetConfirmForm');
     } elseif ($this->_layout === 'complete') {
         // Get the token and user id from the confirmation process.
         $token = $app->getUserState('com_users.reset.token', null);
         $userId = $app->getUserState('com_users.reset.user', null);
         // Check the token and user id.
         if (empty($token) || empty($userId)) {
             JError::raiseError(403, JText::_('ALERTNOTAUTH'));
             return false;
         }
         $form =& $this->get('ResetCompleteForm');
     } else {
         $form =& $this->get('ResetRequestForm');
     }
     // Check the form.
     if (JError::isError($form)) {
         JError::raiseError(500, $form->getMessage());
         return false;
     }
     // Check for errors.
     if (count($errors =& $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Push the data into the view.
     $this->assignRef('form', $form);
     parent::display($tpl);
 }
示例#5
0
 /**
  * Method to display the view.
  *
  * @access	public
  * @param	string	$tpl	The template file to include
  * @since	1.0
  */
 function display($tpl = null)
 {
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     // If the user is logged in, send them to their profile.
     if (!$user->get('guest')) {
         $itemid = UsersHelperRoute::getProfileRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $app->redirect(JRoute::_('index.php?option=com_users&view=profile' . $itemid, false));
         return false;
     }
     // Get the view data.
     $form =& $this->get('RemindForm');
     // Check for errors.
     if (count($errors =& $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Push the data into the view.
     $this->assignRef('form', $form);
     parent::display($tpl);
 }
示例#6
0
    public function display($tpl = null)
    {
        // Get application
        $application = JFactory::getApplication();
        // Get document
        $document = JFactory::getDocument();
        // Get user
        $user = JFactory::getUser();
        // Extra class for Front-end
        $this->class = ' jw-backend';
        // Front-end permissions check.
        // We need to do this here since front-end requests are not executed through /administrator/components/com_k2/k2.php
        if ($application->isSite()) {
            $this->class = ' jw-frontend';
            if (!$user->authorise('core.manage', 'com_k2')) {
                if ($user->guest) {
                    // If user is guest redirect him to login page
                    require_once JPATH_SITE . '/components/com_users/helpers/route.php';
                    $uri = JUri::getInstance();
                    $url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString()) . '&Itemid=' . UsersHelperRoute::getLoginRoute();
                    $application->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
                    return false;
                } else {
                    throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
                }
            }
        }
        // Set the correct metadata
        $document->setMetaData('viewport', 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no');
        // Load jQuery
        JHtml::_('jquery.framework');
        // Keep alive the session
        JHtml::_('behavior.keepalive');
        // Load the CSS
        if ($application->isSite()) {
            $document->addScript(JURI::root(true) . '/media/k2app/assets/js/frontend.js?v=3.0.0');
            $document->addStyleSheet(JURI::root(true) . '/media/k2app/assets/css/frontend.css?v=3.0.0');
        }
        $document->addStyleSheet('//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css?v=3.0.0');
        $document->addStyleSheet(JURI::root(true) . '/media/k2app/assets/css/k2.css?v=3.0.0');
        // Add javascript variables
        $document->addScriptDeclaration('
			/* K2 v3.0.0 - START */
			var K2SessionToken = "' . JSession::getFormToken() . '";
			var K2Editor = ' . $this->getEditor() . ';
			var K2SitePath = "' . JURI::root(true) . '";
			var K2BasePath = "' . JURI::base(true) . '";
			var K2MediaManagerLanguage = "' . $this->getMediaManagerLanguage() . '";
			var K2Language = ' . $this->getLanguage() . ';
			/* K2 v3.0.0 - FINISH */
		');
        // Add DropBox drop-in
        $params = JComponentHelper::getParams('com_k2');
        if ($dropBoxAppKey = $params->get('dropboxAppKey')) {
            // Load DropBox script
            $document->addCustomTag('<script data-app-key="' . $dropBoxAppKey . '" id="dropboxjs" src="https://www.dropbox.com/static/api/2/dropins.js"></script>');
        }
        // Load the application
        $document->addCustomTag('<script data-main="' . JURI::root(true) . '/media/k2app/app/main" src="' . JURI::root(true) . '/media/k2app/vendor/require/require.js?v=3.0.0"></script>');
        // Set title
        if (class_exists('JToolBarHelper')) {
            JToolBarHelper::title(JText::_('COM_K2'));
        }
        // Display
        parent::display($tpl);
    }
 /**
  * Method to complete the password reset process.
  *
  * @since   1.6
  */
 public function complete()
 {
     // Check for request forgeries
     JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $model = $this->getModel('Reset', 'UsersModel');
     $data = $this->input->post->get('jform', array(), 'array');
     // Complete the password reset request.
     $return = $model->processResetComplete($data);
     // Check for a hard error.
     if ($return instanceof Exception) {
         // Get the error message to display.
         if ($app->get('error_reporting')) {
             $message = $return->getMessage();
         } else {
             $message = JText::_('COM_USERS_RESET_COMPLETE_ERROR');
         }
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getResetRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=reset&layout=complete' . $itemid;
         // Go back to the complete form.
         $this->setRedirect(JRoute::_($route, false), $message, 'error');
         return false;
     } elseif ($return === false) {
         // Complete failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getResetRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=reset&layout=complete' . $itemid;
         // Go back to the complete form.
         $message = JText::sprintf('COM_USERS_RESET_COMPLETE_FAILED', $model->getError());
         $this->setRedirect(JRoute::_($route, false), $message, 'notice');
         return false;
     } else {
         // Complete succeeded.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getLoginRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to the login form.
         $message = JText::_('COM_USERS_RESET_COMPLETE_SUCCESS');
         $this->setRedirect(JRoute::_($route, false), $message);
         return true;
     }
 }
示例#8
0
文件: user.php 项目: adjaika/J3Base
 /**
  * Method to login a user.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 public function remind()
 {
     // Check the request token.
     JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $model = $this->getModel('User', 'UsersModel');
     $data = $this->input->post->get('jform', array(), 'array');
     // Submit the username remind request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if ($return instanceof Exception) {
         // Get the error message to display.
         $message = $app->get('error_reporting') ? $return->getMessage() : JText::_('COM_USERS_REMIND_REQUEST_ERROR');
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $this->setRedirect(JRoute::_($route, false), $message, 'error');
         return false;
     }
     if ($return === false) {
         // Complete failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $message = JText::sprintf('COM_USERS_REMIND_REQUEST_FAILED', $model->getError());
         $this->setRedirect(JRoute::_($route, false), $message, 'notice');
         return false;
     }
     // Complete succeeded.
     // Get the route to the next page.
     $itemid = UsersHelperRoute::getLoginRoute();
     $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
     $route = 'index.php?option=com_users&view=login' . $itemid;
     // Proceed to the login form.
     $message = JText::_('COM_USERS_REMIND_REQUEST_SUCCESS');
     $this->setRedirect(JRoute::_($route, false), $message);
     return true;
 }
示例#9
0
 /**
  * @since	1.6
  */
 public function processRemindRequest($data)
 {
     // Get the form.
     $form = $this->getForm();
     // Check for an error.
     if (empty($form)) {
         return false;
     }
     // Validate the data.
     $data = $this->validate($form, $data);
     // Check for an error.
     if ($data instanceof Exception) {
         return $return;
     }
     // Check the validation results.
     if ($data === false) {
         // Get the validation messages from the form.
         foreach ($form->getErrors() as $message) {
             $this->setError($message);
         }
         return false;
     }
     // Find the user id for the given email address.
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     $query->select('*');
     $query->from($db->quoteName('#__users'));
     $query->where($db->quoteName('email') . ' = ' . $db->Quote($data['email']));
     // Get the user id.
     $db->setQuery((string) $query);
     $users = $db->loadObjectList('id');
     $usersnames = array();
     // Check for an error.
     if ($db->getErrorNum()) {
         $this->setError(Lang::txt('COM_USERS_DATABASE_ERROR', $db->getErrorMsg()), 500);
         return false;
     }
     // Check for a user.
     if (count($users) < 1) {
         $this->setError(Lang::txt('COM_USERS_USER_NOT_FOUND'));
         return false;
     }
     foreach ($users as $user) {
         // Make sure the user isn't blocked.
         if ($user->block) {
             unset($users[$user->id]);
         } else {
             $usersnames[] = $user->username;
             $email = $user->email;
         }
     }
     // Check for a user.
     if (count($users) < 1) {
         $this->setError(Lang::txt('COM_USERS_USER_NOT_FOUND'));
         return false;
     }
     // Assemble the login link.
     $itemid = UsersHelperRoute::getLoginRoute();
     $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
     $link = 'index.php?option=com_users&view=login' . $itemid;
     $mode = Config::get('force_ssl', 0) == 2 ? 1 : -1;
     // Put together the email template data.
     $data = array();
     $data['username'] = implode(', ', $usersnames);
     $data['fromname'] = Config::get('fromname');
     $data['mailfrom'] = Config::get('mailfrom');
     $data['sitename'] = Config::get('sitename');
     $data['link_text'] = Route::url($link, false, $mode);
     $data['link_html'] = Route::url($link, true, $mode);
     $subject = Lang::txt('COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT', $data['sitename']);
     $body = Lang::txt('COM_USERS_EMAIL_USERNAME_REMINDER_BODY', $data['sitename'], $data['username'], $data['link_text']);
     // Send the password reset request email.
     $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $email, $subject, $body);
     // Check for an error.
     if ($return !== true) {
         $this->setError(Lang::txt('COM_USERS_MAIL_FAILED'), 500);
         return false;
     }
     return true;
 }
示例#10
0
文件: user.php 项目: joebushi/joomla
 /**
  * Method to login a user.
  *
  * @access	public
  * @since	1.0
  */
 function remind()
 {
     // Check the request token.
     JRequest::checkToken('post') or jexit(JText::_('JInvalid_Token'));
     $app =& JFactory::getApplication();
     $model =& $this->getModel('User', 'UsersModel');
     $data = JRequest::getVar('jform', array(), 'post', 'array');
     // Submit the username remind request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if (JError::isError($return)) {
         // Get the error message to display.
         if ($app->getCfg('error_reporting')) {
             $message = $return->getMessage();
         } else {
             $message = JText::_('USERS_REMIND_REQUEST_ERROR');
         }
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $this->setRedirect(JRoute::_($route, false), $message, 'error');
         return false;
     } elseif ($return === false) {
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $message = JText::sprintf('USERS_REMIND_REQUEST_FAILED', $model->getError());
         $this->setRedirect(JRoute::_($route, false), $message, 'notice');
         return false;
     } else {
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getLoginRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to the login form.
         $message = JText::_('USERS_REMIND_REQUEST_SUCCESS');
         $this->setRedirect(JRoute::_($route, false), $message);
         return true;
     }
 }
 public function getRegistrationLink($options = array())
 {
     return JRoute::_('index.php?option=com_users&view=registration&Itemid=' . UsersHelperRoute::getRegistrationRoute());
 }
示例#12
0
 public function checkSiteAccess()
 {
     // Get date
     $date = JFactory::getDate();
     $now = $date->toSql();
     // State check
     if ($this->state < 1 || (int) $this->id < 1) {
         throw new Exception(JText::_('K2_NOT_FOUND'), 404);
     }
     // Get user
     $user = JFactory::getUser();
     $viewLevels = $user->getAuthorisedViewLevels();
     // Access check
     if (!in_array($this->access, $viewLevels)) {
         if ($user->guest) {
             // Get application
             $application = JFactory::getApplication();
             // Get document
             $document = JFactory::getDocument();
             // In front end HTML requests redirect the user to the login page
             if ($application->isSite() && $document->getType() == 'html') {
                 require_once JPATH_SITE . '/components/com_users/helpers/route.php';
                 $uri = JUri::getInstance();
                 $url = 'index.php?option=com_users&view=login&return=' . base64_encode($uri->toString()) . '&Itemid=' . UsersHelperRoute::getLoginRoute();
                 $application->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
             }
             // Return false
             return false;
         } else {
             throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
         }
     }
     return true;
 }
示例#13
0
	function ajaxforgot()
	{
		error_reporting(0);
		require_once(JPATH_SITE . '/components/com_users/helpers/route.php');
		$lang = JFactory::getLanguage();
		$extension = 'com_users';
		$base_dir = JPATH_SITE;
		$language_tag = $lang->getTag();
		$reload = true;
		$lang->load($extension, $base_dir, $language_tag, $reload);
		$config = JFactory::getConfig();
		$db		= JFactory::getDbo();
		$params = JComponentHelper::getParams('com_users');
		
		$requestData ['email']= JRequest::getVar('email');
	
		// Find the user id for the given email address.
		$query	= $db->getQuery(true);
		$query->select('id');
		$query->from($db->quoteName('#__users'));
		$query->where($db->quoteName('email').' = '.$db->Quote($requestData ['email']));

		// Get the user object.
		$db->setQuery((string) $query);

		try
		{
			$userId = $db->loadResult();
		}
		catch (RuntimeException $e)
		{
			//$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
			awdwallController::ajaxResponse('$error$'.JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()));
		}

		// Check for a user.
		if (empty($userId)) {
			awdwallController::ajaxResponse('$error$'.JText::_('COM_USERS_INVALID_EMAIL'));
		}

		// Get the user object.
		$user = JUser::getInstance($userId);

		// Make sure the user isn't blocked.
		if ($user->block) {
			awdwallController::ajaxResponse('$error$'.JText::_('COM_USERS_USER_BLOCKED'));
		}

		// Make sure the user isn't a Super Admin.
		if ($user->authorise('core.admin')) {
			awdwallController::ajaxResponse('$error$'.JText::_('COM_USERS_REMIND_SUPERADMIN_ERROR'));
		}

		// Make sure the user has not exceeded the reset limit
		$params = JFactory::getApplication()->getParams();
		$maxCount = (int) $params->get('reset_count');
		$resetHours = (int) $params->get('reset_time');
		$result = true;

		$lastResetTime = strtotime($user->lastResetTime) ? strtotime($user->lastResetTime) : 0;
		$hoursSinceLastReset = (strtotime(JFactory::getDate()->toSql()) - $lastResetTime) / 3600;

		// If it's been long enough, start a new reset count
		if ($hoursSinceLastReset > $resetHours)
		{
			$user->lastResetTime = JFactory::getDate()->toSql();
			$user->resetCount = 1;
		}

		// If we are under the max count, just increment the counter
		elseif ($user->resetCount < $maxCount)
		{
			$user->resetCount;
		}

		// At this point, we know we have exceeded the maximum resets for the time period
		else
		{
			$result = false;
		}
		
		
		if (!$result) {
			$resetLimit = (int) JFactory::getApplication()->getParams()->get('reset_time');
			//$this->setError(JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS', $resetLimit));
			awdwallController::ajaxResponse('$error$'.JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS', $resetLimit));
			//return false;
		}

		// Set the confirmation token.
		$token = JApplication::getHash(JUserHelper::genRandomPassword());
		$salt = JUserHelper::getSalt('crypt-md5');
		$hashedToken = md5($token.$salt).':'.$salt;

		$user->activation = $hashedToken;

		// Save the user to the database.
		if (!$user->save(true)) {
			awdwallController::ajaxResponse('$error$'.JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()));
			//return new JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()), 500);
		}
		
		// Assemble the password reset confirmation link.
		$mode = $config->get('force_ssl', 0) == 2 ? 1 : -1;
		$itemid = UsersHelperRoute::getLoginRoute();
		$itemid = $itemid !== null ? '&Itemid='.$itemid : '';
		$link = 'index.php?option=com_users&view=reset&layout=confirm'.$itemid;
				

		// Put together the email template data.
		$data = $user->getProperties();
		$data['fromname']	= $config->get('fromname');
		$data['mailfrom']	= $config->get('mailfrom');
		$data['sitename']	= $config->get('sitename');
		$data['link_text']	= JRoute::_($link, false, $mode);
		$data['link_html']	= JRoute::_($link, true, $mode);
		$data['token']		= $token;

		$subject = JText::sprintf(
			'COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT',
			$data['sitename']
		);

		$body = JText::sprintf(
			'COM_USERS_EMAIL_PASSWORD_RESET_BODY',
			$data['sitename'],
			$data['token'],
			$data['link_text']
		);

		// Send the password reset request email.
		$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body);
		// Check for an error.
		if ($return !== true) {
			awdwallController::ajaxResponse('$error$'.JText::_('COM_USERS_MAIL_FAILED'));
		}		
		awdwallController::ajaxResponse(JText::_('COM_COMAWDWALL_FORGOTPASS_SUCCESS_TEXT'));
		exit;
	}
示例#14
0
文件: mod_k2_user.php 项目: emavro/k2
        $langScript = '
			var JLanguage = {};
			JLanguage.WHAT_IS_OPENID = \'' . JText::_('K2_WHAT_IS_OPENID') . '\';
			JLanguage.LOGIN_WITH_OPENID = \'' . JText::_('K2_LOGIN_WITH_OPENID') . '\';
			JLanguage.NORMAL_LOGIN = \'' . JText::_('K2_NORMAL_LOGIN') . '\';
			var modlogin = 1;
		';
        $document = JFactory::getDocument();
        $document->addScriptDeclaration($langScript);
        JHTML::_('script', 'openid.js');
    }
    // Get user stuff (do not edit)
    $usersConfig = JComponentHelper::getParams('com_users');
    // Define some variables depending on Joomla! version
    $passwordFieldName = K2_JVERSION != '15' ? 'password' : 'passwd';
    $resetLink = JRoute::_(K2_JVERSION != '15' ? 'index.php?option=com_users&view=reset&Itemid=' . UsersHelperRoute::getResetRoute() : 'index.php?option=com_user&view=reset');
    $remindLink = JRoute::_(K2_JVERSION != '15' ? 'index.php?option=com_users&view=remind&Itemid=' . UsersHelperRoute::getRemindRoute() : 'index.php?option=com_user&view=remind');
    $registrationLink = JRoute::_(K2_JVERSION != '15' ? 'index.php?option=com_users&view=registration&Itemid=' . UsersHelperRoute::getRegistrationRoute() : 'index.php?option=com_user&view=register');
    $option = K2_JVERSION != '15' ? 'com_users' : 'com_user';
    $task = K2_JVERSION != '15' ? 'user.login' : 'login';
    require JModuleHelper::getLayoutPath('mod_k2_user', 'login');
} else {
    JHTML::_('behavior.modal');
    $user->profile = modK2UserHelper::getProfile($params);
    $user->numOfComments = modK2UserHelper::countUserComments($user->id);
    $menu = modK2UserHelper::getMenu($params);
    $profileLink = JRoute::_(K2_JVERSION != '15' ? 'index.php?option=com_users&view=profile&layout=edit&Itemid=' . UsersHelperRoute::getProfileRoute() : 'index.php?option=com_user&view=user&task=edit');
    $option = K2_JVERSION != '15' ? 'com_users' : 'com_user';
    $task = K2_JVERSION != '15' ? 'user.logout' : 'logout';
    require JModuleHelper::getLayoutPath('mod_k2_user', 'userblock');
}
示例#15
0
 /**
  * Method to login a user.
  *
  * @since	1.6
  */
 public function remind()
 {
     // Check the request token.
     Session::checkToken('post');
     $model = $this->getModel('User', 'UsersModel');
     $data = Request::getVar('jform', array(), 'post', 'array');
     // Submit the username remind request.
     $return = $model->processRemindRequest($data);
     // Check for a hard error.
     if ($return instanceof Exception) {
         // Get the error message to display.
         if (Config::get('error_reporting')) {
             $message = $return->getMessage();
         } else {
             $message = Lang::txt('COM_USERS_REMIND_REQUEST_ERROR');
         }
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $this->setRedirect(Route::url($route, false), $message, 'error');
         return false;
     } elseif ($return === false) {
         // Complete failed.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getRemindRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=remind' . $itemid;
         // Go back to the complete form.
         $message = Lang::txt('COM_USERS_REMIND_REQUEST_FAILED', $model->getError());
         $this->setRedirect(Route::url($route, false), $message, 'notice');
         return false;
     } else {
         // Complete succeeded.
         // Get the route to the next page.
         $itemid = UsersHelperRoute::getLoginRoute();
         $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
         $route = 'index.php?option=com_users&view=login' . $itemid;
         // Proceed to the login form.
         $message = Lang::txt('COM_USERS_REMIND_REQUEST_SUCCESS');
         $this->setRedirect(Route::url($route, false), $message);
         return true;
     }
 }
示例#16
0
文件: user.php 项目: joebushi/joomla
 function processRemindRequest($data)
 {
     // Get the form.
     $form =& $this->getRemindForm();
     // Check for an error.
     if (JError::isError($form)) {
         return $form;
     }
     // Validate the data.
     $data = $this->validate($form, $data);
     // Check the validator results.
     if (JError::isError($data) || $data === false) {
         return $data;
     }
     // Find the user id for the given e-mail address.
     $query = new JQuery();
     $query->select('*');
     $query->from('`#__users`');
     $query->where('`email` = ' . $this->_db->Quote($data['email']));
     // Get the user id.
     $this->_db->setQuery((string) $query);
     $user = $this->_db->loadObject();
     // Check for an error.
     if ($this->_db->getErrorNum()) {
         return new JException(JText::sprintf('USERS_DATABASE_ERROR', $this->_db->getErrorMsg()), 500);
     }
     // Check for a user.
     if (empty($user)) {
         $this->setError(JText::_('USERS_USER_NOT_FOUND'));
         return false;
     }
     // Make sure the user isn't blocked.
     if ($user->block) {
         $this->setError(JText::_('USERS_USER_BLOCKED'));
         return false;
     }
     $config =& JFactory::getConfig();
     // Assemble the login link.
     $itemid = UsersHelperRoute::getLoginRoute();
     $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
     $link = 'index.php?option=com_users&view=login' . $itemid;
     $mode = $config->getValue('force_ssl', 0) == 2 ? 1 : -1;
     // Put together the e-mail template data.
     $data = JArrayHelper::fromObject($user);
     $data['fromname'] = $config->getValue('fromname');
     $data['mailfrom'] = $config->getValue('mailfrom');
     $data['sitename'] = $config->getValue('sitename');
     $data['link_text'] = JRoute::_($link, false, $mode);
     $data['link_html'] = JRoute::_($link, true, $mode);
     // Load the mail template.
     jimport('joomla.utilities.simpletemplate');
     $template = new JSimpleTemplate();
     if (!$template->load('users.username.remind.request')) {
         return new JException(JText::_('USERS_REMIND_MAIL_TEMPLATE_NOT_FOUND'), 500);
     }
     // Push in the email template variables.
     $template->bind($data);
     // Get the email information.
     $toEmail = $user->email;
     $subject = $template->getTitle();
     $message = $template->getHtml();
     // Send the password reset request e-mail.
     $return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $toEmail, $subject, $message);
     // Check for an error.
     if ($return !== true) {
         return new JException(JText::_('USERS_MAIL_FAILED'), 500);
     }
     return true;
 }
示例#17
0
文件: route.php 项目: joebushi/joomla
 /**
  * Method to get a route configuration for the reset view.
  *
  * @access	public
  * @return	mixed		Integer menu id on success, null on failure.
  * @since	1.0
  * @static
  */
 function getResetRoute()
 {
     // Get the items.
     $items =& UsersHelperRoute::getItems();
     $itemid = null;
     // Search for a suitable menu id.
     foreach ($items as $item) {
         if (isset($item->query['view']) && $item->query['view'] === 'reset') {
             $itemid = $item->id;
             break;
         }
     }
     return $itemid;
 }
示例#18
0
 public function onUserBeforeSave($user, $isNew)
 {
     // Get application
     $application = JFactory::getApplication();
     // Get params
     $params = JComponentHelper::getParams('com_k2');
     // Get input
     $isK2UserForm = $application->input->get('K2UserForm', 0, 'int');
     // Process only in front-end. Check all conditions
     if ($params->get('K2UserProfile') && $isNew && $params->get('recaptchaOnRegistration') && $application->isSite() && $isK2UserForm) {
         $data = array();
         $data['privatekey'] = $params->get('recaptcha_private_key');
         $data['remoteip'] = $_SERVER["REMOTE_ADDR"];
         $data['challenge'] = $application->input->post->get('recaptcha_challenge_field', '', 'raw');
         $data['response'] = $application->input->post->get('recaptcha_response_field', '', 'raw');
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/recaptcha/api/verify');
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         $response = curl_exec($ch);
         $error = curl_error($ch);
         curl_close($ch);
         require_once JPATH_SITE . '/components/com_users/helpers/route.php';
         $url = JRoute::_('index.php?option=com_users&view=registration&Itemid=' . UsersHelperRoute::getRegistrationRoute());
         if ($response === false) {
             $application->enqueueMessage($error, 'error');
             $application->redirect($url);
             return false;
         }
         $lines = explode("\n", $response);
         if (trim($lines[0]) != 'true') {
             $application->enqueueMessage(JText::_('K2_WE_COULD_NOT_VERIFY_THAT_YOU_ARE_HUMAN'), 'error');
             $application->redirect($url);
             return false;
         }
     }
 }
示例#19
0
	/**
	 * @since   1.6
	 */
	public function processRemindRequest($data)
	{
		// Get the form.
		$form = $this->getForm();

		// Check for an error.
		if (empty($form))
		{
			return false;
		}

		// Validate the data.
		$data = $this->validate($form, $data);

		// Check for an error.
		if ($data instanceof Exception)
		{
			return $return;
		}

		// Check the validation results.
		if ($data === false)
		{
			// Get the validation messages from the form.
			foreach ($form->getErrors() as $formError)
			{
				$this->setError($formError->getMessage());
			}
			return false;
		}

		// Find the user id for the given email address.
		$db = $this->getDbo();
		$query = $db->getQuery(true)
			->select('*')
			->from($db->quoteName('#__users'))
			->where($db->quoteName('email') . ' = ' . $db->quote($data['email']));

		// Get the user id.
		$db->setQuery($query);

		try
		{
			$user = $db->loadObject();
		}
		catch (RuntimeException $e)
		{
			$this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
			return false;
		}

		// Check for a user.
		if (empty($user))
		{
			$this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
			return false;
		}

		// Make sure the user isn't blocked.
		if ($user->block)
		{
			$this->setError(JText::_('COM_USERS_USER_BLOCKED'));
			return false;
		}

		$config = JFactory::getConfig();

		// Assemble the login link.
		$itemid = UsersHelperRoute::getLoginRoute();
		$itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
		$link = 'index.php?option=com_users&view=login' . $itemid;
		$mode = $config->get('force_ssl', 0) == 2 ? 1 : -1;

		// Put together the email template data.
		$data = JArrayHelper::fromObject($user);
		$data['fromname'] = $config->get('fromname');
		$data['mailfrom'] = $config->get('mailfrom');
		$data['sitename'] = $config->get('sitename');
		$data['link_text'] = JRoute::_($link, false, $mode);
		$data['link_html'] = JRoute::_($link, true, $mode);

		$subject = JText::sprintf(
			'COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT',
			$data['sitename']
		);
		$body = JText::sprintf(
			'COM_USERS_EMAIL_USERNAME_REMINDER_BODY',
			$data['sitename'],
			$data['username'],
			$data['link_text']
		);

		// Send the password reset request email.
		$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body);

		// Check for an error.
		if ($return !== true)
		{
			$this->setError(JText::_('COM_USERS_MAIL_FAILED'), 500);
			return false;
		}

		return true;
	}
示例#20
0
			<?php 
}
?>
				<li>
					<a href="<?php 
echo JRoute::_('index.php?option=com_users&view=remind&Itemid=' . UsersHelperRoute::getRemindRoute());
?>
">
					<?php 
echo JText::_('MOD_LOGIN_FORGOT_YOUR_USERNAME');
?>
</a>
				</li>
				<li>
					<a href="<?php 
echo JRoute::_('index.php?option=com_users&view=reset&Itemid=' . UsersHelperRoute::getResetRoute());
?>
">
					<?php 
echo JText::_('MOD_LOGIN_FORGOT_YOUR_PASSWORD');
?>
</a>
				</li>
			</ul>
		<input type="hidden" name="option" value="com_users" />
		<input type="hidden" name="task" value="user.login" />
		<input type="hidden" name="return" value="<?php 
echo $return;
?>
" />
		<?php 
示例#21
0
 /**
  * Method to start the password reset process.
  *
  * @since	1.6
  */
 public function processResetRequest($data)
 {
     $config = JFactory::getConfig();
     // Get the form.
     $form = $this->getForm();
     // Check for an error.
     if ($form instanceof Exception) {
         return $form;
     }
     // Filter and validate the form data.
     $data = $form->filter($data);
     $return = $form->validate($data);
     // Check for an error.
     if ($return instanceof Exception) {
         return $return;
     }
     // Check the validation results.
     if ($return === false) {
         // Get the validation messages from the form.
         foreach ($form->getErrors() as $message) {
             $this->setError($message);
         }
         return false;
     }
     // Find the user id for the given email address.
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     $query->select('id');
     $query->from($db->quoteName('#__users'));
     $query->where($db->quoteName('email') . ' = ' . $db->q($data['email']));
     // Get the user object.
     $db->setQuery((string) $query);
     $userId = $db->loadResult();
     // Check for an error.
     if ($db->getErrorNum()) {
         $this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $db->getErrorMsg()), 500);
         return false;
     }
     // Check for a user.
     if (empty($userId)) {
         $this->setError(JText::_('COM_USERS_INVALID_EMAIL'));
         return false;
     }
     // Get the user object.
     $user = JUser::getInstance($userId);
     // Make sure the user isn't blocked.
     if ($user->block) {
         $this->setError(JText::_('COM_USERS_USER_BLOCKED'));
         return false;
     }
     // Make sure the user isn't a Super Admin.
     if ($user->authorise('core.admin')) {
         $this->setError(JText::_('COM_USERS_REMIND_SUPERADMIN_ERROR'));
         return false;
     }
     // Make sure the user has not exceeded the reset limit
     if (!$this->checkResetLimit($user)) {
         $resetLimit = (int) JFactory::getApplication()->getParams()->get('reset_time');
         $this->setError(JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS', $resetLimit));
         return false;
     }
     // Set the confirmation token.
     $token = JApplication::getHash(JUserHelper::genRandomPassword());
     $salt = JUserHelper::getSalt('crypt-md5');
     $hashedToken = md5($token . $salt) . ':' . $salt;
     $user->activation = $hashedToken;
     // Save the user to the database.
     if (!$user->save(true)) {
         return new JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()), 500);
     }
     // Assemble the password reset confirmation link.
     $mode = $config->get('force_ssl', 0) == 2 ? 1 : -1;
     $itemid = UsersHelperRoute::getLoginRoute();
     $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
     $link = 'index.php?option=com_users&view=reset&layout=confirm' . $itemid;
     // Put together the email template data.
     $data = $user->getProperties();
     $data['fromname'] = $config->get('fromname');
     $data['mailfrom'] = $config->get('mailfrom');
     $data['sitename'] = $config->get('sitename');
     $data['link_text'] = JRoute::_($link, false, $mode);
     $data['link_html'] = JRoute::_($link, true, $mode);
     $data['token'] = $token;
     $subject = JText::sprintf('COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT', $data['sitename']);
     $body = JText::sprintf('COM_USERS_EMAIL_PASSWORD_RESET_BODY', $data['sitename'], $data['token'], $data['link_text']);
     // Send the password reset request email.
     $return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body);
     // Check for an error.
     if ($return !== true) {
         return new JException(JText::_('COM_USERS_MAIL_FAILED'), 500);
     }
     return true;
 }
示例#22
0
        ?>
									<?php 
        echo JText::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('username'), ENT_COMPAT, 'UTF-8'));
        ?>
								<?php 
    }
    ?>
							</span>
						<?php 
}
?>
					</a>
				</div>
				<div class="login-data">
					<a class="btn btn-primary" href="<?php 
echo JRoute::_('index.php?option=com_users&view=profile&Itemid=' . UsersHelperRoute::getProfileRoute());
?>
">Meu Perfil</a>
					<input type="submit" name="Submit" class="btn btn-inverse" value="<?php 
echo JText::_('JLOGOUT');
?>
" />
					<input type="hidden" name="option" value="com_users" />
					<input type="hidden" name="task" value="user.logout" />
					<input type="hidden" name="return" value="<?php 
echo $return;
?>
" />
					<?php 
echo JHtml::_('form.token');
?>
示例#23
0
    /**
     * Method to start the password reset process.
     *
     * @param   array  $data  The data expected for the form.
     *
     * @return  mixed  Exception | JException | boolean
     *
     * @since   1.6
     */
    public function processResetRequest($data)
    {
        $config = JFactory::getConfig();
        // Get the form.
        $form = $this->getForm();
        $data['email'] = JStringPunycode::emailToPunycode($data['email']);
        // Check for an error.
        if ($form instanceof Exception) {
            return $form;
        }
        // Filter and validate the form data.
        $data = $form->filter($data);
        $return = $form->validate($data);
        // Check for an error.
        if ($return instanceof Exception) {
            return $return;
        }
        // Check the validation results.
        if ($return === false) {
            // Get the validation messages from the form.
            foreach ($form->getErrors() as $formError) {
                $this->setError($formError->getMessage());
            }
            return false;
        }
        // Find the user id for the given email address.
        $db = $this->getDbo();
        $query = $db->getQuery(true)->select('id')->from($db->quoteName('#__users'))->where($db->quoteName('email') . ' = ' . $db->quote($data['email']));
        // Get the user object.
        $db->setQuery($query);
        try {
            $userId = $db->loadResult();
        } catch (RuntimeException $e) {
            $this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
            return false;
        }
        // Check for a user.
        if (empty($userId)) {
            $this->setError(JText::_('COM_USERS_INVALID_EMAIL'));
            return false;
        }
        // Get the user object.
        $user = JUser::getInstance($userId);
        // Make sure the user isn't blocked.
        if ($user->block) {
            $this->setError(JText::_('COM_USERS_USER_BLOCKED'));
            return false;
        }
        // Make sure the user isn't a Super Admin.
        if ($user->authorise('core.admin')) {
            $this->setError(JText::_('COM_USERS_REMIND_SUPERADMIN_ERROR'));
            return false;
        }
        // Make sure the user has not exceeded the reset limit
        if (!$this->checkResetLimit($user)) {
            $resetLimit = (int) JFactory::getApplication()->getParams()->get('reset_time');
            $this->setError(JText::plural('COM_USERS_REMIND_LIMIT_ERROR_N_HOURS', $resetLimit));
            return false;
        }
        // Set the confirmation token.
        $token = JApplicationHelper::getHash(JUserHelper::genRandomPassword());
        $salt = JUserHelper::getSalt('crypt-md5');
        $hashedToken = md5($token . $salt) . ':' . $salt;
        $user->activation = $hashedToken;
        // Save the user to the database.
        if (!$user->save(true)) {
            return new JException(JText::sprintf('COM_USERS_USER_SAVE_FAILED', $user->getError()), 500);
        }
        // Assemble the password reset confirmation link.
        $mode = $config->get('force_ssl', 0) == 2 ? 1 : -1;
        $itemid = UsersHelperRoute::getLoginRoute();
        $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
        $link = 'index.php?option=com_users&view=reset&layout=confirm&token=' . $token . $itemid;
        // Put together the email template data.
        $data = $user->getProperties();
        $data['fromname'] = $config->get('fromname');
        $data['mailfrom'] = $config->get('mailfrom');
        $data['sitename'] = $config->get('sitename');
        $data['link_text'] = JRoute::_($link, false, $mode);
        $data['link_html'] = JRoute::_($link, true, $mode);
        $data['token'] = $token;
        $subject = JText::sprintf('COM_USERS_EMAIL_PASSWORD_RESET_SUBJECT', $data['sitename']);
        /*$body = JText::sprintf(
        			'COM_USERS_EMAIL_PASSWORD_RESET_BODY',
        			$data['sitename'],
        			$data['token'],
        			$data['link_text']
        		);*/
        $serverurl = $_SERVER['HTTP_HOST'];
        $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width; maximum-scale=1.0;">
<title>RAS</title>

<style type="text/css">
 body{ margin:0px; padding:0px;}
@media only screen and (max-width:598px){
table[class="mainWd"]{ width:100% !important; }
.img{ width:100% !important; }
}
@media only screen and (max-width:599px){
table{ float:none !important; }
table[class="mainWd"]{ width:100% !important; }
table[class="table-width"]{ float:left !important}
.img{ width:100% !important; }
@media only screen and (max-width:480px){
td[class="wd660"]{ width:100% !important; float:left !important; text-align:center !important; }
.img1{ display:none !important}
td[class="wd360"]{ width:100% !important; float:left !important; text-align:center; margin-bottom:20px; }	
table[class="full_480"]{ width:220px !important;  text-align:center !important;  float:none !important;  }	
td[class="mob_hide"]{ display:none !important; }
}
 
.img {width:100% !important; }
.img {width:100% !important; }
</style>
</head>

<body style="background:#cccccc;-moz-text-size-adjust:none; -webkit-text-size-adjust:none; -ms-text-size-adjust:none;  ">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr><td align="center">
	<table width="650" border="0" align="center" cellpadding="0" cellspacing="0" class="mainWd" >
    
<tr><td height="25" align="center" valign="middle" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#ffffff; background:#2a4c75">Can’t see this email? View it in your browser. </td></tr> 
    

  
  
  <tr>
    <td align="left" valign="top" class="bg" bgcolor="#ffffff">
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    
<tr>    <td height="20" align="left" valign="top"> <img src="http://' . $serverurl . '/images/banner123.jpg" alt=" " class="img" border="0" align="left" style="display:block;width:100%"></td>    </tr>
 
    
     
     <tr><td height="20" align="center" valign="top"> </td></tr>
     
     <tr><td   align="center" valign="top">
       <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
       <tr><td align="left" valign="top"><span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; color:#343434; font-weight:normal;">Dear <span style="color:#343434;text-transform:capitalize;">' . $data['name'] . ',</span><br /><br />We have received a request regarding the change of your password.</span>
<br /><br />

<span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; color:#343434; font-weight:normal;">The verification code is - </span> ' . $data['token'] . ' <br /> <br />
<span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; color:#343434; font-weight:normal;">Please ignore this mail if you don’t want to reset your password.</span></td></tr> 
<tr><td height="20" align="center" valign="top"> </td></tr>
<tr><td align="left" valign="top">
<span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; color:#343434; font-weight:normal;">Best regards,<br /> 
Team RAS</span>
 
 </td></tr>

 <tr><td height="20" align="center" valign="top"> </td></tr>
</table>
      </td>   
  </table>


</td>
 
   
	 
 
       <tr> <td align="center" valign="middle" height="37 " bgcolor="#2a4c75" > <span style="font-family:Arial, Helvetica, sans-serif; font-size:12px  ; color:#ffffff;-webkit-text-size-adjust: none;">Copyright © 2015. RAS All rights reserved </span></td>  
         </tr> 
     

  
  
  </table>
  </td>
  </tr>
<tr>
  <td align="center">&nbsp;</td>
</tr>
</table>

</body>
</html>';
        $mailer = JFactory::getMailer();
        $config = JFactory::getConfig();
        $subject = 'Forgot Password Request';
        $from = $config->get('mailfrom');
        $fromname = $config->get('fromname');
        $to = $user->email;
        $sender = array($from, $fromname);
        $mailer->isHTML(true);
        $mailer->setSender($sender);
        $mailer->addRecipient($to);
        $mailer->Encoding = 'base64';
        $mailer->setSubject($subject);
        $mailer->setBody($body);
        $return = $mailer->Send();
        // Check for an error.
        if ($return !== true) {
            return new JException(JText::_('COM_USERS_MAIL_FAILED'), 500);
        }
        return true;
    }
示例#24
0
				<button type="submit" tabindex="0" name="Submit" class="btn btn-info btn-sm" style="border-radius: 0px; text-transform: uppercase; margin-top: -123px; margin-left: 870px"><?php 
echo JText::_('JLOGIN');
?>
</button>
			</div>
		</div>
		<?php 
$usersConfig = JComponentHelper::getParams('com_users');
?>
			<ul class="unstyled">
			<?php 
if ($usersConfig->get('allowUserRegistration')) {
    ?>
				<li>
					<a href="<?php 
    echo JRoute::_('index.php?option=com_users&view=registration&Itemid=' . UsersHelperRoute::getRegistrationRoute());
    ?>
">
					<?php 
    echo JText::_('MOD_LOGIN_REGISTER');
    ?>
 <span class="icon-arrow-right"></span></a>
				</li>
			<?php 
}
?>
			</ul>
		<input type="hidden" name="option" value="com_users" />
		<input type="hidden" name="task" value="user.login" />
		<input type="hidden" name="return" value="<?php 
echo $return;
示例#25
0
    /**
     * Send the remind username email
     *
     * @param   array  $data  Array with the data received from the form
     *
     * @return  boolean
     *
     * @since   1.6
     */
    public function processRemindRequest($data)
    {
        // Get the form.
        $form = $this->getForm();
        $data['email'] = JStringPunycode::emailToPunycode($data['email']);
        // Check for an error.
        if (empty($form)) {
            return false;
        }
        // Validate the data.
        $data = $this->validate($form, $data);
        // Check for an error.
        if ($data instanceof Exception) {
            return false;
        }
        // Check the validation results.
        if ($data === false) {
            // Get the validation messages from the form.
            foreach ($form->getErrors() as $formError) {
                $this->setError($formError->getMessage());
            }
            return false;
        }
        // Find the user id for the given email address.
        $db = $this->getDbo();
        $query = $db->getQuery(true)->select('*')->from($db->quoteName('#__users'))->where($db->quoteName('email') . ' = ' . $db->quote($data['email']));
        // Get the user id.
        $db->setQuery($query);
        try {
            $user = $db->loadObject();
        } catch (RuntimeException $e) {
            $this->setError(JText::sprintf('COM_USERS_DATABASE_ERROR', $e->getMessage()), 500);
            return false;
        }
        // Check for a user.
        if (empty($user)) {
            $this->setError(JText::_('COM_USERS_USER_NOT_FOUND'));
            return false;
        }
        // Make sure the user isn't blocked.
        if ($user->block) {
            $this->setError(JText::_('COM_USERS_USER_BLOCKED'));
            return false;
        }
        $config = JFactory::getConfig();
        // Assemble the login link.
        $itemid = UsersHelperRoute::getLoginRoute();
        $itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
        $link = 'index.php?option=com_users&view=login' . $itemid;
        $mode = $config->get('force_ssl', 0) == 2 ? 1 : -1;
        // Put together the email template data.
        $data = JArrayHelper::fromObject($user);
        $data['fromname'] = $config->get('fromname');
        $data['mailfrom'] = $config->get('mailfrom');
        $data['sitename'] = $config->get('sitename');
        $data['link_text'] = JRoute::_($link, false, $mode);
        $data['link_html'] = JRoute::_($link, true, $mode);
        $subject = JText::sprintf('COM_USERS_EMAIL_USERNAME_REMINDER_SUBJECT', $data['sitename']);
        /* $body = JText::sprintf(
        			'COM_USERS_EMAIL_USERNAME_REMINDER_BODY',
        			$data['sitename'],
        			$data['username'],
        			$data['link_text']
        		); */
        $serverurl = $_SERVER['HTTP_HOST'];
        ######################## Costume User name Remind Email Templates By Vishal  ##################
        $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width; maximum-scale=1.0;">
<title>RAS</title>

<style type="text/css">
 body{ margin:0px; padding:0px;}
@media only screen and (max-width:598px){
table[class="mainWd"]{ width:100% !important; }
.img{ width:100% !important; }
}
@media only screen and (max-width:599px){
table{ float:none !important; }
table[class="mainWd"]{ width:100% !important; }
table[class="table-width"]{ float:left !important}
.img{ width:100% !important; }
@media only screen and (max-width:480px){
td[class="wd660"]{ width:100% !important; float:left !important; text-align:center !important; }
.img1{ display:none !important}
td[class="wd360"]{ width:100% !important; float:left !important; text-align:center; margin-bottom:20px; }	
table[class="full_480"]{ width:220px !important;  text-align:center !important;  float:none !important;  }	
td[class="mob_hide"]{ display:none !important; }
}
 
.img {width:100% !important; }
.img {width:100% !important; }
</style>
</head>

<body style="background:#cccccc;-moz-text-size-adjust:none; -webkit-text-size-adjust:none; -ms-text-size-adjust:none;  ">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr><td align="center">
	<table width="650" border="0" align="center" cellpadding="0" cellspacing="0" class="mainWd" >
    
<tr><td height="25" align="center" valign="middle" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#ffffff; background:#2a4c75">Can’t see this email? View it in your browser. </td></tr> 
    

  
  
  <tr>
    <td align="left" valign="top" class="bg" bgcolor="#ffffff">
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    
<tr>    <td height="20" align="left" valign="top"> <img src="http://' . $serverurl . '/images/banner123.jpg" alt=" " class="img" border="0" align="left" style="display:block;width:100%"></td>    </tr>
 
    
     
     <tr><td height="20" align="center" valign="top"> </td></tr>
     
     <tr><td   align="center" valign="top">
       <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
       <tr><td align="left" valign="top"><span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; color:#343434; font-weight:normal;">Dear <span style="color:#343434; text-transform:capitalize;">' . $data['name'] . ',</span><br /><br /> Please find your username below.</span>
<br /><br />

<span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; color:#343434; font-weight:normal;">
<strong style="color:#f77635">Username:</strong> ' . $data['name'] . ' </span><br />

  
</td></tr> 
  
 

  <tr><td height="20" align="center" valign="top"> </td></tr>
<tr><td align="left" valign="top">
<span style="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px; color:#343434; font-weight:normal;">Best regards,<br /> 
Team RAS</span>
 
 </td></tr>

 <tr><td height="20" align="center" valign="top"> </td></tr>
</table>
      </td>    
       </tr>
  </table>


</td>
 
   
	 
 
       <tr> <td align="center" valign="middle" height="37 " bgcolor="#2a4c75" > <span style="font-family:Arial, Helvetica, sans-serif; font-size:12px  ; color:#ffffff;-webkit-text-size-adjust: none;">Copyright © 2015. RAS All rights reserved </span></td>  
         </tr> 
     

  
  
  </table>
  </td>
  </tr>
<tr>
  <td align="center">&nbsp;</td>
</tr>
</table>

</body>
</html> ';
        $mailer = JFactory::getMailer();
        $config = JFactory::getConfig();
        $subject = 'Forgot Username Request';
        $from = $config->get('mailfrom');
        $fromname = $config->get('fromname');
        $to = $user->email;
        $sender = array($from, $fromname);
        $mailer->isHTML(true);
        $mailer->setSender($sender);
        $mailer->addRecipient($to);
        $mailer->Encoding = 'base64';
        $mailer->setSubject($subject);
        $mailer->setBody($body);
        $return = $mailer->Send();
        #################################################################
        // Send the password reset request email.
        //$return = JFactory::getMailer()->sendMail($data['mailfrom'], $data['fromname'], $user->email, $subject, $body);
        // Check for an error.
        if ($return !== true) {
            $this->setError(JText::_('COM_USERS_MAIL_FAILED'), 500);
            return false;
        }
        return true;
    }
示例#26
0
    public function renders()
    {
        ob_start();
        $path = CANVASPath::getPath('tpls/widgets/' . $this->name . '.php');
        if ($path) {
            include $path;
        } else {
            ?>
				<!-- LOGIN -->
					 <!-- login trigger modal -->
							<?php 
            $user = JFactory::getUser();
            $type = !$user->get('guest') ? 'logout' : 'login';
            ?>
						<div class="canvas-widget login-widget">	
							<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#canvasWidget<?php 
            echo $type;
            ?>
">
							  <i class="fa fa-sign-<?php 
            echo $type == 'login' ? 'in' : 'out';
            ?>
"></i>
							</button>
							<div class="modal fade" id="canvasWidgetlogin" tabindex="-1" role="dialog" aria-labelledby="canvasWidget<?php 
            echo $type;
            ?>
Label" aria-hidden="true">
								<div class="modal-dialog">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
											<h4 class="modal-title" id="canvasWidget<?php 
            echo $type;
            ?>
Label"><?php 
            echo JText::_('JLOGIN');
            ?>
</h4>
										</div>
										<div class="modal-body">
											<form class="form-horizontal" role="form" action="<?php 
            echo JRoute::_('index.php', true);
            ?>
" method="post">
											  <div class="form-group">
												<label for="inputUsername" class="col-sm-4 control-label">
													<?php 
            echo JText::_('USER_NAME');
            ?>
													 <a class="hasTooltip" href="<?php 
            echo JRoute::_('index.php?option=com_users&view=remind');
            ?>
" title="<?php 
            echo JText::_('FORGOT_YOUR_USERNAME');
            ?>
">
													<i class="fa fa-question-circle"></i>
													</a>
												</label>
												
												<div class="col-sm-8">
												  <input type="text" name="username" class="form-control" id="inputUsername" placeholder="Username">
												 
												</div>
											  </div>
											  <div class="form-group">
												<label for="inputUserPassword" class="col-sm-4 control-label"><?php 
            echo JText::_('PASSWORD');
            ?>
													 <a class="hasTooltip" href="<?php 
            echo JRoute::_('index.php?option=com_users&view=reset');
            ?>
" title="<?php 
            echo JText::_('FORGOT_YOUR_PASSWORD');
            ?>
">
													<i class="fa fa-question-circle"></i>
													</a>
												</label>
												<div class="col-sm-8">
												  <input type="password" class="form-control" id="inputUserPassword" name="password" placeholder="Password">
												</div>
											  </div>
											   <?php 
            if (JPluginHelper::isEnabled('system', 'remember')) {
                ?>
												  <div class="form-group">
													<div class="col-sm-offset-2 col-sm-10">
														<div class="checkbox">
															<label>
															  <input type="checkbox" name="remember" > <?php 
                echo JText::_('REMEMBER_ME');
                ?>
															</label>
														</div>
													</div>
												</div>
												<?php 
            }
            ?>
												
												 <div class="form-group">
												<div class="col-sm-offset-2 col-sm-10">
												  <input type="hidden" name="option" value="com_users" />
													<input type="hidden" name="task" value="user.login" />
													<input type="hidden" name="return" value="<?php 
            echo base64_encode(JRoute::_('index.php', true));
            ?>
" />
													<?php 
            echo JHtml::_('form.token');
            ?>
													<button type="submit" class="btn btn-default"><?php 
            echo JText::_('JLOGIN');
            ?>
</button>
													
													  <?php 
            require_once JPATH_SITE . '/components/com_users/helpers/route.php';
            $usersConfig = JComponentHelper::getParams('com_users');
            if ($usersConfig->get('allowUserRegistration')) {
                ?>
														<a class="btn btn-default" href="<?php 
                echo JRoute::_('index.php?option=com_users&view=registration&Itemid=' . UsersHelperRoute::getRegistrationRoute());
                ?>
">
															<?php 
                echo JText::_('JREGISTER');
                ?>
 <span class="fa fa-arrow-right"></span></a>
												<?php 
            }
            ?>
											
													
													
												</div>
											  </div>
											</form>
										</div>
										<div class="modal-footer">
											<button type="button" class="btn btn-default" data-dismiss="modal"><?php 
            echo JText::_('JCLOSE');
            ?>
</button>
										</div>
									</div>
								</div>
							</div>
							
							<div class="modal fade" id="canvasWidgetlogout" tabindex="-1" role="dialog" aria-labelledby="canvasWidget<?php 
            echo $type;
            ?>
Label" aria-hidden="true">
								<div class="modal-dialog">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
											<h4 class="modal-title" id="canvasWidget<?php 
            echo $type;
            ?>
Label"><?php 
            echo JText::_('JLOGOUT');
            ?>
</h4>
										</div>
										<div class="modal-body">
											<form class="form-horizontal" role="form" action="<?php 
            echo JRoute::_('index.php?option=com_users', true);
            ?>
" method="post">
												<div class="form-group">
													
													<div class="col-md-12 logout-button">
														
														<button type="submit" class="btn btn-default"><?php 
            echo JText::_('JLOGOUT');
            ?>
</button>
														
														<input type="hidden" name="option" value="com_users">
														<input type="hidden" name="task" value="user.logout">
														<input type="hidden" name="return" value="<?php 
            echo base64_encode(JRoute::_('index.php', true));
            ?>
" />
														<?php 
            echo JHtml::_('form.token');
            ?>
													</div>
												</div>
											</form>
										</div>
										<div class="modal-footer">
											<button type="button" class="btn btn-default" data-dismiss="modal"><?php 
            echo JText::_('JCLOSE');
            ?>
</button>
										</div>
									</div>
								</div>
							</div>
						</div>
				<!-- //LOGIN -->
			<?php 
        }
        return ob_get_clean();
    }
示例#27
0
    public function renders()
    {
        JHtml::_('bootstrap.tooltip');
        $CANVASTemplate = new CANVASTemplate();
        $path = CANVASPath::getPath('tpls/widgets/' . $this->name . '.php');
        ob_start();
        if ($path) {
            include $path;
        } else {
            ?>

				<!-- MAIN NAVIGATION -->
				<div id="canvas-mainnav" class="wrap navbar navbar-default <?php 
            echo $this->getParam('navigation_fixed_top', '0') ? 'navbar-fixed-top' : '';
            ?>
 canvas-mainnav">
					
					<?php 
            if ($this->getParam('navigation_fixed_top', '0')) {
                ?>
					<div class="container">
					<?php 
            }
            ?>
					
					<!-- NAVBAR HEADER -->
					<div class="navbar-header">
						
						<?php 
            if ($this->getParam('load_head_logo_nav', 1)) {
                // get params
                $sitename = $this->params->get('sitename');
                $slogan = $this->params->get('slogan', '');
                $logotype = $this->params->get('logotype', 'text');
                $logoimage = $logotype == 'image' ? $this->params->get('logoimage', 'templates/' . CANVAS_TEMPLATE . '/images/logo.png') : '';
                $logoimgsm = $logotype == 'image' && $this->params->get('enable_logoimage_sm', 0) ? $this->params->get('logoimage_sm', '') : false;
                if (!$sitename) {
                    $sitename = JFactory::getConfig()->get('sitename');
                }
                ?>
						<!-- LOGO IN NAVBAR -->
							<!-- LOGO -->
							<div class="logo logo-<?php 
                echo $logotype;
                ?>
">
								<div class="logo-<?php 
                echo $logotype, $logoimgsm ? ' logo-control' : '';
                ?>
">
									<a href="<?php 
                echo JURI::base(true);
                ?>
" title="<?php 
                echo strip_tags($sitename);
                ?>
">
										<?php 
                if ($logotype == 'image') {
                    ?>
											<img class="logo-img" src="<?php 
                    echo JURI::base(true) . '/' . $logoimage;
                    ?>
" alt="<?php 
                    echo strip_tags($sitename);
                    ?>
" />
										<?php 
                }
                ?>
										
										<?php 
                if ($logoimgsm) {
                    ?>
											<img class="logo-img-sm" src="<?php 
                    echo JURI::base(true) . '/' . $logoimgsm;
                    ?>
" alt="<?php 
                    echo strip_tags($sitename);
                    ?>
" />
										<?php 
                }
                ?>
										<?php 
                if ($logotype == 'image') {
                    echo '<span class="hide-text">';
                }
                ?>
										
										<?php 
                if (strpos($sitename, '::') !== false) {
                    $sitenameTitle = explode('::', $sitename);
                    $sitenameTitle = $sitenameTitle[0] . "<span>" . $sitenameTitle[1] . "</span>";
                } else {
                    $sitenameTitle = $sitename;
                }
                ?>
										<?php 
                echo $sitenameTitle;
                ?>
										
										<?php 
                if ($logotype == 'image') {
                    echo '</span>';
                }
                ?>
									</a>
									<?php 
                echo $slogan ? '<span class="site-slogan">' . $slogan . '</span>' : '';
                ?>
								</div>
							</div>
							<!-- //LOGO -->
						<!-- //LOGO IN NAVBAR -->
						<?php 
            }
            ?>
						
						<?php 
            if ($this->getParam('load_head_search_nav', 1)) {
                ?>
						<!-- HEAD SEARCH -->
						<div class="head-search <?php 
                $this->_c('head-search');
                ?>
">     
						  <jdoc:include type="modules" name="<?php 
                $this->_p('head-search');
                ?>
" style="raw" />
						</div>
						<!-- //HEAD SEARCH -->
						<?php 
            }
            ?>
						
						<?php 
            if ($this->getParam('load_head_login_nav', 1)) {
                ?>
						<!-- HEAD SEARCH -->
						<div class="head-login <?php 
                $this->_c('login');
                ?>
">     
						  <!-- login trigger modal -->
							<?php 
                $user = JFactory::getUser();
                $type = !$user->get('guest') ? 'logout' : 'login';
                ?>
							<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#canvasWidget<?php 
                echo $type;
                ?>
">
							  <i class="fa fa-sign-<?php 
                echo $type == 'login' ? 'in' : 'out';
                ?>
"></i>
							</button>
							<div class="modal fade" id="canvasWidgetlogin" tabindex="-1" role="dialog" aria-labelledby="canvasWidget<?php 
                echo $type;
                ?>
Label" aria-hidden="true">
								<div class="modal-dialog">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
											<h4 class="modal-title" id="canvasWidget<?php 
                echo $type;
                ?>
Label"><?php 
                echo JText::_('JLOGIN');
                ?>
</h4>
										</div>
										<div class="modal-body">
											<form class="form-horizontal" role="form" action="<?php 
                echo JRoute::_('index.php', true);
                ?>
" method="post">
											  <div class="form-group">
												<label for="inputUsername" class="col-sm-4 control-label">
													<?php 
                echo JText::_('USER_NAME');
                ?>
													 <a class="hasTooltip" href="<?php 
                echo JRoute::_('index.php?option=com_users&view=remind');
                ?>
" title="<?php 
                echo JText::_('FORGOT_YOUR_USERNAME');
                ?>
">
													<i class="fa fa-question-circle"></i>
													</a>
												</label>
												
												<div class="col-sm-8">
												  <input type="text" name="username" class="form-control" id="inputUsername" placeholder="Username">
												 
												</div>
											  </div>
											  <div class="form-group">
												<label for="inputUserPassword" class="col-sm-4 control-label"><?php 
                echo JText::_('PASSWORD');
                ?>
													 <a class="hasTooltip" href="<?php 
                echo JRoute::_('index.php?option=com_users&view=reset');
                ?>
" title="<?php 
                echo JText::_('FORGOT_YOUR_PASSWORD');
                ?>
">
													<i class="fa fa-question-circle"></i>
													</a>
												</label>
												<div class="col-sm-8">
												  <input type="password" class="form-control" id="inputUserPassword" name="password" placeholder="Password">
												</div>
											  </div>
											   <?php 
                if (JPluginHelper::isEnabled('system', 'remember')) {
                    ?>
												  <div class="form-group">
													<div class="col-sm-offset-2 col-sm-10">
														<div class="checkbox">
															<label>
															  <input type="checkbox" name="remember" > <?php 
                    echo JText::_('REMEMBER_ME');
                    ?>
															</label>
														</div>
													</div>
												</div>
												<?php 
                }
                ?>
												
												 <div class="form-group">
												<div class="col-sm-offset-2 col-sm-10">
												  <input type="hidden" name="option" value="com_users" />
													<input type="hidden" name="task" value="user.login" />
													<input type="hidden" name="return" value="<?php 
示例#28
0
 /**
  * @return string
  */
 public function getRemindURL()
 {
     $Itemid = UsersHelperRoute::getRemindRoute();
     return JRoute::_('index.php?option=com_users&view=remind' . ($Itemid ? "&Itemid={$Itemid}" : ''));
 }