lundi 1 juillet 2019

Send reset password link to another user Laravel 5

I am implementing an admin panel where the admin can send the reset password link to other users by click 'Reset Password' button.

It does not seem to work as expected even though the default reset password form from make:auth works perfectly.

This is the code in my Vue component:

<template>
   ...
   <div class="row justify-content-center">
        <button class="btn btn-primary btn-sm mr-2">Save</button>
        <button type="button" class="btn btn-warning btn-sm" @click="resetPassword()">Send Reset Password Link</button>
        <form class="" :action="route('password.email')" method="post" role="form" ref="reset_password_form">
            <input type="hidden" name="_token" :value="csrfToken">
            <input type="hidden" name="email" ref="reset_email">
        </form>
    </div>
</template>
<script>
export default {
props: {
    user: Object,
},
data() {
    return {
        csrfToken: this.$root.$data.csrfToken
    }
},
mounted() {
    this.$refs.reset_email.value = this.user.email;
},
methods: {
    resetPassword() {
        this.$refs.reset_password_form.submit();
    }
}
}

The queue does not receive any jobs and it redirects me back to /home.

I could ofc create a custom controller and mannualy send the link by using this:

$response = Password::sendResetLink($credentials, function (Message $message) {
   $message->subject($this->getEmailSubject());
});

But I am just thinking that it would be nice if I can just use the default one.

Any pointers would be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire