草庐IT

auth-user-pass

全部标签

php - Laravel 的 Auth::attempt() 返回 true 但 Auth::check() 返回 false

如标题所示,Laravel的函数Auth::attempt()返回true如下代码部分(删除了不重要的部分):publicfunctiondoLogin(){$validator=[..]if($validator->fails()){[..]}else{$userdata=array('username'=>Input::get('username'),'password'=>Input::get('password'));if(Auth::attempt($userdata,true)){returnRedirect::to('/');}else{returnRedirect::t

php - Laravel Elfinder 在使用 'auth' 中间件时重定向到主页

我正在使用https://github.com/barryvdh/laravel-elfinder每当我在config/elfinder.php文件中将middleware设置为auth时,我都会被重定向到主页,但是当我使用middleware来NULL,elfinder可以正常打开。如何在laravel中保护elfinder的路由,以便只允许访问的用户打开文件管理器?谢谢 最佳答案 解决方案是在config\elfinder.php文件中使用web作为另一个中间件。所以,解决方案就变成了'middleware'=>"['auth'

php - Laravel - JWT Auth 无法从请求中解析 token

我在我的中间件中添加了以下代码,用于使用JWTAuth进行用户身份验证,它适用于中间件处理的所有路由。publicfunctionhandle($request,Closure$next){if($request->has('token')){try{$this->auth=JWTAuth::parseToken()->authenticate();return$next($request);}catch(JWTException$e){returnredirect()->guest('user/login');}}}但是对于使用PostMethod的一条路线,其中token已正确传递

php - 调用未定义的方法 Illuminate\Auth\TokenGuard::attempt()

我收到这个错误:CalltoundefinedmethodIlluminate\Auth\TokenGuard::attempt()来自这段代码:if(Auth::guard('admin')->attempt(['email'=>$request->email,'password'=>$request->password],$request->remember)){returnredirect()->intended(route('admin.dashboard'));}else{我已经导入了Illuminate\Support\Facades\Authasthedocssugges

php - 在 php 中启用 user_birthday 权限 facebook 生日

我正在制作一个facebook应用程序来显示用户的生日.........'YOUR_APP_ID','secret'=>'YOUR_APP_SECRET',);$facebook=newFacebook($config);$user_id=$facebook->getUser();?>api('/me','GET');echo"Name:".$user_profile['name'];//BirthDatetobeprintedhere........echo"DOB:".$user_profile['birthday'];}catch(FacebookApiException$e){

java.sql.SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)报错原因

1.第一个:用户名和密码不匹配,或者是在连接池里多打了空格之类的就是配置文件的问题;2.第二个:可能是用户的权限不够,给他添加权限;授予权限--grantallprivilegesondatabasename.tablenameto'user'@'host'identifiedby'password';--授予myuser用户全局级全部权限:GRANTALLPRIVILEGESON*.*TO'myuser'@'%'IDENTIFIEDBY'mypass'WITHGRANTOPTION;--授予myuser用户针对testdb数据库全部权限:GRANTALLPRIVILEGESONtestdb.

php - Facebook FQL 用户表 `sex` 字段 : how to return male/female even the user is using different locale?

情况:我的facebook应用程序(http://apps.facebook.com/mymagicmirror/)需要检测用户的性别,然后查询异性或男性或女性FQL:SELECTuid,name,pic,sexFROMuserWHEREuidIN(SELECTuid2FROMfriendWHEREuid1='.$user_id.')andsex='male'问题:当facebook用户使用其他语言环境时,“性别”字段不再匹配“男性”和“女性”。相反,用中文来说,性别将变为男性/女性,而sex='male'的FQL将返回零结果。有什么解决方案可以查询所有男性/女性friend,即使fa

php - 如何在 zend 框架中设置 auth 变量

我们正在使用ZendFrame开发一个网站。我们需要设置一个授权变量(角色)来管理用户类型。为此,我们使用变量this->view->auth->getIdentity()->role来管理用户类型。在一个追逐中,我们试图静态分配用户类型。分配auth变量“role”的代码是什么。我们尝试使用this->view->auth->getIdentity()->role='test',但通过了警告。 最佳答案 以下应该允许您在成功登录后创建一个新的Zend_Auth身份:$identity=Zend_Auth::getInstance(

php - 我如何在 Laravel Auth::attempt 中使用条件参数?

使用Laravel4.1.30我得到了以下代码,它测试了通过Auth的登录尝试。//...morecodeshere...$auth=Auth::attempt(array('email'=>Input::get('email'),'password'=>Input::get('password'),'active'=>1),$remember);if($auth){//...morecodeshere...}我喜欢实现一个条件值,例如:->active>0我使用active(字段)作为登录用户的身份验证级别。任何高于0(零)的值都应满足下一个条件。如何在一条语句中完成?

php - 带有 Auth 的 Yii2 CORS 不适用于非 CRUD 操作

我正在Yii2中构建API,并添加了CORS和身份验证。这适用于所有创建/读取/更新/删除操作,但不适用于自定义操作。有没有人以前经历过这种情况?网址管理器:['class'=>'yii\rest\UrlRule','controller'=>'api/v1/user','pluralize'=>false],Controller行为:publicfunctionbehaviors(){returnArrayHelper::merge(['corsFilter'=>['class'=>Cors::className(),],['class'=>HttpBearerAuth::class