Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2ecc462c95
Fetching contributors…

Cannot retrieve contributors at this time

file 62 lines (48 sloc) 1.294 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
<?php

namespace NinjAuth;

use Auth;

class Adapter_SimpleAuth extends Adapter
{
public function is_logged_in()
{
return Auth::check();
}

public function get_user_id()
{
list($driver, $user_id) = Auth::instance()->get_user_id();
return $user_id;
}

public function force_login($user_id)
{
return Auth::instance()->force_login($authentication->user_id);
}

public function create_user(array $user)
{
try
{
$user_id = Auth::create_user(

// Username
isset($user['username']) ? $user['username'] : null,

// Password (random string will do if none provided)
isset($user['password']) ? $user['password'] : \Str::random(),

// Email address
isset($user['username']) ? $user['username'] : null,

// Which group are they?
\Config::get('ninjauth.default_group'),

// Extra information
array(

// Got their full name? Or first and last to make up a full name?
'full_name' => isset($user['full_name']) ? $user['full_name'] : (
isset($user['first_name'], $user['last_name']) ? $user['first_name'].' '.$user['last_name'] : null
),
)
);

return $user_id ?: false;
}
catch (SimpleUserUpdateException $e)
{
\Session::set_flash('ninjauth.error', $e->getMessage());
}

return false;
}
}
Something went wrong with that request. Please try again.