1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Started social registration

This commit is contained in:
Dan Brown
2015-09-05 17:42:05 +01:00
parent 6b6f6d2c92
commit 2c3fb557d6
17 changed files with 390 additions and 250 deletions

View File

@ -37,7 +37,7 @@ class AuthController extends Controller
*/
public function __construct(SocialAuthService $socialAuthService)
{
$this->middleware('guest', ['only' => ['getLogin', 'postLogin']]);
$this->middleware('guest', ['only' => ['getLogin', 'postLogin', 'getRegister']]);
$this->socialAuthService = $socialAuthService;
}
@ -71,6 +71,17 @@ class AuthController extends Controller
]);
}
/**
* Show the application registration form.
*
* @return \Illuminate\Http\Response
*/
public function getRegister()
{
$socialDrivers = $this->socialAuthService->getActiveDrivers();
return view('auth.register', ['socialDrivers' => $socialDrivers]);
}
/**
* Show the application login form.
*
@ -84,7 +95,6 @@ class AuthController extends Controller
}
$socialDrivers = $this->socialAuthService->getActiveDrivers();
return view('auth.login', ['socialDrivers' => $socialDrivers]);
}

View File

@ -31,12 +31,12 @@ abstract class Controller extends BaseController
{
// Get a user instance for the current user
$user = auth()->user();
if (!$user) {
$user = User::getDefault();
}
if (!$user) $user = User::getDefault();
// Share variables with views
view()->share('signedIn', auth()->check());
view()->share('currentUser', $user);
// Share variables with controllers
$this->currentUser = $user;
$this->signedIn = auth()->check();
@ -53,7 +53,7 @@ abstract class Controller extends BaseController
if (!$this->currentUser || !$this->currentUser->can($permissionName)) {
Session::flash('error', trans('errors.permission'));
throw new HttpResponseException(
redirect()->back()
redirect('/')
);
}

View File

@ -152,6 +152,8 @@ class UserController extends Controller
return $this->currentUser->id == $id;
});
$user = $this->user->findOrFail($id);
// Delete social accounts
$user->socialAccounts()->delete();
$user->delete();
return redirect('/users');
}