Skip to content

Commit

Permalink
add back checks
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 11, 2018
2 parents e2faacc + f377f9b commit 25974ab
Show file tree
Hide file tree
Showing 46 changed files with 480 additions and 107 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Auth/Console/stubs/make/views/auth/login.stub
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="card-header">{{ __('Login') }}</div>

<div class="card-body">
<form method="POST" action="{{ route('login') }}">
<form method="POST" action="{{ route('login') }}" aria-label="{{ __('Login') }}">
@csrf

<div class="form-group row">
Expand All @@ -18,7 +18,7 @@
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autofocus>

@if ($errors->has('email'))
<span class="invalid-feedback">
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
Expand All @@ -32,7 +32,7 @@
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>

@if ($errors->has('password'))
<span class="invalid-feedback">
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

<div class="card-body">
@if (session('status'))
<div class="alert alert-success">
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif

<form method="POST" action="{{ route('password.email') }}">
<form method="POST" action="{{ route('password.email') }}" aria-label="{{ __('Reset Password') }}">
@csrf

<div class="form-group row">
Expand All @@ -24,7 +24,7 @@
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required>

@if ($errors->has('email'))
<span class="invalid-feedback">
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="card-header">{{ __('Reset Password') }}</div>

<div class="card-body">
<form method="POST" action="{{ route('password.update') }}">
<form method="POST" action="{{ route('password.update') }}" aria-label="{{ __('Reset Password') }}">
@csrf

<input type="hidden" name="token" value="{{ $token }}">
Expand All @@ -20,7 +20,7 @@
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ $email ?? old('email') }}" required autofocus>

@if ($errors->has('email'))
<span class="invalid-feedback">
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
Expand All @@ -34,7 +34,7 @@
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>

@if ($errors->has('password'))
<span class="invalid-feedback">
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="card-header">{{ __('Register') }}</div>

<div class="card-body">
<form method="POST" action="{{ route('register') }}">
<form method="POST" action="{{ route('register') }}" aria-label="{{ __('Register') }}">
@csrf

<div class="form-group row">
Expand All @@ -18,7 +18,7 @@
<input id="name" type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name') }}" required autofocus>

@if ($errors->has('name'))
<span class="invalid-feedback">
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
Expand All @@ -32,7 +32,7 @@
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required>

@if ($errors->has('email'))
<span class="invalid-feedback">
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
Expand All @@ -46,7 +46,7 @@
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>

@if ($errors->has('password'))
<span class="invalid-feedback">
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Auth/Console/stubs/make/views/home.stub
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div class="card-body">
@if (session('status'))
<div class="alert alert-success">
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<a class="navbar-brand" href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
<span class="navbar-toggler-icon"></span>
</button>

Expand Down
10 changes: 10 additions & 0 deletions src/Illuminate/Auth/GuardHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ public function authenticate()
throw new AuthenticationException;
}

/**
* Determine if the guard has a user instance.
*
* @return bool
*/
public function hasUser()
{
return ! is_null($this->user);
}

