diff options
| author | Camil Staps | 2016-09-25 23:56:46 +0200 | 
|---|---|---|
| committer | Camil Staps | 2016-09-26 01:02:05 +0200 | 
| commit | 33ad0c14d168d36a4e7ad42dc6aa6a37a7335849 (patch) | |
| tree | 0543b7d92f7f0b7706f4313ba10b18483f747798 /resources | |
| parent | Added unique visitors to statistics (diff) | |
Change from lumen 5.2 to laravel 5.3 (Resolves #1)
Diffstat (limited to 'resources')
| -rw-r--r-- | resources/lang/en/auth.php | 19 | ||||
| -rw-r--r-- | resources/lang/en/pagination.php | 19 | ||||
| -rw-r--r-- | resources/lang/en/passwords.php | 22 | ||||
| -rw-r--r-- | resources/lang/en/validation.php | 14 | ||||
| -rw-r--r-- | resources/views/.gitkeep | 0 | ||||
| -rw-r--r-- | resources/views/auth/login.blade.php | 68 | ||||
| -rw-r--r-- | resources/views/auth/passwords/email.blade.php | 47 | ||||
| -rw-r--r-- | resources/views/auth/passwords/reset.blade.php | 70 | ||||
| -rw-r--r-- | resources/views/auth/register.blade.php | 82 | ||||
| -rw-r--r-- | resources/views/contribute.blade.php | 4 | ||||
| -rw-r--r-- | resources/views/layouts/master.blade.php | 32 | ||||
| -rw-r--r-- | resources/views/stats.blade.php | 8 | ||||
| -rw-r--r-- | resources/views/trainer.blade.php | 6 | 
13 files changed, 371 insertions, 20 deletions
| diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php new file mode 100644 index 0000000..e5506df --- /dev/null +++ b/resources/lang/en/auth.php @@ -0,0 +1,19 @@ +<?php + +return [ + +    /* +    |-------------------------------------------------------------------------- +    | Authentication Language Lines +    |-------------------------------------------------------------------------- +    | +    | The following language lines are used during authentication for various +    | messages that we need to display to the user. You are free to modify +    | these language lines according to your application's requirements. +    | +    */ + +    'failed' => 'These credentials do not match our records.', +    'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', + +]; diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php new file mode 100644 index 0000000..fcab34b --- /dev/null +++ b/resources/lang/en/pagination.php @@ -0,0 +1,19 @@ +<?php + +return [ + +    /* +    |-------------------------------------------------------------------------- +    | Pagination Language Lines +    |-------------------------------------------------------------------------- +    | +    | The following language lines are used by the paginator library to build +    | the simple pagination links. You are free to change them to anything +    | you want to customize your views to better match your application. +    | +    */ + +    'previous' => '« Previous', +    'next'     => 'Next »', + +]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php new file mode 100644 index 0000000..e5544d2 --- /dev/null +++ b/resources/lang/en/passwords.php @@ -0,0 +1,22 @@ +<?php + +return [ + +    /* +    |-------------------------------------------------------------------------- +    | Password Reset Language Lines +    |-------------------------------------------------------------------------- +    | +    | The following language lines are the default lines which match reasons +    | that are given by the password broker for a password update attempt +    | has failed, such as for an invalid token or invalid new password. +    | +    */ + +    'password' => 'Passwords must be at least six characters and match the confirmation.', +    'reset' => 'Your password has been reset!', +    'sent' => 'We have e-mailed your password reset link!', +    'token' => 'This password reset token is invalid.', +    'user' => "We can't find a user with that e-mail address.", + +]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index ff1c087..73b49d0 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -34,13 +34,18 @@ return [      'different'            => 'The :attribute and :other must be different.',      'digits'               => 'The :attribute must be :digits digits.',      'digits_between'       => 'The :attribute must be between :min and :max digits.', +    'dimensions'           => 'The :attribute has invalid image dimensions.', +    'distinct'             => 'The :attribute field has a duplicate value.',      'email'                => 'The :attribute must be a valid email address.', -    'filled'               => 'The :attribute field is required.',      'exists'               => 'The selected :attribute is invalid.', +    'file'                 => 'The :attribute must be a file.', +    'filled'               => 'The :attribute field is required.',      'image'                => 'The :attribute must be an image.',      'in'                   => 'The selected :attribute is invalid.', +    'in_array'             => 'The :attribute field does not exist in :other.',      'integer'              => 'The :attribute must be an integer.',      'ip'                   => 'The :attribute must be a valid IP address.', +    'json'                 => 'The :attribute must be a valid JSON string.',      'max'                  => [          'numeric' => 'The :attribute may not be greater than :max.',          'file'    => 'The :attribute may not be greater than :max kilobytes.', @@ -48,6 +53,7 @@ return [          'array'   => 'The :attribute may not have more than :max items.',      ],      'mimes'                => 'The :attribute must be a file of type: :values.', +    'mimetypes'            => 'The :attribute must be a file of type: :values.',      'min'                  => [          'numeric' => 'The :attribute must be at least :min.',          'file'    => 'The :attribute must be at least :min kilobytes.', @@ -56,9 +62,11 @@ return [      ],      'not_in'               => 'The selected :attribute is invalid.',      'numeric'              => 'The :attribute must be a number.', +    'present'              => 'The :attribute field must be present.',      'regex'                => 'The :attribute format is invalid.',      'required'             => 'The :attribute field is required.',      'required_if'          => 'The :attribute field is required when :other is :value.', +    'required_unless'      => 'The :attribute field is required unless :other is in :values.',      'required_with'        => 'The :attribute field is required when :values is present.',      'required_with_all'    => 'The :attribute field is required when :values is present.',      'required_without'     => 'The :attribute field is required when :values is not present.', @@ -70,9 +78,11 @@ return [          'string'  => 'The :attribute must be :size characters.',          'array'   => 'The :attribute must contain :size items.',      ], +    'string'               => 'The :attribute must be a string.', +    'timezone'             => 'The :attribute must be a valid zone.',      'unique'               => 'The :attribute has already been taken.', +    'uploaded'             => 'The :attribute failed to upload.',      'url'                  => 'The :attribute format is invalid.', -    'timezone'             => 'The :attribute must be a valid zone.',      /*      |-------------------------------------------------------------------------- diff --git a/resources/views/.gitkeep b/resources/views/.gitkeep deleted file mode 100644 index e69de29..0000000 --- a/resources/views/.gitkeep +++ /dev/null diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php new file mode 100644 index 0000000..2070f2b --- /dev/null +++ b/resources/views/auth/login.blade.php @@ -0,0 +1,68 @@ +@extends('layouts.master') + +@section('master-content') +<div class="container"> +    <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"> +                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}"> +                        {{ csrf_field() }} + +                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> +                            <label for="email" class="col-md-4 control-label">E-Mail Address</label> + +                            <div class="col-md-6"> +                                <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus> + +                                @if ($errors->has('email')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('email') }}</strong> +                                    </span> +                                @endif +                            </div> +                        </div> + +                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}"> +                            <label for="password" class="col-md-4 control-label">Password</label> + +                            <div class="col-md-6"> +                                <input id="password" type="password" class="form-control" name="password" required> + +                                @if ($errors->has('password')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('password') }}</strong> +                                    </span> +                                @endif +                            </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-8 col-md-offset-4"> +                                <button type="submit" class="btn btn-primary"> +                                    Login +                                </button> + +                                <a class="btn btn-link" href="{{ url('/password/reset') }}"> +                                    Forgot Your Password? +                                </a> +                            </div> +                        </div> +                    </form> +                </div> +            </div> +        </div> +    </div> +</div> +@endsection diff --git a/resources/views/auth/passwords/email.blade.php b/resources/views/auth/passwords/email.blade.php new file mode 100644 index 0000000..62e0120 --- /dev/null +++ b/resources/views/auth/passwords/email.blade.php @@ -0,0 +1,47 @@ +@extends('layouts.master') + +<!-- Main Content --> +@section('master-content') +<div class="container"> +    <div class="row"> +        <div class="col-md-8 col-md-offset-2"> +            <div class="panel panel-default"> +                <div class="panel-heading">Reset Password</div> +                <div class="panel-body"> +                    @if (session('status')) +                        <div class="alert alert-success"> +                            {{ session('status') }} +                        </div> +                    @endif + +                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/email') }}"> +                        {{ csrf_field() }} + +                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> +                            <label for="email" class="col-md-4 control-label">E-Mail Address</label> + +                            <div class="col-md-6"> +                                <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required> + +                                @if ($errors->has('email')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('email') }}</strong> +                                    </span> +                                @endif +                            </div> +                        </div> + +                        <div class="form-group"> +                            <div class="col-md-6 col-md-offset-4"> +                                <button type="submit" class="btn btn-primary"> +                                    Send Password Reset Link +                                </button> +                            </div> +                        </div> +                    </form> +                </div> +            </div> +        </div> +    </div> +</div> +@endsection diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php new file mode 100644 index 0000000..deb4d56 --- /dev/null +++ b/resources/views/auth/passwords/reset.blade.php @@ -0,0 +1,70 @@ +@extends('layouts.master') + +@section('master-content') +<div class="container"> +    <div class="row"> +        <div class="col-md-8 col-md-offset-2"> +            <div class="panel panel-default"> +                <div class="panel-heading">Reset Password</div> + +                <div class="panel-body"> +                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/password/reset') }}"> +                        {{ csrf_field() }} + +                        <input type="hidden" name="token" value="{{ $token }}"> + +                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> +                            <label for="email" class="col-md-4 control-label">E-Mail Address</label> + +                            <div class="col-md-6"> +                                <input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" required autofocus> + +                                @if ($errors->has('email')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('email') }}</strong> +                                    </span> +                                @endif +                            </div> +                        </div> + +                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}"> +                            <label for="password" class="col-md-4 control-label">Password</label> + +                            <div class="col-md-6"> +                                <input id="password" type="password" class="form-control" name="password" required> + +                                @if ($errors->has('password')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('password') }}</strong> +                                    </span> +                                @endif +                            </div> +                        </div> + +                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}"> +                            <label for="password-confirm" class="col-md-4 control-label">Confirm Password</label> +                            <div class="col-md-6"> +                                <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required> + +                                @if ($errors->has('password_confirmation')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('password_confirmation') }}</strong> +                                    </span> +                                @endif +                            </div> +                        </div> + +                        <div class="form-group"> +                            <div class="col-md-6 col-md-offset-4"> +                                <button type="submit" class="btn btn-primary"> +                                    Reset Password +                                </button> +                            </div> +                        </div> +                    </form> +                </div> +            </div> +        </div> +    </div> +</div> +@endsection diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php new file mode 100644 index 0000000..c4f9009 --- /dev/null +++ b/resources/views/auth/register.blade.php @@ -0,0 +1,82 @@ +@extends('layouts.master') + +@section('master-content') +<div class="container"> +    <div class="row"> +        <div class="col-md-8 col-md-offset-2"> +            <div class="panel panel-default"> +                <div class="panel-heading">Register</div> +                <div class="panel-body"> +                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}"> +                        {{ csrf_field() }} + +                        <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}"> +                            <label for="name" class="col-md-4 control-label">Name</label> + +                            <div class="col-md-6"> +                                <input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required autofocus> + +                                @if ($errors->has('name')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('name') }}</strong> +                                    </span> +                                @endif +                            </div> +                        </div> + +                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> +                            <label for="email" class="col-md-4 control-label">E-Mail Address</label> + +                            <div class="col-md-6"> +                                <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required> + +                                @if ($errors->has('email')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('email') }}</strong> +                                    </span> +                                @endif +                            </div> +                        </div> + +                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}"> +                            <label for="password" class="col-md-4 control-label">Password</label> + +                            <div class="col-md-6"> +                                <input id="password" type="password" class="form-control" name="password" required> + +                                @if ($errors->has('password')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('password') }}</strong> +                                    </span> +                                @endif +                            </div> +                        </div> + +                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}"> +                            <label for="password-confirm" class="col-md-4 control-label">Confirm Password</label> + +                            <div class="col-md-6"> +                                <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required> + +                                @if ($errors->has('password_confirmation')) +                                    <span class="help-block"> +                                        <strong>{{ $errors->first('password_confirmation') }}</strong> +                                    </span> +                                @endif +                            </div> +                        </div> + +                        <div class="form-group"> +                            <div class="col-md-6 col-md-offset-4"> +                                <button type="submit" class="btn btn-primary"> +                                    Register +                                </button> +                            </div> +                        </div> +                    </form> +                </div> +            </div> +        </div> +    </div> +</div> +@endsection diff --git a/resources/views/contribute.blade.php b/resources/views/contribute.blade.php index 2e0eff3..6ddd37c 100644 --- a/resources/views/contribute.blade.php +++ b/resources/views/contribute.blade.php @@ -9,8 +9,8 @@ use HebrewParseTrainer\Verb;  </p>  @if(!Auth::check()) -	<a class="btn btn-lg btn-primary" href="{{ env('APP_URL') }}contribute?login=yes">Login</a> -	<a class="btn btn-lg btn-success" href="{{ env('APP_URL') }}user/create">Sign up</a> +	<a class="btn btn-lg btn-primary" href="{{ url('/login') }}">Login</a> +	<a class="btn btn-lg btn-success" href="{{ url('/register') }}">Sign up</a>  @endif  <h3>Here's how it works:</h3> diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php index 095fee9..5d244d0 100644 --- a/resources/views/layouts/master.blade.php +++ b/resources/views/layouts/master.blade.php @@ -28,18 +28,21 @@ $menu = [  if (Auth::check()) {  	$menu['Statistics'] = ['stats', 'stats']; -	$menu['Logout'] = ['logout', 'logout'];  }  ?>  <html lang="en">  	<head> -		<meta charset="utf-8"> +		<meta charset="utf-8"/> +		<meta name="csrf-token" content="{{ csrf_token() }}"/> +  		<title>ParseTrainer</title> -		<link rel="stylesheet" href="{{ env('APP_URL') }}vendor/twbs/bootstrap/dist/css/bootstrap.min.css"> -		<link rel="stylesheet" href="{{ env('APP_URL') }}public/css/hebrewparsetrainer.css"> + +		<link rel="stylesheet" href="{{ asset('vendor/twbs/bootstrap/dist/css/bootstrap.min.css') }}"/> +		<link rel="stylesheet" href="{{ asset('public/css/hebrewparsetrainer.css') }}"/>  		<script type="text/javascript">  			var app_url = '{{ env('APP_URL') }}'; +			window.Laravel = <?php echo json_encode([ 'csrfToken' => csrf_token() ]); ?>;  		</script>  	</head>  	<body role="application"> @@ -48,22 +51,29 @@ if (Auth::check()) {  				<nav>  					<ul class="nav nav-pills pull-right">  						@foreach($menu as $name => $link) -							<li role="presentation" class="{{ Request::is($link[0]) ? 'active' : '' }}"><a href="{{ env('APP_URL') }}{{ $link[1] }}">{{ $name }}</a></li> +							<li role="presentation" class="{{ Request::is($link[0]) ? 'active' : '' }}"><a href="{{ url($link[1]) }}">{{ $name }}</a></li>  						@endforeach +						@if(Auth::check()) +							<li role="presentation"><a href="{{ url('/logout') }}" onclick="event.preventDefault();document.getElementById('logout-form').submit();">Logout</a></li> +						@endif  					</ul>  				</nav> -				<h2 class="text-muted"><a href="{{ env('APP_URL') }}">ParseTrainer</a></h2> +				<h2 class="text-muted"><a href="{{ url('/') }}">ParseTrainer</a></h2>  			</div>  			@yield('master-content')  		</div> -		<script src="{{ env('APP_URL') }}vendor/components/jquery/jquery.min.js"></script> -		<script src="{{ env('APP_URL') }}vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script> -		<script src="{{ env('APP_URL') }}public/js/alerts.js"></script> -		<script src="{{ env('APP_URL') }}public/js/hebrewparsetrainer.js"></script> +		<script src="{{ asset('vendor/components/jquery/jquery.min.js') }}"></script> +		<script src="{{ asset('vendor/twbs/bootstrap/dist/js/bootstrap.min.js') }}"></script> +		<script src="{{ asset('public/js/alerts.js') }}"></script> +		<script src="{{ asset('public/js/hebrewparsetrainer.js') }}"></script>  		@if(Auth::check()) -			<script src="{{ env('APP_URL') }}public/js/moderators.js"></script> +			<script src="{{ asset('public/js/moderators.js') }}"></script> + +			<form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display:none;"> +				{{ csrf_field() }} +			</form>  		@endif  	</body>  </html> diff --git a/resources/views/stats.blade.php b/resources/views/stats.blade.php index 27010fd..eb4205f 100644 --- a/resources/views/stats.blade.php +++ b/resources/views/stats.blade.php @@ -2,7 +2,9 @@  use \HebrewParseTrainer\RandomLog;  $db_stats = RandomLog -	::select(DB::raw('COUNT(*) as count'), 'created_at') +	::select( +		DB::raw('COUNT(*) as count'), +		DB::raw('DATE(created_at) as created_at'))  	->groupBy(DB::raw('DATE(created_at)'))  	->orderBy('created_at')  	->get(); @@ -21,7 +23,9 @@ foreach ($db_stats as $stat) {  $stats['requests'] = "[" . implode(",", $stats['requests']) . "]";  $db_stats = RandomLog -	::select(DB::raw('COUNT(DISTINCT `ip`) as count'), 'created_at') +	::select( +		DB::raw('COUNT(DISTINCT `ip`) as count'), +		DB::raw('DATE(created_at) as created_at'))  	->groupBy(DB::raw('DATE(created_at)'))  	->orderBy('created_at')  	->get(); diff --git a/resources/views/trainer.blade.php b/resources/views/trainer.blade.php index 02d9964..f03254a 100644 --- a/resources/views/trainer.blade.php +++ b/resources/views/trainer.blade.php @@ -82,10 +82,10 @@ use HebrewParseTrainer\Tense;  				<h3 class="panel-title">Contribute!</h3>  			</div>  			<div class="panel-body"> -				<p>If this app is useful to you, please consider <a href="{{ env('APP_URL') }}contribute">contributing</a> by adding more verbs to the database!</p> +				<p>If this app is useful to you, please consider <a href="{{ url('/contribute') }}">contributing</a> by adding more verbs to the database!</p>  				@if(!Auth::check()) -					<a class="btn btn-success" href="{{ env('APP_URL') }}user/create">Sign up</a> -					or <a href="{{ env('APP_URL') }}contribute?login=yes">login</a> +					<a class="btn btn-success" href="{{ url('/register') }}">Sign up</a> +					or <a href="{{ url('/login') }}">login</a>  				@endif  			</div>  		</div> | 
