Merge pull request #1615 from pixelfed/staging

Update Register view
This commit is contained in:
daniel 2019-08-17 01:49:34 -06:00 committed by GitHub
commit 5117a9c161
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 39 additions and 26 deletions

View file

@ -76,7 +76,7 @@ class RegisterController extends Controller
'name' => 'required|string|max:'.config('pixelfed.max_name_length'), 'name' => 'required|string|max:'.config('pixelfed.max_name_length'),
'username' => $usernameRules, 'username' => $usernameRules,
'email' => 'required|string|email|max:255|unique:users', 'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed', 'password' => 'required|string|min:8|confirmed',
]; ];
return Validator::make($data, $rules); return Validator::make($data, $rules);
@ -123,14 +123,17 @@ class RegisterController extends Controller
*/ */
public function showRegistrationForm() public function showRegistrationForm()
{ {
$count = User::count(); if(config('pixelfed.open_registration')) {
$limit = config('pixelfed.max_users'); $limit = config('pixelfed.max_users');
if($limit && $limit <= $count) { if($limit) {
$view = 'site.closed-registration'; abort_if($limit <= User::count(), 404);
return view('auth.register');
} else { } else {
$view = config('pixelfed.open_registration') == true ? 'auth.register' : 'site.closed-registration'; return view('auth.register');
}
} else {
abort(404);
} }
return view($view);
} }
/** /**

View file

@ -10,7 +10,8 @@ class ProfileSponsorController extends Controller
{ {
public function get(Request $request, $id) public function get(Request $request, $id)
{ {
$res = ProfileSponsor::whereProfileId($id)->firstOrFail()->sponsors; $profile = ProfileSponsor::whereProfileId($id)->first();
return response($res)->header('Content-Type', 'application/json'); $res = $profile ? $profile->sponsors : [];
return response()->json($res);
} }
} }

View file

@ -269,6 +269,7 @@ class PublicApiController extends Controller
'local', 'local',
'reply_count', 'reply_count',
'comments_disabled', 'comments_disabled',
'place_id',
'created_at', 'created_at',
'updated_at' 'updated_at'
)->where('id', $dir, $id) )->where('id', $dir, $id)
@ -299,6 +300,7 @@ class PublicApiController extends Controller
'reply_count', 'reply_count',
'comments_disabled', 'comments_disabled',
'created_at', 'created_at',
'place_id',
'updated_at' 'updated_at'
)->whereIn('type', ['photo', 'photo:album', 'video', 'video:album']) )->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
->with('profile', 'hashtags', 'mentions') ->with('profile', 'hashtags', 'mentions')
@ -377,6 +379,7 @@ class PublicApiController extends Controller
'local', 'local',
'reply_count', 'reply_count',
'comments_disabled', 'comments_disabled',
'place_id',
'created_at', 'created_at',
'updated_at' 'updated_at'
)->whereIn('type', ['photo', 'photo:album', 'video', 'video:album']) )->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
@ -405,6 +408,7 @@ class PublicApiController extends Controller
'local', 'local',
'reply_count', 'reply_count',
'comments_disabled', 'comments_disabled',
'place_id',
'created_at', 'created_at',
'updated_at' 'updated_at'
)->whereIn('type', ['photo', 'photo:album', 'video', 'video:album']) )->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
@ -523,7 +527,9 @@ class PublicApiController extends Controller
public function relationships(Request $request) public function relationships(Request $request)
{ {
abort_if(!Auth::check(), 403); if(!Auth::check()) {
return response()->json([]);
}
$this->validate($request, [ $this->validate($request, [
'id' => 'required|array|min:1|max:20', 'id' => 'required|array|min:1|max:20',

View file

@ -403,4 +403,9 @@ class Status extends Model
return $res[$audience]; return $res[$audience];
} }
public function place()
{
return $this->belongsTo(Place::class);
}
} }

View file

@ -103,7 +103,7 @@ class Inbox
public function actorFirstOrCreate($actorUrl) public function actorFirstOrCreate($actorUrl)
{ {
return Helpers::profileFirstOrNew($actorUrl); return Helpers::profileFetch($actorUrl);
} }
public function handleCreateActivity() public function handleCreateActivity()

View file

@ -131,7 +131,7 @@ class Image
$quality = config('pixelfed.image_quality'); $quality = config('pixelfed.image_quality');
$img->save($newPath, $quality); $img->save($newPath, $quality);
$img->destroy();
if (!$thumbnail) { if (!$thumbnail) {
$media->orientation = $orientation; $media->orientation = $orientation;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

View file

@ -3,26 +3,17 @@
@section('content') @section('content')
<div class="container mt-4"> <div class="container mt-4">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6 col-lg-7 mb-3"> <div class="col-lg-5">
<div class="card">
<div class="card-body text-center">
<p class="h4 font-weight-bold pt-5">A Photo Sharing Experience For Everyone</p>
<div class="p-5 mb-5">
<img src="/img/Macbook__ipad__iphone.svg" width="100%">
</div>
</div>
</div>
</div>
<div class="col-md-6 col-lg-5">
<div class="card"> <div class="card">
<div class="card-header bg-white p-3 text-center font-weight-bold">{{ __('Register a new account') }}</div> <div class="card-header bg-white p-3 text-center font-weight-bold">{{ __('Register a new account') }}</div>
<div class="card-body"> <div class="card-body">
<form method="POST" action="{{ route('register') }}" class="px-5"> <form method="POST" action="{{ route('register') }}" class="px-md-3">
@csrf @csrf
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<label class="small font-weight-bold text-lighter">Name</label>
<input id="name" type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name') }}" placeholder="{{ __('Name') }}" required autofocus> <input id="name" type="text" class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" value="{{ old('name') }}" placeholder="{{ __('Name') }}" required autofocus>
@if ($errors->has('name')) @if ($errors->has('name'))
@ -35,6 +26,7 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<label class="small font-weight-bold text-lighter">Username</label>
<input id="username" type="text" class="form-control{{ $errors->has('username') ? ' is-invalid' : '' }}" name="username" value="{{ old('username') }}" placeholder="{{ __('Username') }}" required> <input id="username" type="text" class="form-control{{ $errors->has('username') ? ' is-invalid' : '' }}" name="username" value="{{ old('username') }}" placeholder="{{ __('Username') }}" required>
@if ($errors->has('username')) @if ($errors->has('username'))
@ -47,6 +39,7 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<label class="small font-weight-bold text-lighter">Email</label>
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" placeholder="{{ __('E-Mail Address') }}" required> <input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" placeholder="{{ __('E-Mail Address') }}" required>
@if ($errors->has('email')) @if ($errors->has('email'))
@ -59,6 +52,7 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<label class="small font-weight-bold text-lighter">Password</label>
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" placeholder="{{ __('Password') }}" required> <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" placeholder="{{ __('Password') }}" required>
@if ($errors->has('password')) @if ($errors->has('password'))
@ -71,10 +65,13 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<label class="small font-weight-bold text-lighter">Confirm Password</label>
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" placeholder="{{ __('Confirm Password') }}" required> <input id="password-confirm" type="password" class="form-control" name="password_confirmation" placeholder="{{ __('Confirm Password') }}" required>
</div> </div>
</div> </div>
<p class="small">By signing up, you agree to our <a href="{{route('site.terms')}}" class="font-weight-bold text-dark">Terms of Use</a> and <a href="{{route('site.privacy')}}" class="font-weight-bold text-dark">Privacy Policy</a>.</p>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold"> <button type="submit" class="btn btn-primary btn-block py-0 font-weight-bold">
@ -82,7 +79,6 @@
</button> </button>
</div> </div>
</div> </div>
<p class="mb-0 font-weight-bold text-lighter small">By signing up, you agree to our <a href="{{route('site.terms')}}" class="text-muted">Terms of Use</a> and <a href="{{route('site.privacy')}}" class="text-muted">Privacy Policy</a>.</p>
</form> </form>
</div> </div>
</div> </div>

View file

@ -20,9 +20,11 @@
@endauth @endauth
@guest @guest
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<li><a class="nav-link font-weight-bold text-primary" href="{{ route('login') }}" title="Login">{{ __('Login') }}</a></li> <li><a class="nav-link font-weight-bold text-primary" href="{{ route('login') }}" title="Login">{{ __('Login') }}</a></li>
<li><a class="nav-link font-weight-bold" href="{{ route('register') }}" title="Register">{{ __('Register') }}</a></li> @if(config('pixelfed.open_registration'))
<li><a class="nav-link font-weight-bold" href="{{ route('register') }}" title="Register">{{ __('Register') }}</a></li>@endif
@else @else
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
<div class="d-none d-md-block"> <div class="d-none d-md-block">