Devise, send instructions with my mail wrapper

2019-08-09 11:29发布

问题:

I have madmimi wrapper that somebody wrote as a helper, andi i have to use it not matter what. So i was wondering how would i go about sending forgot password mail with reset link with my own wrapper.

My method works like this:

MyApp::MadMimi.send! :forgot_password, @user, @link

How i can somehow override send_reset_password_instructions, generate a link and send it like this?

Thanks guys.

回答1:

I got it, just had to think a bit.

I just overrided send_reset_password_instructions in admin model:

def send_reset_password_instructions
    token = set_reset_password_token # Use the token if i need it inside link

    MyApp::MadMimi.send! :forgot_password, current_user, link

    token
end