Laravel 5密码重设与角视图 [英] Laravel 5 Password Reset with Angular View

查看:159
本文介绍了Laravel 5密码重设与角视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Laravel内置密码重置在我的应用程序,其中Laravel 5.1作为后端API和角1.3所有前端意见。我已经设置了密码重置为每文档在那里我有做了以下内容:

I am trying to use the Laravel inbuilt password reset in my app where Laravel 5.1 acts as the backend api and Angular 1.3 for all front-end views. I have set-up the Password reset as per the docs where I have done the following:

1)创建表

php artisan migrate

2)已将此添加到路线:

2) Added this to the route:

  Route::post('password/email', 'Auth/PasswordController@postEmail');
  Route::post('password/reset', 'Auth/PasswordController@postReset');

因为我会用角来显示前端的形式,我没加为 GET 的意见。我没有做任何更改认证/ PasswordController.php 而现在它就像它来时的路。但是,当我从测试邮差上述网址 POST 的要求,我收到错误:

Since I will be using Angular to display frontend forms, I did not add the views for GET. I havent done any changes to the Auth/PasswordController.php and right now its just like the way it came. But when I test the above URL from Postman POST request, I am getting the error:

查看[emails.password]没有找到。

我怎样才能让角处理的意见,并没有关于视图Laravel烦恼吗?我必须有Laravel信息查看内置的密码重置为工作?我该如何处理这个?

How can I let Angular Handle the views and not have Laravel worry about the view? Do I have to have Laravel View for the inbuilt password reset to work? How do I approach this?

推荐答案

重写 postEmail postReset 方法,使他们返回一个JSON响应(不要让它重定向)。随后发布到 /密码/电子邮件 /密码/重置从通过XHR角。

Override the postEmail and postReset methods so that they return a JSON response (don't let it redirect). Subsequently post to /password/email and /password/reset from Angular via xhr.

这篇关于Laravel 5密码重设与角视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