@xuda.io/account_module 1.2.413 → 1.2.415
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +11 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -30,6 +30,12 @@ export const update_account_info = async function (req, job_id, headers) {
|
|
|
30
30
|
const { uid } = req;
|
|
31
31
|
const data = req;
|
|
32
32
|
|
|
33
|
+
delete data.gtp_token;
|
|
34
|
+
delete data.uid;
|
|
35
|
+
delete data.token_ret;
|
|
36
|
+
delete data.job_id;
|
|
37
|
+
delete data.profile_avatar;
|
|
38
|
+
|
|
33
39
|
function validate_input(string, max_length, is_mandatory, is_pass) {
|
|
34
40
|
if (!/^[a-zA-Z0-9,.@ ]*$/.test(string) && !is_pass) {
|
|
35
41
|
// if (!preg_match('^[a-zA-Z0-9,.@ ]*$', string) && !is_pass) {
|
|
@@ -54,16 +60,11 @@ export const update_account_info = async function (req, job_id, headers) {
|
|
|
54
60
|
await marketplace_module.marketplace_save_user({ uid });
|
|
55
61
|
|
|
56
62
|
_.forEach(data, function (val, key) {
|
|
57
|
-
account_info_changes_arr.push(key);
|
|
58
63
|
if (account_obj.account_info[key] !== val) {
|
|
59
64
|
change += ' from ' + account_obj.account_info[key] + ' to ' + val;
|
|
60
|
-
|
|
65
|
+
account_info_changes_arr.push(key);
|
|
61
66
|
account_obj.account_info[key] = val;
|
|
62
67
|
|
|
63
|
-
if (key === 'profile_picture') {
|
|
64
|
-
account_obj.account_info['profile_avatar'] = '';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
68
|
if (account_obj.account_info.account_type === 'business') {
|
|
68
69
|
if (key === 'company_name' && validate_input(val, 150, true, false) < 0) {
|
|
69
70
|
error[key] = 'Invalid company';
|
|
@@ -110,6 +111,10 @@ export const update_account_info = async function (req, job_id, headers) {
|
|
|
110
111
|
return { code: 1300, data: 'no change' };
|
|
111
112
|
}
|
|
112
113
|
|
|
114
|
+
if (account_info_changes_arr.includes('profile_picture')) {
|
|
115
|
+
account_obj.account_info['profile_avatar'] = '';
|
|
116
|
+
}
|
|
117
|
+
|
|
113
118
|
//clean up received from req
|
|
114
119
|
delete account_obj.account_info.gtp_token;
|
|
115
120
|
delete account_obj.account_info.client_id;
|