/** * Run the command. */ public function fire() { $name = $this->ask('Please provide a username (defaults to admin)', 'admin'); $email = $this->ask('Please provide your email (defaults to user@example.com)', '*****@*****.**'); $password = $this->ask('Please provide a password (defaults to password)', 'password'); $authModel = config('auth.model'); if (!get_class($authProvider = \Auth::getProvider()) === \Illuminate\Auth\EloquentUserProvider::class || !($authModel = $authProvider->getModel())) { $this->warn('To create a new admin user you must use Eloquent as your Auth Provider'); return; } if ((new $authModel())->create(['name' => $name, 'email' => $email, 'password' => bcrypt($password)])) { $this->info('All done!'); return; } $this->error('Something went wrong... Please try again.'); }
/** * Render login page * * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View */ public function loginPage() { /** * Ip address authentication. * Please move to closure in 'auth' filter defined in filters.php */ if ($user = Auth::getProvider()->retrieveByIpAddress()) { Auth::login($user); } /** * If authentication already passed, redirect to homepage (named route 'home') */ if (Auth::check()) { return Redirect::home(); } return View::make('auth.login'); }
<?php return array('grant_types' => array('authorization_code' => array('class' => 'League\\OAuth2\\Server\\Grant\\AuthCode', 'access_token_ttl' => 3600, 'auth_token_ttl' => 3600), 'password' => array('class' => 'League\\OAuth2\\Server\\Grant\\Password', 'access_token_ttl' => 604800, 'callback' => function ($username, $password) { $credentials = array('email' => $username, 'password' => $password); $valid = Auth::validate($credentials); if (!$valid) { return false; } return Auth::getProvider()->retrieveByCredentials($credentials)->id; }), 'refresh_token' => array('class' => 'League\\OAuth2\\Server\\Grant\\RefreshToken', 'access_token_ttl' => 3600, 'refresh_token_ttl' => 604800, 'rotate_refresh_tokens' => false)), 'state_param' => false, 'scope_param' => false, 'scope_delimiter' => ',', 'default_scope' => 'basic', 'access_token_ttl' => 3600, 'limit_clients_to_grants' => false, 'limit_clients_to_scopes' => false, 'limit_scopes_to_grants' => false, 'http_headers_only' => false);
/** * Page belongs to Author. * * @return */ public function author() { return $this->belongsTo(config('auth.model') ? config('auth.model') : \Auth::getProvider()->getModel(), 'author_id'); }