Fixes #29: Usernames are now used to check if a Pony.fm account already exists. The username column was also renamed.

This commit is contained in:
Peter Deltchev 2015-11-20 18:25:11 -08:00
parent 9d0b2e598d
commit 8d7f36c375
8 changed files with 483 additions and 27 deletions

View file

@ -55,7 +55,7 @@ class SaveAccountSettingsCommand extends CommandBase
];
if ($this->_input['sync_names'] == 'true') {
$this->_input['display_name'] = $user->mlpforums_name;
$this->_input['display_name'] = $user->username;
}
if ($this->_input['uses_gravatar'] == 'true') {

View file

@ -74,7 +74,7 @@ class MigrateOldData extends Command
}
if (!$displayName) {
$displayName = $user->mlpforums_name;
$displayName = $user->username;
}
if (!$displayName) {
@ -91,7 +91,7 @@ class MigrateOldData extends Command
'bio' => $user->bio,
'sync_names' => $user->sync_names,
'can_see_explicit_content' => $user->can_see_explicit_content,
'mlpforums_name' => $user->mlpforums_name,
'username' => $user->username,
'uses_gravatar' => $user->uses_gravatar,
'gravatar' => $user->gravatar,
'avatar_id' => null

View file

@ -38,7 +38,7 @@ class AccountController extends ApiControllerBase
'can_see_explicit_content' => $user->can_see_explicit_content == 1,
'display_name' => $user->display_name,
'sync_names' => $user->sync_names == 1,
'mlpforums_name' => $user->mlpforums_name,
'username' => $user->username,
'gravatar' => $user->gravatar ? $user->gravatar : $user->email,
'avatar_url' => !$user->uses_gravatar ? $user->getAvatarUrl() : null,
'uses_gravatar' => $user->uses_gravatar == 1

View file

@ -171,7 +171,7 @@ class ArtistsController extends ApiControllerBase
'latest_tracks' => $latestTracks,
'comments' => $comments,
'bio' => $user->bio,
'mlpforums_username' => $user->mlpforums_name,
'mlpforums_username' => $user->username,
'message_url' => $user->message_url,
'user_data' => $userData
]

View file

