1

I'm having trouble with an error that I'm getting in laravel. When I run my code on localhost I don't have any issues, but when I placed laravel in demo live server which is server ('https') I get the MethodNotAllowedHttpException error.

Here's my code for my route

Route::post('post_reminder', function(){
    $creds = array(
        'email' => Input::get('email')
    );

    $rules = array(
        'email' => 'required|email'
    );
    $messages = array(
        'email' => 'The :attribute needs to be an real email'
    );

    $validator = Validator::make($creds, $rules,$messages);

    if($validator->fails())
    {
        return Redirect::route('getReminder')->withErrors($validator);
    }
    else
    {
        return Password::remind($creds);
    }
       });

And here's the form code

    <div id="reset_container">
{{ Form::open(array('url' => 'post_reminder')) }}
<h1 id="pass_recovery_text">Password Recovery Form</h1>
    <p>
@if (Session::has('error'))
    <li id="error">{{ trans(Session::get('reason')) }}</li>
@elseif (Session::has('success'))
        <li id="error">An e-mail with the password reset has beensent.</li>
@endif
@foreach($errors->all() as $error)
    <li id="error">{{ $error }}</li>
@endforeach
{{ Form::label('email', 'Please enter you email: ') }}
{{ Form::text('email','',array('id' => 'forgot')) }}
{{ Form::submit('Reset') }}<br /><br /><br />
{{ HTML::link('/', 'Have a account Sign-In', array('id' => 'sign-in')) }}
    </p>
{{ Form::close() }}
    </div>
4
  • do you have mod_rewrite enabled on your server? i.e. do any other functions work - or is it just this one failing? Also - check for caps on your filenames - it is probably case sensitive on your live server, but not on your localhost Commented Aug 15, 2013 at 2:25
  • Yes I have mod-rewrite enabled on the server Commented Aug 18, 2013 at 19:54
  • 2
    Try {{ Form::open(array('url' => 'post_reminder', 'method' => 'POST')) }} Commented Mar 20, 2015 at 14:45
  • What is the output of your form? Is there the argument method="POST" in your opening form tag? If there isn't, you should go along with the Comment form @MaksymCierzniak ... hf :) Commented Jul 9, 2015 at 9:46

2 Answers 2

1
<div id="reset_container">
{{ Form::open(array('url' => 'post_reminder','method' => 'post')) }}
    <h1 id="pass_recovery_text">Password Recovery Form</h1>
    <p> 
    @if (Session::has('error'))
        <li id="error">{{ trans(Session::get('reason')) }}</li>
    @elseif (Session::has('success'))
        <li id="error">An e-mail with the password reset has beensent.</li> 
    @endif 
    @foreach($errors->all() as $error)
    <li id="error">{{ $error }}</li> @endforeach
    {{ Form::label('email', 'Please enter you email: ') }}
    {{ Form::text('email','',array('id' => 'forgot')) }} 
    {{ Form::submit('Reset') }}
    {{ HTML::link('/', 'Have a account Sign-In', array('id' => 'sign-in')) }} </p> 
{{ Form::close() }}

Sign up to request clarification or add additional context in comments.

Comments

0

Have you tried force the route to be served over https?

Route::post('post_reminder', array('https', function(){
$creds = array(
    'email' => Input::get('email')
);

$rules = array(
    'email' => 'required|email'
);
$messages = array(
    'email' => 'The :attribute needs to be an real email'
);

$validator = Validator::make($creds, $rules,$messages);

if($validator->fails())
{
    return Redirect::route('getReminder')->withErrors($validator);
}
else
{
    return Password::remind($creds);
}
   }));

Referencing to http://laravel.com/docs/4.2/routing here.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.