我有一个Laravel项目,其中包括wordpress。他们有一个共同的数据库。注册用户时,当我单击忘记密码并输入电子邮件时,数据将输入用户表。我收到一个带有令牌的链接,可以在其上重置密码,但是当我输入密码时,输出的密码不兼容。如何解决这个问题?
这就是我所拥有的:
<form method="POST" action="{{ route('password.request') }}">
{{ csrf_field() }}
<input type="hidden" name="token" value="{{ $token }}">
<div class="input-with-icon icon-left">
<span class="input-icon text-accent text-left">
<i class="fa fa-envelope" aria-hidden="true"></i>
</span>
<input id="email" type="email" name="user_email" value="{{ old('user_email') }}" required autofocus
placeholder="email">
</div>
@if ($errors->has('user_email'))
<span class="error-block">
<strong>{{ $errors->first('user_email') }}</strong>
</span>
@endif
<div class="spacer-20"></div>
<div class="input-with-icon icon-left">
<span class="input-icon text-accent text-left">
<i class="fa fa-lock" aria-hidden="true"></i>
</span>
<input id="password" type="password" name="user_pass" required placeholder="Password">
</div>
@if ($errors->has('user_pass'))
<span class="error-block">
<strong>{{ $errors->first('user_pass') }}</strong>
</span>
@endif
<div class="spacer-20"></div>
<div class="input-with-icon icon-left">
<span class="input-icon text-accent text-left">
<i class="fa fa-lock" aria-hidden="true"></i>
</span>
<input id="password-confirm" type="password" name="password_confirmation" required placeholder="Retype Password">
</div>
@if ($errors->has('password_confirmation'))
<span class="error-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
@endif
<div class="spacer-20"></div>
<div>
<button type="submit" class="btn btn-nim btn-nim-clear" style="width: 100%">
reset password
</button>
</div>
</form>
我在哪里更改user_pass上的密码?
答案 0 :(得分:1)
Laravel很遗憾地将密码字段名称硬编码。解决此问题的最简单方法是在应用默认的Laravel逻辑之前,将 user_pass 的值复制到控制器中的密码。
public function reset(Request $request)
{
$request->request->set('password', $request->user_pass);
return parent::reset($request);
}