mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-22 06:23:12 -06:00
Auth and password controller.
This commit is contained in:
parent
a2a39ee0f8
commit
355862025a
@ -15,4 +15,5 @@ EMAIL_SMTP=
|
|||||||
EMAIL_DRIVER=smtp
|
EMAIL_DRIVER=smtp
|
||||||
EMAIL_USERNAME=
|
EMAIL_USERNAME=
|
||||||
EMAIL_PASSWORD=
|
EMAIL_PASSWORD=
|
||||||
ANALYTICS_ID=
|
ANALYTICS_ID=
|
||||||
|
EMAIL_PRETEND=false
|
@ -14,4 +14,5 @@ SESSION_DRIVER=array
|
|||||||
EMAIL_SMTP=
|
EMAIL_SMTP=
|
||||||
EMAIL_USERNAME=
|
EMAIL_USERNAME=
|
||||||
EMAIL_PASSWORD=
|
EMAIL_PASSWORD=
|
||||||
ANALYTICS_ID=ABC
|
ANALYTICS_ID=ABC
|
||||||
|
EMAIL_PRETEND=true
|
@ -38,6 +38,7 @@ class AuthController extends Controller
|
|||||||
*
|
*
|
||||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||||
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function __construct(Guard $auth, Registrar $registrar)
|
public function __construct(Guard $auth, Registrar $registrar)
|
||||||
@ -51,7 +52,9 @@ class AuthController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Show the application login form.
|
* Show the application login form.
|
||||||
*
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function getLogin()
|
public function getLogin()
|
||||||
{
|
{
|
||||||
@ -73,7 +76,9 @@ class AuthController extends Controller
|
|||||||
$this->throwValidationException(
|
$this->throwValidationException(
|
||||||
$request, $validator
|
$request, $validator
|
||||||
);
|
);
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
}
|
}
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
$data['password'] = bcrypt($data['password']);
|
$data['password'] = bcrypt($data['password']);
|
||||||
|
@ -7,7 +7,7 @@ use Illuminate\Foundation\Auth\ResetsPasswords;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PasswordController
|
* Class PasswordController
|
||||||
*
|
* @codeCoverageIgnore
|
||||||
* @package FireflyIII\Http\Controllers\Auth
|
* @package FireflyIII\Http\Controllers\Auth
|
||||||
*/
|
*/
|
||||||
class PasswordController extends Controller
|
class PasswordController extends Controller
|
||||||
|
@ -119,6 +119,6 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'pretend' => false,
|
'pretend' => env('EMAIL_PRETEND', false),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
68
tests/controllers/AuthControllerTest.php
Normal file
68
tests/controllers/AuthControllerTest.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
use League\FactoryMuffin\Facade as FactoryMuffin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AuthControllerTest
|
||||||
|
*/
|
||||||
|
class AuthControllerTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Sets up the fixture, for example, opens a network connection.
|
||||||
|
* This method is called before a test is executed.
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
FactoryMuffin::create('FireflyIII\User');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called before the first test of this test class is run.
|
||||||
|
*
|
||||||
|
* @since Method available since Release 3.4.0
|
||||||
|
*/
|
||||||
|
public static function setUpBeforeClass()
|
||||||
|
{
|
||||||
|
parent::setUpBeforeClass();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tears down the fixture, for example, closes a network connection.
|
||||||
|
* This method is called after a test is executed.
|
||||||
|
*/
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPostRegister()
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'email' => 'test@example.com',
|
||||||
|
'password' => 'onetwothree',
|
||||||
|
'password_confirmation' => 'onetwothree',
|
||||||
|
'_token' => 'replaceMe'
|
||||||
|
];
|
||||||
|
$this->call('POST', '/auth/register', $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
$this->assertSessionHas('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPostRegisterFails()
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'email' => 'test@example.com',
|
||||||
|
'password' => 'onetwothree',
|
||||||
|
'password_confirmation' => 'onetwofour',
|
||||||
|
'_token' => 'replaceMe'
|
||||||
|
];
|
||||||
|
$this->call('POST', '/auth/register', $data);
|
||||||
|
$this->assertResponseStatus(302);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user