我有 laravel 5.2 应用程序,如果用户已经登录,用户将被限制访问/login
。现在我们已经实现了“从其他应用程序(不是 laravel)登录我们的应用程序”的功能。现在的问题是,当请求应用程序进行 ajax 调用以获取登录时,如果用户在请求之前未登录,laravel 5.2 会返回完美响应。但是登录后,如果再次请求应用程序请求登录,laravel 应用程序返回主页视图作为响应。我想在处理登录请求之前对其进行自定义并让用户注销。我在互联网和调试上花费了太多时间。但是到处都有人要求限制登录页面。但我的要求是允许/login
使用 post 方法请求并自定义响应. 如果有人知道答案,将不胜感激。
这是请求应用程序的代码
$.ajax({
type: 'POST',
url: 'http://192.168.1.78/my-app/login',
data: {
st_email: 'xyz@xyz.com',
st_password: 'myPass'
}
}).success(function (response) {
// getting view in response if user is already restrict
}).error(function () {
console.log('error');
});