所以我使用mcrypt加密数据,将其存储在数据库中并对其进行解密.我想知道在public_html目录之外的php文件中存储加密密钥是否安全?
将其存储在文件中的原因是它需要用于多个加密,以便多个用户可以解密某些数据,并且我认为将其存储在文件中比在数据库表中更安全,就在加密旁边数据.
什么是潜在的安全风险?是否有可能让黑客获得对此文件的访问权限,从而获得密钥?
我有以下单元测试,由于某种原因,第二次测试使其他测试失败.
beforeEach(inject(function ($rootScope, _$httpBackend_, $controller, $location, mockedResource) {
scope = $rootScope.$new();
httpBackend = _$httpBackend_;
locationService = $location;
ctrlDependencies = {
$scope: scope,
resource: mockedResource,
}
var ctrl = $controller('myController', ctrlDependencies);
}));
it('should redirect to a new page', function() {
scope.pageRedirectFunction();
expect(locationService.path()).toBe('/newpage')
});
it('should delete an epic resource', function() {
httpBackend.expectGET('/api/v1/epic/1').respond({});
httpBackend.expectDELETE('/api/v1/epic/1').respond({});
// Run the deletion function
scope.deleteEpicResource()
httpBackend.flush() // This line seems to be the rebelious one
expect(scope.epicResources.length).toEqual(0)
})
Run Code Online (Sandbox Code Playgroud)
我已经设法弄清楚似乎导致错误的httpBackend.flush()线,这就是线.为什么flush函数会导致奇怪的行为?
我karma start在终端中运行命令得到的实际错误是:
Delaying execution, these browsers …Run Code Online (Sandbox Code Playgroud) 所以我试图将我的本地主机的回购推送到我的VPS.
我在我的vps上设置了一个--bare repo,在我的localhost上设置了一个repo.
我使用以下命令推送到VPS:
# git remote add origin ssh://root@mysite.net/home/mysite/public_html/mygit/.git
# git push origin master
Run Code Online (Sandbox Code Playgroud)
它推动成功,但我需要做的是检查VPS .git中的文件.但是,当我尝试运行'git checkout'时,我收到错误:
致命:此操作必须在工作树中运行
我已经尝试编辑.git配置文件并编辑/添加这些行:
[core]
bare = true
worktree = /home/mysite/public_html/mygit/
[receive]
denycurrentbranch = false
Run Code Online (Sandbox Code Playgroud)
这允许我运行git命令,但文件不会签出,git告诉我文件已被删除.
我有点困惑.我该怎么办呢?
所以我正在AngularJS的一个新网站上工作,喜欢它!
但是,我遇到了一个问题.我试图在我的textareas中添加一个名为'Redactor'的jQuery插件,但我认为发生的事情是当我初始化插件时,它取代了textarea元素.这有问题的原因是因为我在文本区域设置了'ng-model'属性,如下所示:
我正在使用AngularJS UI来拾取焦点事件,然后在文本焦点处执行以下代码
$scope.addRedactor = function() {
$('.redactor').redactor();
});
Run Code Online (Sandbox Code Playgroud)
现在我似乎无法获得textarea的值,因为当我尝试访问ng-model'响应'时,它会显示为未定义.
有没有办法在受到Redactor影响后将ng-model属性绑定到textarea?另外,还有另一种方法可以获得textarea的价值吗?
我正在从WYSIWYG编辑器的输出中将html数据存储在我的数据库中.html还存储了一些指令的html.其中一个是ui-bootstrap工具提示:
<span tooltip-placement="left" tooltip="On the Left!">Tooltip text here</span>
Run Code Online (Sandbox Code Playgroud)
我可以通过使用绑定来获取任何其他html元素:
<div ng-bind-html-unsafe="html.content"></div>
Run Code Online (Sandbox Code Playgroud)
但是带有指令引用的html不与实际指令交互.
我怎样才能使该指令起作用?
我是否必须编译html或类似的东西?
我正在开发一个非平凡的应用程序,具有以下文件夹结构:
build (required files such as angular.js)
Gruntfile.js
karma.conf.js
logs/
node_modules/
src/
- app/
- app.js
- module_name/
- module.js
- controllers/
- controller1.js
- controller2.js
- views/
- view1.html
- assets/
- 1.jpg
- styler.css
- components/ (plugged in modules [angular-ui, etc])
- index.html
Run Code Online (Sandbox Code Playgroud)
我的控制器都附加到其父模块.然后在我的app.js文件中需要该模块.
我曾尝试编写一些单元测试,但我似乎一直遇到依赖性问题,因为我尝试测试的控制器需要它的模块,然后该模块需要另一个模块等.
我的问题有几个部分:
如何构建我的karma.conf.js文件以包含必要的文件?具体来说这部分配置:
files: [
'files_to_be_tested.js',
]
Run Code Online (Sandbox Code Playgroud)使用Jasmine,如何使用所有正确的依赖项编写单元测试?例如,我运行以下测试
使用Javascript
using 'strict'
describe('my Module', function() {
describe('myController', function() {
var ctrl, scope;
beforeEach(module('myModule'));
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('myController', { $scope: …Run Code Online (Sandbox Code Playgroud) angularjs ×4
jasmine ×2
javascript ×2
testing ×2
unit-testing ×2
codeigniter ×1
encryption ×1
git ×1
jquery ×1
php ×1
redactor ×1
security ×1
ssh ×1