mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Login and some routes fixed.
This commit is contained in:
@@ -5,34 +5,38 @@ use Illuminate\Contracts\Auth\Guard;
|
|||||||
use Illuminate\Contracts\Auth\Registrar;
|
use Illuminate\Contracts\Auth\Registrar;
|
||||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||||
|
|
||||||
class AuthController extends Controller {
|
class AuthController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Registration & Login Controller
|
| Registration & Login Controller
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This controller handles the registration of new users, as well as the
|
| This controller handles the registration of new users, as well as the
|
||||||
| authentication of existing users. By default, this controller uses
|
| authentication of existing users. By default, this controller uses
|
||||||
| a simple trait to add these behaviors. Why don't you explore it?
|
| a simple trait to add these behaviors. Why don't you explore it?
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use AuthenticatesAndRegistersUsers;
|
use AuthenticatesAndRegistersUsers;
|
||||||
|
|
||||||
/**
|
public $redirectTo = '/';
|
||||||
* Create a new authentication controller instance.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
|
||||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct(Guard $auth, Registrar $registrar)
|
|
||||||
{
|
|
||||||
$this->auth = $auth;
|
|
||||||
$this->registrar = $registrar;
|
|
||||||
|
|
||||||
$this->middleware('guest', ['except' => 'getLogout']);
|
/**
|
||||||
}
|
* Create a new authentication controller instance.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||||
|
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(Guard $auth, Registrar $registrar)
|
||||||
|
{
|
||||||
|
$this->auth = $auth;
|
||||||
|
$this->registrar = $registrar;
|
||||||
|
|
||||||
|
$this->middleware('guest', ['except' => 'getLogout']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -136,13 +136,19 @@ Route::group(
|
|||||||
//Route::any('/transactions/unrelate/{tj}', ['uses' => 'TransactionController@unrelate', 'as' => 'transactions.unrelate']);
|
//Route::any('/transactions/unrelate/{tj}', ['uses' => 'TransactionController@unrelate', 'as' => 'transactions.unrelate']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User Controller
|
* Auth\Auth Controller
|
||||||
* TODO move to AuthController
|
|
||||||
*/
|
*/
|
||||||
Route::get('/logout', ['uses' => 'UserController@logout', 'as' => 'logout']);
|
Route::get('/logout', ['uses' => 'Auth\AuthController@getLogout', 'as' => 'logout']);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auth\AuthController
|
||||||
|
*/
|
||||||
|
Route::get('/register', ['uses' => 'Auth\AuthController@getRegister', 'as' => 'register']);
|
||||||
|
|
||||||
Route::controllers(
|
Route::controllers(
|
||||||
[
|
[
|
||||||
'auth' => 'Auth\AuthController',
|
'auth' => 'Auth\AuthController',
|
||||||
|
@@ -1,39 +1,44 @@
|
|||||||
<?php namespace FireflyIII\Services;
|
<?php namespace FireflyIII\Services;
|
||||||
|
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Validator;
|
|
||||||
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
|
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
|
||||||
|
use Validator;
|
||||||
|
|
||||||
class Registrar implements RegistrarContract {
|
class Registrar implements RegistrarContract
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a validator for an incoming registration request.
|
* Create a new user instance after a valid registration.
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return \Illuminate\Contracts\Validation\Validator
|
*
|
||||||
*/
|
* @return User
|
||||||
public function validator(array $data)
|
*/
|
||||||
{
|
public function create(array $data)
|
||||||
return Validator::make($data, [
|
{
|
||||||
'name' => 'required|max:255',
|
return User::create(
|
||||||
'email' => 'required|email|max:255|unique:users',
|
[
|
||||||
'password' => 'required|confirmed|min:6',
|
'email' => $data['email'],
|
||||||
]);
|
'password' => bcrypt($data['password']),
|
||||||
}
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new user instance after a valid registration.
|
* Get a validator for an incoming registration request.
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return User
|
*
|
||||||
*/
|
* @return \Illuminate\Contracts\Validation\Validator
|
||||||
public function create(array $data)
|
*/
|
||||||
{
|
public function validator(array $data)
|
||||||
return User::create([
|
{
|
||||||
'name' => $data['name'],
|
return Validator::make(
|
||||||
'email' => $data['email'],
|
$data, [
|
||||||
'password' => bcrypt($data['password']),
|
'email' => 'required|email|max:255|unique:users',
|
||||||
]);
|
'password' => 'required|confirmed|min:6',
|
||||||
}
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -63,5 +63,6 @@ return [
|
|||||||
'table' => 'password_resets',
|
'table' => 'password_resets',
|
||||||
'expire' => 60,
|
'expire' => 60,
|
||||||
],
|
],
|
||||||
|
'allow_register' => true
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@@ -1,63 +1,51 @@
|
|||||||
@extends('app')
|
@extends('layouts.guest')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-8 col-md-offset-2">
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">Login</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
@if (count($errors) > 0)
|
|
||||||
<div class="alert alert-danger">
|
|
||||||
<strong>Whoops!</strong> There were some problems with your input.<br><br>
|
|
||||||
<ul>
|
|
||||||
@foreach ($errors->all() as $error)
|
|
||||||
<li>{{ $error }}</li>
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<form class="form-horizontal" role="form" method="POST" action="/auth/login">
|
@if($errors->has('email'))
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
<div class="form-group">
|
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||||
<label class="col-md-4 control-label">E-Mail Address</label>
|
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||||
<div class="col-md-6">
|
<strong>Error!</strong> {{$errors->get('email')[0]}}
|
||||||
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-4 control-label">Password</label>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="password" class="form-control" name="password">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-6 col-md-offset-4">
|
|
||||||
<div class="checkbox">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" name="remember"> Remember Me
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-6 col-md-offset-4">
|
|
||||||
<button type="submit" class="btn btn-primary" style="margin-right: 15px;">
|
|
||||||
Login
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<a href="/password/email">Forgot Your Password?</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 col-md-offset-4">
|
||||||
|
<div class="login-panel panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Firefly III — Sign In</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
<form role="form" method="POST" id="login" action="/auth/login">
|
||||||
|
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="email" class="form-control" id="inputEmail" name="email" placeholder="E-mail">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="password" class="form-control" id="inputPassword" name="password" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="remember" value="1"> Remember me
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<button type="submit" class="btn btn-lg btn-success btn-block">Login</button>
|
||||||
|
</p>
|
||||||
|
<div class="btn-group btn-group-justified btn-group-sm">
|
||||||
|
@if(Config::get('auth.allow_register') === true)
|
||||||
|
<a href="{{route('register')}}" class="btn btn-default">Register</a>
|
||||||
|
@endif
|
||||||
|
<a href="/password/email" class="btn btn-default">Forgot your password?</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@stop
|
||||||
|
@@ -1,12 +1,14 @@
|
|||||||
@extends('app')
|
@extends('layouts.guest')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8 col-md-offset-2">
|
<div class="col-md-4 col-md-offset-4">
|
||||||
<div class="panel panel-default">
|
<div class="login-panel panel panel-default">
|
||||||
<div class="panel-heading">Register</div>
|
<div class="panel-heading">Firefly III — Register</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
<p>
|
||||||
|
Registering an account on Firefly requires an e-mail address.
|
||||||
|
</p>
|
||||||
@if (count($errors) > 0)
|
@if (count($errors) > 0)
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
<strong>Whoops!</strong> There were some problems with your input.<br><br>
|
<strong>Whoops!</strong> There were some problems with your input.<br><br>
|
||||||
@@ -18,35 +20,22 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<form class="form-horizontal" role="form" method="POST" action="/auth/register">
|
<form role="form" id="register" method="POST" action="/auth/register">
|
||||||
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
<input type="hidden" name="_token" value="{{ csrf_token() }}">
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-4 control-label">Name</label>
|
<label class="control-label">E-Mail Address</label>
|
||||||
<div class="col-md-6">
|
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
|
||||||
<input type="text" class="form-control" name="name" value="{{ old('name') }}">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-4 control-label">E-Mail Address</label>
|
<label class="control-label">Password</label>
|
||||||
<div class="col-md-6">
|
<input type="password" class="form-control" name="password">
|
||||||
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-4 control-label">Password</label>
|
<label class="control-label">Confirm Password</label>
|
||||||
<div class="col-md-6">
|
<input type="password" class="form-control" name="password_confirmation">
|
||||||
<input type="password" class="form-control" name="password">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-4 control-label">Confirm Password</label>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<input type="password" class="form-control" name="password_confirmation">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@@ -7,10 +7,10 @@
|
|||||||
<base href="{{URL::route('index')}}/">
|
<base href="{{URL::route('index')}}/">
|
||||||
<title>Firefly III</title>
|
<title>Firefly III</title>
|
||||||
|
|
||||||
<link rel="stylesheet" href="assets/stylesheets/bootstrap/bootstrap.min.css" type="text/css" media="all" />
|
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" media="all" />
|
||||||
<link rel="stylesheet" href="assets/stylesheets/metisMenu/metisMenu.min.css" type="text/css" media="all" />
|
<link rel="stylesheet" href="css/metisMenu.min.css" type="text/css" media="all" />
|
||||||
<link rel="stylesheet" href="assets/stylesheets/sbadmin/sb.css" type="text/css" media="all" />
|
<link rel="stylesheet" href="css/sb.css" type="text/css" media="all" />
|
||||||
<link rel="stylesheet" href="assets/stylesheets/fa/css/font-awesome.min.css" type="text/css" media="all" />
|
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" type="text/css" media="all" />
|
||||||
|
|
||||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||||
@@ -42,5 +42,7 @@
|
|||||||
@include('partials.flashes')
|
@include('partials.flashes')
|
||||||
@yield('content')
|
@yield('content')
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript" src="js/jquery-2.1.3.min.js"></script>
|
||||||
|
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user