
Description
Forgot about email/phone verification challenge when you need to change the current connected account username or password, complete 2FA verification, or fix 2FA loop issue. This modification will help you did all the changes easy.
Instruction
Suggestion: use Microsoft Visual Studio Code for code editing and profiling. All your syntax error will be highlighted.
Before we start making changes to the code, I strongly recommend you to backup the source files so that you do not have any problems if something goes wrong.
The list of files that we will change:
AccountController.php account.fragment.php [Optionally] PMAccountController.php pm.account.fragment.php
Step 1
Open file AccountController.php (if you’re using Proxy Manager module developed by Nextpass (Joe Cramer) open also PMAccountController.php).
In one or in both files find line with that code:
// Remove previous session folder to make guarantee full relogin $session_dir = SESSIONS_PATH . "/" . $AuthUser->get("id") . "/" . $this->username; if (file_exists($session_dir)) { delete($session_dir); }
Replace this line with that:
if (!Input::post("old-session")) { // Remove previous session folder to make guarantee full relogin $session_dir = SESSIONS_PATH . "/" . $AuthUser->get("id") . "/" . $this->username; if (file_exists($session_dir)) { delete($session_dir); } }
Step 2
Open file account.fragment.php (if you’re using Proxy Manager module developed by Nextpass (Joe Cramer) open also pm.account.fragment.php). In one or in both files find line with that code:
<?php if ($Settings->get("data.proxy") && $Settings->get("data.user_proxy")): ?>
And before this line insert that code:
<div class="mt-20"> <label> <input type="checkbox" class="checkbox" name="old-session" value="1"> <span> <span class="icon unchecked"> <span class="mdi mdi-check"></span> </span> <?= __("Don't remove the previous Instagram-session") . " (" . __("Optional") . ")" ?> </span> </label> <ul class="field-tips"> <li><?= __("This is an optional feature and needed only in special cases.") ?></li> </ul> </div>
You can add this code in different sections of <div class=”js-login”>.
This is an example how we added this code:

Step 3 (Optional)
This step you should complete only if you are implemented our 2FA modification.
Open file InstagramController.php and find line with that code:
$text[1] = __("Two Factor Authentication (2FA) enabled in you account. Fill the login form and connect your account again by saving changes.");
Replace this line with that:
$text[1] = __("Two Factor Authentication (2FA) enabled in you account. Fill the login form and connect your account again by saving changes.") . __("Don't forget to check <b>Don't remove the previous Instagram-session</b> checkbox.");
That’s all, thank you!
Now clean browser cache and take a look at your changes. For example I attached screenshot from Chrome.
