Files
firefly-iii/app/Http/Controllers/Auth/AuthController.php

85 lines
1.8 KiB
PHP
Raw Normal View History

<?php
/**
* AuthController.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
2016-02-05 12:08:25 +01:00
declare(strict_types = 1);
namespace FireflyIII\Http\Controllers\Auth;
2015-02-06 04:39:52 +01:00
2015-02-06 04:52:16 +01:00
use FireflyIII\Http\Controllers\Controller;
2015-05-27 07:27:05 +02:00
use FireflyIII\User;
2015-02-06 04:39:52 +01:00
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
2015-07-14 22:48:34 +02:00
use Illuminate\Foundation\Auth\ThrottlesLogins;
2015-06-11 21:19:40 +02:00
use Validator;
2015-02-06 04:39:52 +01:00
/**
* Class AuthController
*
* @package FireflyIII\Http\Controllers\Auth
*/
2015-02-07 22:50:47 +01:00
class AuthController extends Controller
{
2015-07-14 22:48:34 +02:00
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
2015-11-01 08:03:41 +01:00
/**
* Where to redirect users after login / registration.
2015-11-01 08:03:41 +01:00
*
* @var string
2015-11-01 08:03:41 +01:00
*/
protected $redirectTo = '/home';
/**
* Create a new authentication controller instance.
*
*/
public function __construct()
{
$this->middleware('guest', ['except' => 'logout']);
parent::__construct();
2015-11-01 08:03:41 +01:00
}
2016-03-18 20:29:51 +01:00
2016-01-19 18:10:07 +01:00
/**
* Create a new user instance after a valid registration.
*
* @param array $data
*
* @return User
*/
protected function create(array $data)
{
return User::create(
[
'email' => $data['email'],
'password' => bcrypt($data['password']),
]
);
}
2016-01-19 18:10:07 +01:00
/**
* Get a validator for an incoming registration request.
*
* @param array $data
*
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make(
$data, [
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]
);
}
2016-03-18 20:29:51 +01:00
2016-09-16 09:02:35 +02:00
2015-02-06 04:39:52 +01:00
}