登录支持用户名,与手机号并存 (#2)
原来 Auth::attempt 只按 phone_hash 查,用户名永远登不进去。 家人账号常常不填手机号,演示场景下用名字登录更自然。 - 先按手机号 hash 精确查(唯一),未命中再按 name 查 - 重名命中多条一律拒绝,绝不取第一条(否则 A 的密码能登进 B 的账号) - 表单 label 改「手机号 / 用户名」,错误文案改「账号或密码错误」 验证:逻辑单测 10/10(含重名拒绝);反向验证改坏判断即变红 (#2)
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
<p class="muted">请登录后继续</p>
|
||||
|
||||
<div class="form-row">
|
||||
<label>手机号</label>
|
||||
<input type="text" name="phone" required autofocus placeholder="请输入手机号">
|
||||
<label>手机号 / 用户名</label>
|
||||
<input type="text" name="phone" required autofocus placeholder="手机号或用户名">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label>密码</label>
|
||||
|
||||
Reference in New Issue
Block a user