我们目前正在使用Symfony 2和FOS/UserBundle进行用户身份验证.
我想在没有登录的情况下检查给定的用户名/密码组合是否有效.这是因为另一个人当前已登录,但是例如需要执行特定操作,需要由具有更高许可的人员来完成.
基本上我希望其他用户除了当前记录的人之外还执行不同的控制器操作.
如果有更好的方法,请告诉我
这是编辑的代码
function edit($id){
if(!empty($this->data)) {
if($this->Article->save($this->data)) {
pr($this->Article);
$this->Session->setFlash("Article Saved!");
$this->redirect('/articles/view');
}
}
else
$this->data = $this->Article->findByArticleId($id);
}
Run Code Online (Sandbox Code Playgroud)
并为了观点
<?php
echo $form->create('Article', array('type' => 'post','action'=>'edit'));
?>
<table>
<tr><td>Edit Article</td></tr>
<tr><td>Title: </td><td><?php echo $form->text('article_title',array('label'=>false,'type'=>'text','size'=>50)); ?></td></tr>
<tr><td>Text: </td><td><?php echo $form->textarea('article_text',array('label'=>false,'class'=>'ckeditor','columns'=>100,'row'=>8,'width'=>100));?></td></tr>
<tr><td>Published: </td><td><?php echo $form->radio('article_published',array('1'=>'Yes','0'=>'No'),array('legend'=>false));?></td></tr>
</table>
<?php echo $form->end('Save'); ?>
Run Code Online (Sandbox Code Playgroud)
问题是它总是添加新记录而不是更新当前记录.我该怎么解决?
我创建了一个中间件来检查请求是否返回无效的访问响应.如果状态是401,我想将用户重定向到登录页面
这是中间件代码
import React from 'react';
import { push, replace } from 'react-router-redux';
const auth_check = ({ getState }) => {
return (next) => (action) => {
if(action.payload != undefined && action.payload.status==401){
push('login');
console.log('session expired');
}
// Call the next dispatch method in the middleware chain.
let returnValue = next(action);
return returnValue
}
}
export default auth_check;
Run Code Online (Sandbox Code Playgroud)
将它包含在index.js中
...
const store = createStore(reducers, undefined,
compose(
applyMiddleware(promise,auth_check)
)
);
const history = syncHistoryWithStore(browserHistory, store);
ReactDOM.render(
<Provider store={store}>
<Router history={history} routes={routes} /> …Run Code Online (Sandbox Code Playgroud) 我怎么在jquery中这样做?我想发布数据,处理,然后检索由该数据生成的页面.
我所能找到的只是分开发布.或者只是检索数据.
php ×2
cakephp ×1
hook ×1
javascript ×1
jquery ×1
ms-access ×1
react-jsx ×1
react-redux ×1
react-router ×1
reactjs ×1
seo ×1
sql ×1
symfony ×1
wordpress ×1