Пример #1
0
 * http://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to obtain it
 * through the world wide web, please send an email to
 * licensing@ellislab.com so we can send you a copy immediately.
 *
 * @package		CodeIgniter
 * @author		EllisLab Dev Team
 * @copyright	Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
 * @license		http://opensource.org/licenses/AFL-3.0 Academic Free License (AFL 3.0)
 * @link		http://codeigniter.com
 * @since		Version 1.0
 * @filesource
 */
defined('BASEPATH') or exit('No direct script access allowed');
use Myth\Route;
$routes = new Route();
/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
|	example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
Пример #2
0
        <div class="collapse navbar-collapse" id="main-nav-collapse">
            <a class="navbar-brand" href="<?php 
echo site_url();
?>
">SprintPHP</a>

                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <?php 
if (!empty($_SESSION['logged_in'])) {
    ?>
                            <a href="<?php 
    echo site_url(\Myth\Route::named('logout'));
    ?>
">Logout</a>
                        <?php 
} else {
    ?>
                            <a href="<?php 
    echo site_url(\Myth\Route::named('login'));
    ?>
">Login</a>
                        <?php 
}
?>
                    </li>
                </ul>
        </div>

    </div>
</header>
Пример #3
0
 /**
  * Ensures that the current user has at least one of the passed in
  * permissions. The permissions can be passed in either as ID's or names.
  * You can pass either a single item or an array of items.
  *
  * If the user does not have one of the permissions it will return
  * the user to the URI set in $url or the site root, and attempt
  * to set a status message.
  *
  * @param $permissions
  * @param string $uri   The URI to redirect to on fail.
  *
  * @return bool
  */
 public function restrictWithPermissions($permissions, $uri = '')
 {
     $this->setupAuthClasses();
     if ($this->authenticate->isLoggedIn()) {
         if ($this->authorize->hasPermission($permissions, $this->authenticate->id())) {
             return true;
         }
     }
     if (method_exists($this, 'setMessage')) {
         $this->setMessage(lang('auth.not_enough_privilege'));
     }
     if (empty($uri)) {
         redirect(\Myth\Route::named('login') . '?request_uri=' . current_url());
     }
     redirect($uri . '?request_uri=' . current_url());
 }
Пример #4
0
$lang['auth.invalid_credentials'] = 'Credentials used are not allowed.';
$lang['auth.too_many_credentials'] = 'Too many credentials were passed in. Must be limited to one besides password.';
$lang['auth.invalid_email'] = 'Unable to find a user with that email address.';
$lang['auth.invalid_password'] = '******';
$lang['auth.bruteBan_notice'] = "Your account has had excessive login attempts. To protect the account you must wait 15 minutes before another attempt can be made.";
$lang['auth.remember_label'] = 'Remember me on this device';
$lang['auth.email'] = 'Email Address';
$lang['auth.password'] = '******';
$lang['auth.pass_confirm'] = 'Password (Again)';
$lang['auth.signin'] = 'Sign In';
$lang['auth.register'] = 'Join Us!';
$lang['auth.password_strength'] = 'Password Strength';
$lang['auth.pass_not_strong'] = 'The Password must be stronger.';
$lang['auth.have_account'] = 'Already a member? <a href="' . site_url(\Myth\Route::named('login')) . '">Sign In</a>';
$lang['auth.need_account'] = 'Need an Account? <a href="' . site_url(\Myth\Route::named('register')) . '">Sign Up</a>';
$lang['auth.forgot_pass'] = '******' . site_url(\Myth\Route::named('forgot_pass')) . '">Forgot your Password?</a>';
$lang['auth.first_name'] = 'First Name';
$lang['auth.last_name'] = 'Last Name';
$lang['auth.username'] = '******';
$lang['auth.forgot'] = 'Forgot Password';
$lang['auth.forgot_note'] = 'No problem. Enter your email and we will send instructions.';
$lang['auth.send'] = 'Send';
$lang['auth.send_success'] = 'The email is on its way!';
$lang['auth.reset'] = 'Reset Password';
$lang['auth.reset_note'] = 'Please follow the instructions in the email to reset your password.';
$lang['auth.pass_code'] = 'Reset Code';
$lang['auth.new_password'] = '******';
$lang['auth.new_password_success'] = 'Your password has been changed. Please sign in.';
$lang['auth.force_change_note'] = 'You must select a new password.';
$lang['auth.current_password'] = '******';
$lang['auth.change_password'] = '******';
Пример #5
0
 /**
  * Sends the Password Reset Confirmation email.
  *
  * @param array  $user
  * @return bool
  */
 public function resetPassword($user)
 {
     $data = ['email' => $user['email'], 'link' => site_url(\Myth\Route::named('forgot_pass')), 'site_name' => config_item('site.name'), 'site_link' => site_url()];
     // Send it immediately - don't queue.
     return $this->send($user['email'], lang('auth.reset_subject'), $data);
 }