Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rootview's avatar

Laravel Spark Registration Requiring Two Clicks

I recently did a laravel spark update (I hadn't updated for some time). Now, I have a registration problem. The first time I hit register, I get the error:

Something went wrong. Please try again or contact customer support.

However, the next time I hit register (without changing anything), it registers without a hitch...weird. Here is my registration form code in the /resources/views/vendor/spark/auth/register-common-form.blade.php:

@if (Spark::usesTeams()) Team Name
        <div class="col-md-6">
            <input type="name" class="form-control" name="team" v-model="registerForm.team" autofocus>

            <span class="help-block" v-show="registerForm.errors.has('team')">
                @{{ registerForm.errors.get('team') }}
            </span>
        </div>
    </div>
@endif

<!-- Name -->
<div class="form-group" :class="{'has-error': registerForm.errors.has('name')}">
    <label class="col-md-4 control-label">Name</label>

    <div class="col-md-6">
        <input type="name" class="form-control" name="name" v-model="registerForm.name" autofocus>

        <span class="help-block" v-show="registerForm.errors.has('name')">
            @{{ registerForm.errors.get('name') }}
        </span>
    </div>
</div>


<!-- E-Mail Address -->
<div class="form-group" :class="{'has-error': registerForm.errors.has('email')}">
    <label class="col-md-4 control-label">E-Mail Address</label>

    <div class="col-md-6">
        <input type="email" class="form-control" name="email" v-model="registerForm.email">

        <span class="help-block" v-show="registerForm.errors.has('email')">
            @{{ registerForm.errors.get('email') }}
        </span>
    </div>
</div>

<!-- Password -->
<div class="form-group" :class="{'has-error': registerForm.errors.has('password')}">
    <label class="col-md-4 control-label">Password</label>

    <div class="col-md-6">
        <input type="password" class="form-control" name="password" v-model="registerForm.password">

        <span class="help-block" v-show="registerForm.errors.has('password')">
            @{{ registerForm.errors.get('password') }}
        </span>
    </div>
</div>

<!-- Password Confirmation -->
<div class="form-group" :class="{'has-error': registerForm.errors.has('password_confirmation')}">
    <label class="col-md-4 control-label">Confirm Password</label>

    <div class="col-md-6">
        <input type="password" class="form-control" name="password_confirmation" v-model="registerForm.password_confirmation">

        <span class="help-block" v-show="registerForm.errors.has('password_confirmation')">
            @{{ registerForm.errors.get('password_confirmation') }}
        </span>
    </div>
</div>

<!-- Terms And Conditions -->
<div v-if=" ! selectedPlan || selectedPlan.price == 0">
    <div class="form-group" :class="{'has-error': registerForm.errors.has('terms')}">
        <div class="col-md-6 col-md-offset-4">
            <div class="checkbox">
                <label>
                    <input type="checkbox" name="terms" v-model="registerForm.terms">
                    I Accept The <a href="/terms" target="_blank">Terms Of Service</a>
                </label>

                <span class="help-block" v-show="registerForm.errors.has('terms')">
                    @{{ registerForm.errors.get('terms') }}
                </span>
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-md-6 col-md-offset-4">
            <button class="btn btn-primary" @click.prevent="register" :disabled="registerForm.busy">
                <span v-if="registerForm.busy">
                    <i class="fa fa-btn fa-spinner fa-spin"></i>Registering
                </span>

                <span v-else>
                    <i class="fa fa-btn fa-check-circle"></i>Register
                </span>
            </button>
        </div>
    </div>
</div>

Here is the code from my app/Http/Controllers/Auth/AuthController.php

namespace App\Http\Controllers\Auth;

use App\User; use Validator; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\ThrottlesLogins; use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

class AuthController extends Controller { /* |-------------------------------------------------------------------------- | Registration & Login Controller |-------------------------------------------------------------------------- | | This controller handles the registration of new users, as well as the | authentication of existing users. By default, this controller uses | a simple trait to add these behaviors. Why don't you explore it? | */

use AuthenticatesAndRegistersUsers, ThrottlesLogins;

/**
 * Where to redirect users after login / registration.
 *
 * @var string
 */
protected $redirectTo = '/';

/**
 * Create a new authentication controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware($this->guestMiddleware(), ['except' => 'logout']);
}

/**
 * Get a validator for an incoming registration request.
 *
 * @param  array  $data
 * @return \Illuminate\Contracts\Validation\Validator
 */
protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => 'required|max:255',
        'email' => 'required|email|max:255|unique:users',
        'password' => 'required|min:6|confirmed',
    ]);
}

/**
 * Create a new user instance after a valid registration.
 *
 * @param  array  $data
 * @return User
 */
protected function create(array $data)
{
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
    ]);
}

}

I must be missing something. I am not sure why it wouldn't work the first time, but would the second?

Any advise would be great. I am a newb, so please bare with me. I would have included my vue file, but I am not sure what file that is?

0 likes
2 replies
EventFellows's avatar

I have only seen the behaviour you are describing if registration actually did work on first attempt.

Here is what happens in that case (not sure if that is what also happens in your case but you might want to check for it):

  • you try to register and there is a series of actions involved in the background (check inputs, create a user, subscribe to stripe, send welcome email, or whatevery you do there)
  • the actual user registration acutally works and the user is logged in BUT there is an error on one of the followoing tasks
  • then you will get the general error you describe but on next registration attempt (without any changes) registration seems to work because user was already logged in before and still is logged in

Instead of doing a 2nd login attempt try this and see what it brings up:

dd(Auth::user());
rootview's avatar

Thanks so much for the response! I actually just destroyed that branch and restarted from scratch and it worked. So not exactly sure what the problem was, but it is fixed now.

Please or to participate in this conversation.