Commit dd1487c2 authored by Alfonso Rafael Solis Rangel's avatar Alfonso Rafael Solis Rangel
Browse files

Merge branch 'login_username' into 'main'

Login username

See merge request !5
parents 28691e02 8b633449
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -21,14 +21,14 @@ public function create(array $input): User
    {
        Validator::make($input, [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'username' => ['required', 'string', 'max:255', 'min:4', 'unique:users'],
            'password' => $this->passwordRules(),
            'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
        ])->validate();

        return User::create([
            'name' => $input['name'],
            'email' => $input['email'],
            'username' => $input['username'],
            'password' => Hash::make($input['password']),
        ]);
    }
+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ public function update(User $user, array $input): void
    {
        Validator::make($input, [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
            'username' => ['required', 'min:4', 'max:255', Rule::unique('users')->ignore($user->id)],
            'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
        ])->validateWithBag('updateProfileInformation');

@@ -33,7 +33,7 @@ public function update(User $user, array $input): void
        } else {
            $user->forceFill([
                'name' => $input['name'],
                'email' => $input['email'],
                'username' => $input['username'],
            ])->save();
        }
    }
+3 −1
Original line number Diff line number Diff line
@@ -27,7 +27,9 @@ class User extends Authenticatable
     */
    protected $fillable = [
        'name',
        'email',
        //'email',
        'username',
        'active',
        'password',
    ];

+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@
    |
    */

    'username' => 'email',
    'username' => 'username',

    'email' => 'email',

+2 −1
Original line number Diff line number Diff line
@@ -14,9 +14,10 @@ public function up(): void
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique();
            $table->string('username')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->boolean('active')->default(0);
            $table->rememberToken();
            $table->foreignId('current_team_id')->nullable();
            $table->string('profile_photo_path', 2048)->nullable();
Loading