dousui6488 2019-04-29 14:48 采纳率: 100%
浏览 78

重置密码在本地工作但在现场不工作 - 使用laravel

i am unable to reset the password twice for the same email address, the first time i can reset and second time i click on password reset link it show me empty page and redirect me to the home url i dont know whats happening but its working fine in local no issue if i make request on same email address multiple times i can reset password on local successfully but i cannot reset password on live if i already reset it.

I have also attached the screen shot of my view:

My Controller:

public function forgot(Request $request)
{
    $user = User::where('email', $request->email)->first();

    if (!$user) {
        return response()->json([
            'success' => false,
            'message' => "Your email address was not found.",
        ], 401);
    }

    try {
        $token = str_random(64);

        DB::table('password_resets')->insert([
            'email' => $request->input('email'),
            'token' => bcrypt($token),
            'created_at' => Carbon::now()
        ]);

        $user->reset_token = $token;

        Mail::to($user->email)->send(new ForgotPassword($user));

    } catch (\Exception $e) {
        //Return with error
        $error_message = $e->getMessage();
        return response()->json([
            'success' => false, 'errors' => $error_message], 401);
    }


    return response()->json([
        'success' => true, 'message' => 'A reset email has been sent! Please check your email.'
    ]);
}

And my Reset password controller:

class ResetPasswordController extends Controller
{ 
    use ResetsPasswords;
}

My Routes:

<?php

Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.request');

Route::get('/home', 'HomeController@index')->name('home');

Home Controller:

class HomeController extends Controller
{

    public function __construct()
    {
        $this->middleware('auth');
    }

    public function index()
    {
        return view('home');
    }
}

My forgot.blade.php

<html>
<head>
    <title>Welcome Email</title>
</head>

<body>
<h2>Hello {{$user['first_name']}}</h2>
<br/>
You are receiving this email because we received a password reset request for your account.
<br/>
<a href="{{url('password/reset', $user->reset_token)}}">Reset Password</a>
<br/>
<p>
    If you did not request a password reset, no further action is required.<br/>
    Regards,<br/>
    <strong>Triple R Lense</strong>
</p>    
</body>
</html>

What I see:

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 AT89C51控制8位八段数码管显示时钟。
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 下图接收小电路,谁知道原理
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
    • ¥15 ETLCloud 处理json多层级问题
    • ¥15 matlab中使用gurobi时报错
    • ¥15 这个主板怎么能扩出一两个sata口