/**
* Determine if the current user is authenticated.
*
Expand Down
4 changes: 1 addition & 3 deletions src/Illuminate/Cache/ArrayStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class ArrayStore extends TaggableStore implements Store
*/
public function get($key)
{
if (array_key_exists($key, $this->storage)) {
return $this->storage[$key];
}
return $this->storage[$key] ?? null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Scheduling/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Event
/**
* Create a new event instance.
*
* @param \Illuminate\Console\Scheduling\Mutex $mutex
* @param \Illuminate\Console\Scheduling\EventMutex $mutex
* @param string $command
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Console/Migrations/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected function getMigrationPaths()
}

return array_merge(
[$this->getMigrationPath()], $this->migrator->paths()
$this->migrator->paths(), [$this->getMigrationPath()]
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ protected function isCustomDateTimeCast($cast)
*
* @param string $key
* @param mixed $value
* @return $this
* @return mixed
*/
public function setAttribute($key, $value)
{
Expand Down
15 changes: 14 additions & 1 deletion src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ public function relationLoaded($key)
}

/**
* Set the specific relationship in the model.
* Set the given relationship on the model.
*
* @param string $relation
* @param mixed $value
Expand All @@ -706,6 +706,19 @@ public function setRelation($relation, $value)
return $this;
}

/**
* Unset a loaded relationship.
*
* @param string $relation
* @return $this
*/
public function unsetRelation($relation)
{
unset($this->relations[$relation]);

return $this;
}

/**
* Set the entire relations array on the model.
*
Expand Down
4 changes: 1 addition & 3 deletions src/Illuminate/Database/Eloquent/Relations/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,7 @@ protected static function buildMorphMapFromModels(array $models = null)
*/
public static function getMorphedModel($alias)
{
return array_key_exists($alias, self::$morphMap)
? self::$morphMap[$alias]
: null;
return self::$morphMap[$alias] ?? null;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/Illuminate/Database/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

namespace Illuminate\Database;

use Illuminate\Support\Traits\Macroable;
use Illuminate\Database\Query\Expression;

abstract class Grammar
{
use Macroable;

/**
* The grammar table prefix.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ public function whereJsonContains($column, $value, $boolean = 'and', $not = fals
$this->wheres[] = compact('type', 'column', 'value', 'boolean', 'not');

if (! $value instanceof Expression) {
$this->addBinding(json_encode($value));
$this->addBinding($this->grammar->prepareBindingForJsonContains($value));
}

return $this;
Expand Down
11 changes: 11 additions & 0 deletions src/Illuminate/Database/Query/Grammars/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,17 @@ protected function compileJsonContains($column, $value)
throw new RuntimeException('This database engine does not support JSON contains operations.');
}

/**
* Prepare the binding for a "JSON contains" statement.
*
* @param mixed $binding
* @return string
*/
public function prepareBindingForJsonContains($binding)
{
return json_encode($binding);
}

/**
* Compile the "group by" portions of the query.
*
Expand Down
27 changes: 27 additions & 0 deletions src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,33 @@ protected function whereDate(Builder $query, $where)
return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value;
}

/**
* Compile a "JSON contains" statement into SQL.
*
* @param string $column
* @param string $value
* @return string
*/
protected function compileJsonContains($column, $value)
{
$from = $column[0] == '['
? 'openjson('.$column.')'
: substr_replace($column, 'openjson', 0, strlen('json_value'));

return $value.' in (select [value] from '.$from.')';
}

/**
* Prepare the binding for a "JSON contains" statement.
*
* @param mixed $binding
* @return string
*/
public function prepareBindingForJsonContains($binding)
{
return is_bool($binding) ? json_encode($binding) : $binding;
}

/**
* Create a full ANSI offset clause for the query.
*
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Filesystem/FilesystemManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,13 @@ protected function adapt(FilesystemInterface $filesystem)
*
* @param string $name
* @param mixed $disk
* @return void
* @return $this
*/
public function set($name, $disk)
{
$this->disks[$name] = $disk;

return $this;
}

/**
Expand Down
15 changes: 15 additions & 0 deletions src/Illuminate/Foundation/Testing/TestResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ public function assertSuccessful()
return $this;
}

/**
* Assert that the response has a 200 status code.
*
* @return $this
*/
public function assertOk()
{
PHPUnit::assertTrue(
$this->isOk(),
'Response status code ['.$this->getStatusCode().'] does not match expected 200 status code.'
);

return $this;
}

/**
* Assert that the response has a not found status code.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ function resource_path($path = '')
/**
* Return a new response from the application.
*
* @param string $content
* @param string|array $content
* @param int $status
* @param array $headers
* @return \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Routing\ResponseFactory
Expand Down
34 changes: 34 additions & 0 deletions src/Illuminate/Hashing/AbstractHasher.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Illuminate\Hashing;

abstract class AbstractHasher
{
/**
* Get information about the given hashed value.
*
* @param string $hashedValue
* @return array
*/
public function info($hashedValue)
{
return password_get_info($hashedValue);
}

/**
* Check the given plain value against a hash.
*
* @param string $value
* @param string $hashedValue
* @param array $options
* @return bool
*/
public function check($value, $hashedValue, array $options = [])
{
if (strlen($hashedValue) === 0) {
return false;
}

return password_verify($value, $hashedValue);
}
}
Loading

0 comments on commit 25974ab

Please sign in to comment.