@ -96,8 +96,10 @@ class AuthController extends Controller
return $this->loginRedirect(User::find($token->user_id));
}
//Check by email to see if they already have an account
$localMember = User::where('email', '=', $poniverseUser['email'])->first();
// Check by login name to see if they already have an account
$localMember = User::where('username', '=', $poniverseUser['username'])
->where('is_archived', false)
->first();
if ($localMember) {
return $this->loginRedirect($localMember);
@ -105,7 +107,7 @@ class AuthController extends Controller
$user = new User;
$user->mlpforums_name = $poniverseUser['username'];
$user->username = $poniverseUser['username'];
$user->display_name = $poniverseUser['display_name'];
$user->email = $poniverseUser['email'];
$user->created_at = gmdate("Y-m-d H:i:s", time());

View file

@ -11,7 +11,8 @@
"kriswallsmith/assetic": "1.2.*@dev",
"intouch/laravel-newrelic": "*",
"barryvdh/laravel-ide-helper": "^2.1",
"guzzlehttp/guzzle": "~6.0"
"guzzlehttp/guzzle": "~6.0",
"doctrine/dbal": "^2.5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",

438
composer.lock generated
View file

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "eddd67b3d3ba03070bfe8291aa666997",
"content-hash": "1a6fea0657cdd4d6a80389865fff8ad6",
"hash": "de5e29b9defac1327482713da4fc062d",
"content-hash": "e9ed56cee43eb3096269b8fc9db1bf9b",
"packages": [
{
"name": "barryvdh/laravel-ide-helper",
@ -257,6 +257,354 @@
"description": "implementation of xdg base directory specification for php",
"time": "2014-10-24 07:27:01"
},
{
"name": "doctrine/annotations",
"version": "v1.2.7",
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
"reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535",
"shasum": ""
},
"require": {
"doctrine/lexer": "1.*",
"php": ">=5.3.2"
},
"require-dev": {
"doctrine/cache": "1.*",
"phpunit/phpunit": "4.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Annotations\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Docblock Annotations Parser",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"docblock",
"parser"
],
"time": "2015-08-31 12:32:49"
},
{
"name": "doctrine/cache",
"version": "v1.5.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/2b9cec5a5e722010cbebc91713d4c11eaa064d5e",
"reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"phpunit/phpunit": ">=3.7",
"predis/predis": "~1.0",
"satooshi/php-coveralls": "~0.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Caching library offering an object-oriented API for many cache backends",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"cache",
"caching"
],
"time": "2015-11-02 18:35:48"
},
{
"name": "doctrine/collections",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/collections.git",
"reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a",
"reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Collections\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Collections Abstraction library",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"array",
"collections",
"iterator"
],
"time": "2015-04-14 22:21:58"
},
{
"name": "doctrine/common",
"version": "v2.5.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/common.git",
"reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/common/zipball/0009b8f0d4a917aabc971fb089eba80e872f83f9",
"reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9",
"shasum": ""
},
"require": {
"doctrine/annotations": "1.*",
"doctrine/cache": "1.*",
"doctrine/collections": "1.*",
"doctrine/inflector": "1.*",
"doctrine/lexer": "1.*",
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "~3.7"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Common Library for Doctrine projects",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"annotations",
"collections",
"eventmanager",
"persistence",
"spl"
],
"time": "2015-08-31 13:00:22"
},
{
"name": "doctrine/dbal",
"version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/01dbcbc5cd0a913d751418e635434a18a2f2a75c",
"reference": "01dbcbc5cd0a913d751418e635434a18a2f2a75c",
"shasum": ""
},
"require": {
"doctrine/common": ">=2.4,<2.6-dev",
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "4.*",
"symfony/console": "2.*"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"bin": [
"bin/doctrine-dbal"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\DBAL\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Database Abstraction Layer",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"database",
"dbal",
"persistence",
"queryobject"
],
"time": "2015-09-16 16:29:33"
},
{
"name": "doctrine/inflector",
"version": "v1.0.1",
@ -324,6 +672,60 @@
],
"time": "2014-12-20 21:24:13"
},
{
"name": "doctrine/lexer",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/lexer.git",
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
"reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Doctrine\\Common\\Lexer\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"lexer",
"parser"
],
"time": "2014-09-09 13:34:57"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.1.0",
@ -1486,12 +1888,12 @@
"version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/ClassLoader.git",
"url": "https://github.com/symfony/class-loader.git",
"reference": "2fccbc544997340808801a7410cdcb96dd12edc4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/ClassLoader/zipball/2fccbc544997340808801a7410cdcb96dd12edc4",
"url": "https://api.github.com/repos/symfony/class-loader/zipball/2fccbc544997340808801a7410cdcb96dd12edc4",
"reference": "2fccbc544997340808801a7410cdcb96dd12edc4",
"shasum": ""
},
@ -1536,12 +1938,12 @@
"version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/Console.git",
"url": "https://github.com/symfony/console.git",
"reference": "d6cf02fe73634c96677e428f840704bfbcaec29e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Console/zipball/d6cf02fe73634c96677e428f840704bfbcaec29e",
"url": "https://api.github.com/repos/symfony/console/zipball/d6cf02fe73634c96677e428f840704bfbcaec29e",
"reference": "d6cf02fe73634c96677e428f840704bfbcaec29e",
"shasum": ""
},
@ -1593,12 +1995,12 @@
"version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/CssSelector.git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "0b5c07b516226b7dd32afbbc82fe547a469c5092"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/CssSelector/zipball/0b5c07b516226b7dd32afbbc82fe547a469c5092",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/0b5c07b516226b7dd32afbbc82fe547a469c5092",
"reference": "0b5c07b516226b7dd32afbbc82fe547a469c5092",
"shasum": ""
},
@ -1646,12 +2048,12 @@
"version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/Debug.git",
"url": "https://github.com/symfony/debug.git",
"reference": "9daa1bf9f7e615fa2fba30357e479a90141222e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/Debug/zipball/9daa1bf9f7e615fa2fba30357e479a90141222e3",
"url": "https://api.github.com/repos/symfony/debug/zipball/9daa1bf9f7e615fa2fba30357e479a90141222e3",
"reference": "9daa1bf9f7e615fa2fba30357e479a90141222e3",
"shasum": ""
},
@ -1706,12 +2108,12 @@
"version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/DomCrawler.git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "9dabece63182e95c42b06967a0d929a5df78bc35"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/DomCrawler/zipball/9dabece63182e95c42b06967a0d929a5df78bc35",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/9dabece63182e95c42b06967a0d929a5df78bc35",
"reference": "9dabece63182e95c42b06967a0d929a5df78bc35",
"shasum": ""
},
@ -1759,12 +2161,12 @@
"version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/9310b5f9a87ec2ea75d20fec0b0017c77c66dac3",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9310b5f9a87ec2ea75d20fec0b0017c77c66dac3",
"reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3",
"shasum": ""
},
@ -1866,12 +2268,12 @@
"version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "863af6898081b34c65d42100c370b9f3c51b70ca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/863af6898081b34c65d42100c370b9f3c51b70ca",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/863af6898081b34c65d42100c370b9f3c51b70ca",
"reference": "863af6898081b34c65d42100c370b9f3c51b70ca",
"shasum": ""
},
@ -1919,12 +2321,12 @@
"version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel.git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "405d3e7a59ff7a28ec469441326a0ac79065ea98"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/HttpKernel/zipball/405d3e7a59ff7a28ec469441326a0ac79065ea98",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/405d3e7a59ff7a28ec469441326a0ac79065ea98",
"reference": "405d3e7a59ff7a28ec469441326a0ac79065ea98",
"shasum": ""
},

View file

@ -0,0 +1,51 @@
<?php
/**
* Pony.fm - A community for pony fan music.
* Copyright (C) 2015 Peter Deltchev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameUsernameAndIndexIsArchived extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function(Blueprint $table) {
$table->renameColumn('mlpforums_name', 'username');
$table->index('is_archived');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function(Blueprint $table) {
$table->renameColumn('username', 'mlpforums_name');
$table->dropIndex('users_is_archived_index');
});
}
}