mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-03-14 12:29:44 +01:00
Merge pull request #18 from manavo/master
Login functionality, and some small things
This commit is contained in:
commit
e82c7d6e57
@ -5,7 +5,15 @@
|
||||
*/
|
||||
class AuthController extends Controller {
|
||||
public function showLogin() {
|
||||
return 'Coming soon...';
|
||||
return View::make('auth.login');
|
||||
}
|
||||
|
||||
public function postLogin() {
|
||||
if (Auth::attempt(Input::only(['email', 'password']))) {
|
||||
return Redirect::intended('dashboard');
|
||||
} else {
|
||||
return Redirect::back()->withInput(Input::except('password'))->with('error', 'Invalid email or password');
|
||||
}
|
||||
}
|
||||
|
||||
public function logoutAction() {
|
||||
|
@ -26,7 +26,7 @@
|
||||
$user = new User;
|
||||
$user->username = $userDetails['name'];
|
||||
$user->email = $userDetails['email'];
|
||||
$user->password = $userDetails['password'];
|
||||
$user->password = Hash::make($userDetails['password']);
|
||||
$user->save();
|
||||
|
||||
Auth::login($user);
|
||||
|
@ -10,7 +10,9 @@
|
||||
});
|
||||
});
|
||||
|
||||
Route::get('/auth/login', 'AuthController@showLogin');
|
||||
Route::get('/auth/login', 'AuthController@showLogin')->before('guest');
|
||||
Route::post('/auth/login', 'AuthController@postLogin')->before('guest|csrf');
|
||||
|
||||
Route::group(['before' => 'auth'], function() {
|
||||
// Dashboard/Management Panel etc.
|
||||
Route::get('/dashboard', 'DashboardController@showDashboard');
|
||||
|
35
app/views/auth/login.blade.php
Normal file
35
app/views/auth/login.blade.php
Normal file
@ -0,0 +1,35 @@
|
||||
@extends('layout.master')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-6 col-md-offset-3'>
|
||||
{{ Form::open() }}
|
||||
<fieldset>
|
||||
<legend>Login</legend>
|
||||
|
||||
@if(Session::has('error'))
|
||||
<span class='text-danger'>{{ Session::get('error') }}</span>
|
||||
@endif
|
||||
|
||||
<div class='form-group'>
|
||||
<label class='sr-only'>Email</label>
|
||||
{{ Form::email('email', Input::old('email'), [
|
||||
'class' => 'form-control', 'placeholder' => 'Email', 'required' => 'required'
|
||||
]) }}
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label class='sr-only'>Password</label>
|
||||
{{ Form::password('password', [
|
||||
'class' => 'form-control', 'placeholder' => 'Password', 'required' => 'required'
|
||||
]) }}
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<button type='submit' class='btn btn-default'>Login!</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
@ -25,7 +25,7 @@
|
||||
@if(Setting::get('show_support'))
|
||||
<hr />
|
||||
<div class='footer'>
|
||||
<p>{{ Setting::get('app_name') }} Status Page is powered by <a href='https://github.com/jbrooksuk/Cachet'>Cachet</a>.</p>
|
||||
<p>{{ Setting::get('app_name') }} Status Page is powered by <a href='https://github.com/jbrooksuk/Cachet' target="_blank">Cachet</a>.</p>
|
||||
</div>
|
||||
@endif
|
||||
@stop
|
||||
|
Loading…
x
Reference in New Issue
Block a user