fix some artifact serialization trouble; fix login error
This commit is contained in:
parent
f396bc2e40
commit
c5783feca9
@ -37,7 +37,7 @@ const convertableAudioTypes = [
|
||||
"application/ogg",
|
||||
"audio/amr",
|
||||
"audio/3ga",
|
||||
"audio/wav",
|
||||
"audio/wave",
|
||||
"audio/3gpp",
|
||||
"audio/x-wav",
|
||||
"audio/aiff",
|
||||
@ -263,6 +263,8 @@ var resizeAndUploadImage = function(a, mimeType, size, fileName, fileNameOrg, im
|
||||
a.h = Math.round(size.height*factor);
|
||||
|
||||
a.updated_at = new Date();
|
||||
db.packArtifact(a);
|
||||
|
||||
a.save().then(function() {
|
||||
fs.unlink(originalFilePath, function (err) {
|
||||
if (err){
|
||||
@ -328,6 +330,8 @@ module.exports = {
|
||||
a.h = Math.round(size.height*factor);
|
||||
|
||||
a.updated_at = new Date();
|
||||
db.packArtifact(a);
|
||||
|
||||
a.save().then(function() {
|
||||
fs.unlink(localFilePath, function (err) {
|
||||
if (err){
|
||||
|
@ -46,7 +46,7 @@
|
||||
"specify": "Bitte spezifiziere",
|
||||
"confirm": "Bitte bestätige",
|
||||
"signup_google": "Mit Google anmelden",
|
||||
"error_unknown_email": "Unbekannte Kombination von Email und Passwort. Oder versuche dich mit Google anzumelden.",
|
||||
"error_unknown_email": "Unbekannte Kombination von Email und Passwort.",
|
||||
"error_password_confirmation": "Die beiden Passwörter stimmen nicht überein.",
|
||||
"error_domain_blocked": "Diese Domain ist gesperrt.",
|
||||
"error_user_email_already_used": "Diese Email-Adresse ist bereits registriert.",
|
||||
|
@ -44,8 +44,7 @@
|
||||
"sure": "Are you sure?",
|
||||
"specify": "Please Specify",
|
||||
"confirm": "Please Confirm",
|
||||
"signup_google": "Sign In with Google",
|
||||
"error_unknown_email": "This email/password combination is unknown. Try login with Google.",
|
||||
"error_unknown_email": "This email/password combination is unknown.",
|
||||
"error_password_confirmation": "The entered passwords don't match.",
|
||||
"error_domain_blocked": "Your domain is blocked.",
|
||||
"error_user_email_already_used": "This email address is already in use.",
|
||||
|
@ -46,7 +46,7 @@
|
||||
"specify": "Veuillez préciser:",
|
||||
"confirm": "Veuillez confirmer",
|
||||
"signup_google": "S'inscrire avec Google",
|
||||
"error_unknown_email": "Combinaison inconnue de l'email et mot de passe. Ou essayer de signer avec Google.",
|
||||
"error_unknown_email": "Combinaison inconnue de l'email et mot de passe.",
|
||||
"error_password_confirmation": "Les deux mots de passe ne correspondent pas.",
|
||||
"error_domain_blocked": "Ce domaine a été désactivé.",
|
||||
"error_user_email_already_used": "Cette adresse email est déjà enregistré.",
|
||||
|
12
models/db.js
12
models/db.js
@ -320,26 +320,26 @@ module.exports = {
|
||||
},
|
||||
|
||||
unpackArtifact: (a) => {
|
||||
if (a.tags) {
|
||||
if (a.tags && (typeof a.tags)=="string") {
|
||||
a.tags = JSON.parse(a.tags);
|
||||
}
|
||||
if (a.control_points) {
|
||||
if (a.control_points && (typeof a.control_points)=="string") {
|
||||
a.control_points = JSON.parse(a.control_points);
|
||||
}
|
||||
if (a.payload_alternatives) {
|
||||
if (a.payload_alternatives && (typeof a.payload_alternatives)=="string") {
|
||||
a.payload_alternatives = JSON.parse(a.payload_alternatives);
|
||||
}
|
||||
return a;
|
||||
},
|
||||
|
||||
packArtifact: (a) => {
|
||||
if (a.tags) {
|
||||
if (a.tags && (typeof a.tags)!="string") {
|
||||
a.tags = JSON.stringify(a.tags);
|
||||
}
|
||||
if (a.control_points) {
|
||||
if (a.control_points && (typeof a.control_points)!="string") {
|
||||
a.control_points = JSON.stringify(a.control_points);
|
||||
}
|
||||
if (a.payload_alternatives) {
|
||||
if (a.payload_alternatives && (typeof a.payload_alternatives)!="string") {
|
||||
a.payload_alternatives = JSON.stringify(a.payload_alternatives);
|
||||
}
|
||||
return a;
|
||||
|
@ -41,7 +41,7 @@ var SpacedeckBoardArtifacts = {
|
||||
if ("medium_for_object" in this) {
|
||||
var medium = this.medium_for_object[a._id];
|
||||
if (medium && a._id != this.editing_artifact_id) {
|
||||
medium.value(a.description);
|
||||
medium.value(a.description.toString());
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -89,7 +89,8 @@ var SpacedeckBoardArtifacts = {
|
||||
|
||||
artifact_is_text_blank: function(a) {
|
||||
if (a.description) {
|
||||
var filtered = a.description.replace(/<[^>]+>/g,"").replace(/\s/g,"");
|
||||
desc = a.description.toString();
|
||||
var filtered = desc.replace(/<[^>]+>/g,"").replace(/\s/g,"");
|
||||
return (filtered.length<1);
|
||||
} else {
|
||||
return false;
|
||||
|
@ -26,9 +26,10 @@ router.post('/', function(req, res) {
|
||||
//res.status(400).json({"error":"session.users"});
|
||||
})
|
||||
.then(user => {
|
||||
console.log("!!! user: ",user.password_hash);
|
||||
|
||||
if (bcrypt.compareSync(password, user.password_hash)) {
|
||||
if (!user) {
|
||||
res.sendStatus(404);
|
||||
}
|
||||
else if (bcrypt.compareSync(password, user.password_hash)) {
|
||||
crypto.randomBytes(48, function(ex, buf) {
|
||||
var token = buf.toString('hex');
|
||||
console.log("!!! token: ",token);
|
||||
|
@ -53,14 +53,7 @@ router.get('/', (req, res) => {
|
||||
space_id: req.space._id
|
||||
}}).then(artifacts => {
|
||||
async.map(artifacts, (a, cb) => {
|
||||
//a = a.toObject(); TODO
|
||||
|
||||
if (a.control_points) {
|
||||
a.control_points = JSON.parse(a.control_points);
|
||||
}
|
||||
if (a.payload_alternatives) {
|
||||
a.payload_alternatives = JSON.parse(a.payload_alternatives);
|
||||
}
|
||||
db.unpackArtifact(a);
|
||||
|
||||
if (a.user_id) {
|
||||
// FIXME JOIN
|
||||
@ -131,7 +124,8 @@ router.post('/:artifact_id/payload', function(req, res, next) {
|
||||
var stream = req.pipe(writeStream);
|
||||
|
||||
var progress_callback = function(progress_msg) {
|
||||
a.description = progress_msg;
|
||||
a.description = progress_msg.toString();
|
||||
db.packArtifact(a);
|
||||
a.save();
|
||||
redis.sendMessage("update", a, a.toJSON(), req.channelId);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user