mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-29 16:00:45 +00:00
Fix postgres bugs
This commit is contained in:
parent
c78bdadb8a
commit
14ba350ba3
3 changed files with 17 additions and 5 deletions
|
@ -53,6 +53,10 @@ class RegisterController extends Controller
|
|||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
if(config('database.default') == 'pgsql') {
|
||||
$data['username'] = strtolower($data['username']);
|
||||
}
|
||||
|
||||
$this->validateUsername($data['username']);
|
||||
$this->validateEmail($data['email']);
|
||||
|
||||
|
@ -105,6 +109,10 @@ class RegisterController extends Controller
|
|||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
if(config('database.default') == 'pgsql') {
|
||||
$data['username'] = strtolower($data['username']);
|
||||
}
|
||||
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'username' => $data['username'],
|
||||
|
|
|
@ -22,6 +22,10 @@ class ProfileController extends Controller
|
|||
{
|
||||
public function show(Request $request, $username)
|
||||
{
|
||||
if(config('database.default') == 'pgsql') {
|
||||
$username = strtolower($username);
|
||||
}
|
||||
|
||||
$user = Profile::whereNull('domain')
|
||||
->whereNull('status')
|
||||
->whereUsername($username)
|
||||
|
|
|
@ -412,14 +412,14 @@ class Helpers {
|
|||
$profile = Profile::whereRemoteUrl($res['id'])->first();
|
||||
if(!$profile) {
|
||||
$profile = new Profile();
|
||||
$profile->domain = $domain;
|
||||
$profile->username = (string) Purify::clean($remoteUsername);
|
||||
$profile->domain = strtolower($domain);
|
||||
$profile->username = strtolower(Purify::clean($remoteUsername));
|
||||
$profile->name = isset($res['name']) ? Purify::clean($res['name']) : 'user';
|
||||
$profile->bio = isset($res['summary']) ? Purify::clean($res['summary']) : null;
|
||||
$profile->sharedInbox = isset($res['endpoints']) && isset($res['endpoints']['sharedInbox']) ? $res['endpoints']['sharedInbox'] : null;
|
||||
$profile->inbox_url = $res['inbox'];
|
||||
$profile->outbox_url = $res['outbox'];
|
||||
$profile->remote_url = $res['id'];
|
||||
$profile->inbox_url = strtolower($res['inbox']);
|
||||
$profile->outbox_url = strtolower($res['outbox']);
|
||||
$profile->remote_url = strtolower($res['id']);
|
||||
$profile->public_key = $res['publicKey']['publicKeyPem'];
|
||||
$profile->key_id = $res['publicKey']['id'];
|
||||
$profile->save();
|
||||
|
|
Loading…
Reference in a new issue