modules/account.js
function getUIDCallback (err, uid) {
		if (err) {
			return onDone('UID_ERROR');
		}
		var ip = (extra) ? extra.conn.host : "server";
		// NOTE: by default a user is a normal user, user 'groups' can later be customized
		var reg = {
			uid: 		uid,
			account:	args.account,
			password:	l_encryptPass(args.password),
			email:		args.email,
			// verify:		{email_verify: false, phone_verify: false},
			tokens: 	{reset: '', pass: {}},
			enc_type:	l_enc_type,
			control:	{groups: args.groups || [], permissions: []},
			data: 		args.data || {},
			login: 		{IP: ip, count: 1}
		};

		// special handling (by default 'admin' account is special and will be part of the 'admin' group by default
		if (!args.authWP && reg.account === 'admin') {
			reg.control.groups.push('admin');
		}

		LOG.warn('creating new account [' + args.account + ']...', l_name);
		l_accounts.add(reg, function (err) {
			if (err) {
				return onDone('DB_ERROR', err);
			}
			// register success
			LOG.warn('account register success', l_name);
			onDone(null);
		});
	}
function getUIDCallback (err, uid) {
		if (err) {
			return onDone('UID_ERROR');
		}
		var ip = (extra) ? extra.conn.host : "server";
		// NOTE: by default a user is a normal user, user 'groups' can later be customized
		var reg = {
			uid: 		uid,
			account:	args.account,
			password:	l_encryptPass(args.password),
			email:		args.email,
			// verify:		{email_verify: false, phone_verify: false},
			tokens: 	{reset: '', pass: {}},
			enc_type:	l_enc_type,
			control:	{groups: args.groups || [], permissions: []},
			data: 		args.data || {},
			login: 		{IP: ip, count: 1}
		};

		// special handling (by default 'admin' account is special and will be part of the 'admin' group by default
		if (!args.authWP && reg.account === 'admin') {
			reg.control.groups.push('admin');
		}

		LOG.warn('creating new account [' + args.account + ']...', l_name);
		l_accounts.add(reg, function (err) {
			if (err) {
				return onDone('DB_ERROR', err);
			}
			// register success
			LOG.warn('account register success', l_name);
			onDone(null);
		});
	}
function getUIDCallback ( err , uid ) { if ( err ) { return onDone ( 'UID_ERROR' ) ; } var ip = ( extra ) ? extra . conn . host : "server" ; // NOTE: by default a user is a normal user, user 'groups' can later be customized var reg = { uid : uid , account : args . account , password : l_encryptPass ( args . password ) , email : args . email , // verify:		{email_verify: false, phone_verify: false}, tokens : { reset : '' , pass : { } } , enc_type : l_enc_type , control : { groups : args . groups || [ ] , permissions : [ ] } , data : args . data || { } , login : { IP : ip , count : 1 } } ; // special handling (by default 'admin' account is special and will be part of the 'admin' group by default if ( ! args . authWP && reg . account === 'admin' ) { reg . control . groups . push ( 'admin' ) ; } LOG . warn ( 'creating new account [' + args . account + ']...' , l_name ) ; l_accounts . add ( reg , function ( err ) { if ( err ) { return onDone ( 'DB_ERROR' , err ) ; } // register success LOG . warn ( 'account register success' , l_name ) ; onDone ( null ) ; } ) ; }
generate unique user_id
generate unique user_id