user.prototype.passwordSecurity = function(password) { //用户密码加密函数 password = Crypto.MD5(password); return password; };
function run_install_scripts() { var models = { User: User, Post: Post, BlockContent: BlockContent }; var scripts = { User: [ { username: "******", password: crypto.SHA256("admin"), full_name: "Administrator", email: "*****@*****.**" } ], Post: [ { permalink: "test-post-1", title: "Test Post 1" , content: "Test Post 1 Content", excerpt: "Test Post 1 Content Overview", thumbnail_filename: "1.png", userId: 1, published_date: new Date(), published: true }, { permalink: "test-post-2", title: "Test Post 2", content: "Test Post 2 Content", excerpt: "Test Post 2 Content Overview", thumbnail_filename: "2.png", userId: 1, published_date: new Date(), published: true } ], BlockContent: [ { permalink: "test-block-content-1", title: "Test Block Content 1" , content: "Test Block Content 1's Content" }, { permalink: "test-block-content-2", title: "Test Block Content 2", content: "Test Block Content 2's Content" } ] }; for ( var script_name in scripts ) { var model = models[script_name]; scripts[script_name].forEach( function( script_obj ) { model.create( script_obj, function() {} ); }); Install.create( { "isInstalled": true }, function(err, install) { render({ message: !err ? "Congratulations! You have successfully install Neso" : "Sorry! Installation Unsuccessful." }); } ); } }
user.prototype.setImageAvatar = function() { var userobj = this.get("userobj"); userobj.avatarImage = 'http://www.gravatar.com/avatar/'+Crypto.MD5(userobj.email)+".png?s=50"; this.set("userobj",userobj); };