dt614037527 2017-11-09 15:42
浏览 52

现在重命名Laravel 5.4中的输入密码?

I have a project for Laravel which includes wordpress. They have a common database. When registering the user, the data is entered into the user table when I click forgot the password and enter the email. I receive a link with a token on which it is possible to reset the password, but when I enter the password an error is output that the password is not compatible. How can this be remedied?

That's what I have:

<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>

Where do I change the password on user_pass?

  • 写回答

1条回答 默认 最新

  • dongzenglin8292 2017-11-09 16:25
    关注

    Laravel unfortunately has the password field name hardcoded. The easiest option to work around that would be just to copy the value of user_pass to password in your controller before the default Laravel logic is applied.

    public function reset(Request $request)
    {
      $request->request->set('password', $request->user_pass);
    
      return parent::reset($request);
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?