nodebb-plugin-phone-verification 1.2.2 → 1.2.3
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/library.js +19 -10
- package/package.json +1 -1
- package/plugin.json +1 -1
package/library.js
CHANGED
|
@@ -76,7 +76,7 @@ plugin.checkPostingPermissions = async function (data) {
|
|
|
76
76
|
if (!phoneData || !phoneData.phoneVerified) {
|
|
77
77
|
const userSlug = await User.getUserField(uid, 'userslug');
|
|
78
78
|
const editUrl = userSlug ? `/user/${userSlug}/edit` : '/user/me/edit';
|
|
79
|
-
throw new Error(
|
|
79
|
+
throw new Error(`חובה לאמת מספר טלפון כדי להמשיך את הפעילות בפורום.<br/>אנא גש ל<a href="${editUrl}">הגדרות הפרופיל שלך</a>.`);
|
|
80
80
|
}
|
|
81
81
|
return data;
|
|
82
82
|
};
|
|
@@ -93,7 +93,9 @@ plugin.checkVotingPermissions = async function (data) {
|
|
|
93
93
|
|
|
94
94
|
const phoneData = await plugin.getUserPhone(uid);
|
|
95
95
|
if (!phoneData || !phoneData.phoneVerified) {
|
|
96
|
-
|
|
96
|
+
const userSlug = await User.getUserField(uid, 'userslug');
|
|
97
|
+
const editUrl = userSlug ? `/user/${userSlug}/edit` : '/user/me/edit';
|
|
98
|
+
throw new Error(`חובה לאמת מספר טלפון כדי להמשיך את הפעילות בפורום.<br/>אנא גש ל<a href="${editUrl}">הגדרות הפרופיל שלך</a>.`);
|
|
97
99
|
}
|
|
98
100
|
return data;
|
|
99
101
|
};
|
|
@@ -101,27 +103,34 @@ plugin.checkVotingPermissions = async function (data) {
|
|
|
101
103
|
plugin.checkMessagingPermissions = async function (data) {
|
|
102
104
|
const uid = data.fromUid;
|
|
103
105
|
if (!uid || parseInt(uid, 10) === 0) return data;
|
|
106
|
+
|
|
104
107
|
const settings = await plugin.getSettings();
|
|
105
108
|
if (!settings.blockUnverifiedUsers) return data;
|
|
109
|
+
|
|
106
110
|
const isAdmin = await User.isAdministrator(uid);
|
|
107
111
|
if (isAdmin) return data;
|
|
112
|
+
|
|
108
113
|
const phoneData = await plugin.getUserPhone(uid);
|
|
109
114
|
if (phoneData && phoneData.phoneVerified) {
|
|
110
115
|
return data;
|
|
111
|
-
}
|
|
116
|
+
}
|
|
112
117
|
const Messaging = require.main.require('./src/messaging');
|
|
113
118
|
const roomUids = await Messaging.getUidsInRoom(data.roomId, 0, -1);
|
|
114
119
|
const targetUids = roomUids.filter(id => parseInt(id, 10) !== parseInt(uid, 10));
|
|
115
|
-
|
|
120
|
+
if (targetUids.length === 0) {
|
|
121
|
+
const userSlug = await User.getUserField(uid, 'userslug');
|
|
122
|
+
const editUrl = userSlug ? `/user/${userSlug}/edit` : '/user/me/edit';
|
|
123
|
+
throw new Error(`חובה לאמת מספר טלפון כדי להמשיך את הפעילות בפורום.<br/>אנא גש ל<a href="${editUrl}">הגדרות הפרופיל שלך</a>.`);
|
|
124
|
+
}
|
|
116
125
|
for (const targetUid of targetUids) {
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
126
|
+
const isTargetAdmin = await User.isAdministrator(targetUid);
|
|
127
|
+
if (!isTargetAdmin) {
|
|
128
|
+
const userSlug = await User.getUserField(uid, 'userslug');
|
|
129
|
+
const editUrl = userSlug ? `/user/${userSlug}/edit` : '/user/me/edit';
|
|
130
|
+
throw new Error(`חובה לאמת מספר טלפון כדי להמשיך את הפעילות בפורום.<br/>אנא גש ל<a href="${editUrl}">הגדרות הפרופיל שלך</a>.`);
|
|
121
131
|
}
|
|
122
132
|
}
|
|
123
|
-
|
|
124
|
-
throw new Error('חובה לאמת מספר טלפון כדי להמשיך את הפעילות בפורום.<br/>אנא גש להגדרות הפרופיל שלך.');
|
|
133
|
+
return data;
|
|
125
134
|
};
|
|
126
135
|
|
|
127
136
|
// ==================== שליחת שיחה קולית ====================
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "nodebb-plugin-phone-verification",
|
|
3
3
|
"name": "Phone Verification",
|
|
4
4
|
"description": "אימות מספר טלפון נייד בתהליך ההרשמה לפורום ובפרופיל המשתמש",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.3",
|
|
6
6
|
"library": "./library.js",
|
|
7
7
|
"hooks": [
|
|
8
8
|
{ "hook": "filter:register.check", "method": "checkRegistration" },
|