ollieread / multiauth

Laravel multi auth
441 stars 109 forks source link

Reminder Email not sent #61

Closed sandeshix closed 9 years ago

sandeshix commented 9 years ago

status :Password reminder sent! Reminder email is not sent; receiving no laravel errors ;

below is my function that sends reminder...

public function postRemind()
{   

    $email = Input::only('email');

    //afadmin
    switch ($response = Password::afadmin()->remind($email))
    {

        case Password::INVALID_USER:
        //afmod
            switch ($response = Password::afmod()->remind($email))
            {

                case Password::INVALID_USER:
                    //afclient
                    switch ($response = Password::afclient()->remind($email))
                    {

                        case Password::INVALID_USER:
                            return Redirect::back()->with('error', Lang::get($response));

                        case Password::REMINDER_SENT:
                            return Redirect::back()->with('status', Lang::get($response));
                    }

                case Password::REMINDER_SENT:
                    return Redirect::back()->with('status', Lang::get($response));
            }

        case Password::REMINDER_SENT:
            return Redirect::back()->with('status', Lang::get($response));
    }
}

my auth.php

<?php

//Used Multi Auth laravel plugin , ref https://github.com/ollieread/multiauth
return array(

'multi' => array(

    'afadmin' => array(
        'driver' => 'eloquent',
        'table' => 'users',
        'model' => 'User',
        'email' => 'emails.auth.reminder',
    ),
    'afmod' => array(
        'driver' => 'eloquent',
        'table' => 'moderators',
        'model' => 'Moderators',
        'email' => 'emails.auth.reminder',
    ),
    'afclient' => array(
        'driver' => 'eloquent',
        'table' => 'clients',
        'model' => 'Client',
        'email' => 'emails.auth.reminder',
    ),
),

'reminder' => array(

    'email' => 'emails.auth.reminder',

    'table' => 'password_reminders',

    'expire' => 60,

),

);

I'm successfully sending emails using Mail::send() in other part of codes,so outgoing mail settings are fine. Please let me know what is the issue.

thanks

ollieread commented 9 years ago

If you're not receiving errors I don't know what to say. You also have nested switch statements which is never a good idea.

Ideally each individual user would use a controller to send emails. Try splitting that out first.