Skip to content

Commit a4b276f

Browse files
committed
feat: inject after form
1 parent ef3d0ea commit a4b276f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

api/src/core/sso/sso-setup.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { existsSync } from 'node:fs';
22
import { copyFile, readFile, rename, unlink, writeFile } from 'node:fs/promises';
33

4+
5+
6+
7+
48
export const setupSso = async () => {
59
const path = '/usr/local/emhttp/plugins/dynamix/include/.login.php';
610

@@ -52,11 +56,11 @@ function verifyUsernamePasswordAndSSO(string $username, string $password): bool
5256
'!verifyUsernamePasswordAndSSO($username, $password)'
5357
);
5458

55-
// Inject the PHP include tag before the closing </body> tag
56-
fileContent = fileContent.replace(/<\/body>/i, `${tagToInject}\n</body>`);
59+
// Inject the PHP include tag after the closing </form> tag
60+
fileContent = fileContent.replace(/<\/form>/i, `</form>\n${tagToInject}`);
5761

5862
// Write the updated content back to the file
5963
await writeFile(path, fileContent);
6064

6165
console.log('Function replaced successfully.');
62-
};
66+
};

0 commit comments

Comments
 (0)