fix: Auto-remove spaces from Gmail App Password
- Google provides App Password with spaces (e.g. 'abcd efgh ijkl mnop') - Backend now automatically removes all spaces before saving - Users can paste password directly from Google without manual cleanup - Also trim gmail_user for safety
This commit is contained in:
@@ -30,16 +30,18 @@ exports.updateGmailSettings = async (req, res, next) => {
|
|||||||
if (gmail_user) {
|
if (gmail_user) {
|
||||||
await Settings.upsert({
|
await Settings.upsert({
|
||||||
key: 'gmail_user',
|
key: 'gmail_user',
|
||||||
value: gmail_user,
|
value: gmail_user.trim(),
|
||||||
is_encrypted: false,
|
is_encrypted: false,
|
||||||
description: 'Gmail email address',
|
description: 'Gmail email address',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gmail_app_password) {
|
if (gmail_app_password) {
|
||||||
|
// Remove all spaces from App Password (Google gives it with spaces)
|
||||||
|
const cleanPassword = gmail_app_password.replace(/\s+/g, '');
|
||||||
await Settings.upsert({
|
await Settings.upsert({
|
||||||
key: 'gmail_password',
|
key: 'gmail_password',
|
||||||
value: gmail_app_password,
|
value: cleanPassword,
|
||||||
is_encrypted: true,
|
is_encrypted: true,
|
||||||
description: 'Gmail App Password',
|
description: 'Gmail App Password',
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user