我在Nodejs应用程序中有这个Mongoose模式:
const mongoose = require('mongoose'),
Schema = mongoose.Schema,
sodium = require('sodium').api;
const UserSchema = new Schema({
username: {
type: String,
required: true,
index: { unique: true }
},
salt: {
type: String,
required: false
},
password: {
type: String,
required: true
}
});
UserSchema.methods.comparePassword = function(candidatePassword, targetUser) {
let saltedCandidate = candidatePassword + targetUser.salt;
if (sodium.crypto_pwhash_str_verify(saltedCandidate, targetUser.password)) {
return true;
};
return false;
};
module.exports = mongoose.model('User', UserSchema);
Run Code Online (Sandbox Code Playgroud)
我创建了这个路由文件.
const _ = require('lodash');
const User = require('../models/user.js'); // yes, this …Run Code Online (Sandbox Code Playgroud) 我创建了一个 GitHub 存储库,然后使用 SSH 克隆它:
git clone git@github.com:BenReilly/all-the-characters.git
Run Code Online (Sandbox Code Playgroud)
我添加了一些文件。
git add .
git commit -m "some message"
git push
Run Code Online (Sandbox Code Playgroud)
这导致系统提示我输入用户名和密码。这本身就有点奇怪,但我还是输入了它们。然后我得到:
> remote: Anonymous access to BenReilly/all-the-characters.git denied.
> fatal: Authentication failed for 'https://github.com/BenReilly/all-the-characters.git/'
Run Code Online (Sandbox Code Playgroud)
HTTPS?什么?
git remote -v
> origin https://github.com/BenReilly/all-the-characters.git (fetch)
> origin https://github.com/BenReilly/all-the-characters.git (push)
Run Code Online (Sandbox Code Playgroud)
啊。
git remote set-url origin git@github.com:BenReilly/all-the-characters.git
git remote -v
> origin https://github.com/BenReilly/all-the-characters.git (fetch)
> origin https://github.com/BenReilly/all-the-characters.git (push)
Run Code Online (Sandbox Code Playgroud)
这是因为它不在我的 osxkeychain 中吗?
只是为了确保我这样做ssh-add -K ~/.ssh/<key id>并确保~/.ssh/config文件已定义。行为没有改变。我还验证了密钥位于我的 GitHub 设置中。
我使用的是 MacOS Mojave (10.14.1),使用 Git …
我对角度很新,而且我被推进了一个相当大的项目.我有一个情况,我已简化为以下代码:
var beforeClose = function() {
var closeDeferred = $q.defer(),
a = $q.defer(),
b = $q.defer(),
c = $q.defer(),
promiseArray = [a.promise, b.promise, c.promise];
/* logic that resolves or rejects a, b, and c */
$q.all(promiseArray).then(
function() {
closeDeferred.resolve();
},
function() {
closeDeferred.reject();
}
);
return closeDeferred.promise;
}
var modalClose = function() {
beforeClose().then(
function() {
//close the modal
},
function() {
//warn and don't close modal
}
)
}
Run Code Online (Sandbox Code Playgroud)
使用Chrome的DevTools,似乎代码在完全解决或拒绝之前返回了closeDeferred承诺.所以我猜我的问题是这样的, promiseArray
什么时候承诺退回?可以在解决或拒绝之前退回吗?如果没有,我怎么能阻止它返回?
将return语句放入函数(例如,在 …
所以我的应用程序具有这个component.js:
import Component from '@ember/component';
import layout from './template';
export default class MyComponent extends Component {
layout = layout;
init() {
this._super(...arguments);
}
}
Run Code Online (Sandbox Code Playgroud)
呈现组件时,我在chrome控制台中收到此错误:
Assertion Failed: You must call `this._super(...arguments);` when overriding `init` on a framework object. Please update <savings-toolkit@component:my-component::ember2445> to call `this._super(...arguments);` from `init`.
内容未加载。我希望我能说更多,但说真的,这到底是什么?
是的,当我开始时,最初内容更多。然而,这实际上只是以上内容。
angularjs ×1
components ×1
ember.js ×1
git ×1
github ×1
javascript ×1
macos-mojave ×1
mongoose ×1
node.js ×1
ssh ×1