laravel - 如何在 URL 中隐藏密码
问题描述
我不知道 url 上的隐藏密码是如何遇到这样的问题http://127.0.0.1:8000/bulletin/%201/edit?passwordC=11111&page=1
我的观点
<form>
<div class="form-row" style="specified-width:200; position: absolute; bottom:0; margin-bottom:10">
<input style="width:150px" type="password" placeholder="Password" name="passwordC">
<input type="hidden" value="{{$buletin->currentPage()}}" name="page">
<button style="margin:0 5px" formAction="/bulletin/ {{ $tampil_B->id }}/deleteOper" type="submit" class="btn btn-danger">Delete</button>
<button formAction='(url(edit))' type="submit" class="btn btn-primary">Edit</button>
</div>
</form>
我的路由器
route::get('/bulletin/{id}/edit','BulletinController@edit');
我的控制器
public function edit (Request $request, $id)
{
$buletin = \App\Dashboard::find($id);
$url = "/?page={$request->page}";
if(is_null($buletin->password)){
$request->session()->flash('failed', 'Cant Edit Because this post not had been set password ');
return view('bulletin.edit_nopass', ['buletin' => $buletin,'url'=> $url]);
}
if (hash::check($request->passwordC,$buletin->password)){
return view ('bulletin.edit', ['buletin' => $buletin, 'url'=> $url]);//save and go back to card
} else {
$request->validate([
'passwordC' => 'required|required_with:password|same:password'
],[
'passwordC.required_with' => "Password not match",
'passwordC.required' => "Password Required",
'passwordC.same' => "The Password You Entered Do Not Match.Please Try Again"
]);
}
解决方案
首先,用 . 发送是不正确的GET
。但如果它非常重要,你有两种方法:
1.使用。encrypt
但它也不安全。因为甚至有可以解密的在线网站。2.使用Hash:make
。散列是单方面的。这意味着你不能对它进行散列
推荐阅读
- java - snapshot.getChildren() 没有将值传递给 FOR LOOP onDataChange 中的 snap 变量
- python - 使用 tf.py_function() 运行 tf.distribute.Server 的示例
- python - 如何从python中的keccak 256哈希值中找到原始值?
- javascript - 如何使用 vuelidate 访问另一个字段
- javascript - Axios - 打印完整的响应对象
- python - 如何在pyspark中获取日期列的最大值
- delphi-xe5 - TeeChart 无法使用 LoadChartFromStream 加载我的自定义属性
- spring - 有没有办法将系统变量注入 Spring 库?
- eclipse - 如何将源文件附加到他们的 eclipse 插件依赖 jar 以查看 javadocs?
- pygame - 为什么pygame的功能在重启时不起作用?(如何重置 pygame 功能?)