I need to add an additional field to the login page. What I have so far is I manually added the html code, for the additional field, to login.php then made the login.php file readonly.
My two questions are:
1 - Is it acceptable to make a file readonly in order to keep Appgini from overwritting it?
2- Is there a more appropriate way to add the html code rather than the way I did it?
Thanks,
TD
Modifying login page
Re: Modifying login page
Hi,
1, the danger by making the file read-only for AppGini to not overwrite it is, that with an updated version and "necessary" modification to that file, you will miss it.
2, You can use the hooks/header-extra.php file to do your changes.
- check if you are on the login page
- apply your modification.
1, the danger by making the file read-only for AppGini to not overwrite it is, that with an updated version and "necessary" modification to that file, you will miss it.
2, You can use the hooks/header-extra.php file to do your changes.
- check if you are on the login page
- apply your modification.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Modifying login page
Thanks for helping. Can you direct me to an example of what the code would look like to prepend html code to exisiting login page code?
TD
TD
Re: Modifying login page
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: Modifying login page
Thank you for helping. I am not sure what the final difference this approach provides over just making the customized files read-only. I am told by support that you can use header-extras.php and footer-extras.php to modify the html on pages but I so far haven't found an example to help me get started. Perhaps I haven't looked enough so far but as I keep looking if anyone knows of such examples please share them.
Thanks again for trying to help,
TD
Thanks again for trying to help,
TD
Re: Modifying login page
Hi,
just try. Add something (like: AAAAAAAAAAA) to header-extras.php and reload your page, see what happens.
header-extras is read by php when the page will be created. The contents will be added to (all) your pages.
Olaf
just try. Add something (like: AAAAAAAAAAA) to header-extras.php and reload your page, see what happens.
header-extras is read by php when the page will be created. The contents will be added to (all) your pages.
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: Modifying login page
I'll take a shot at it but I need to limit the changes to a particular page. Somewhere I saw code that allowed you to identity the page you wanted the code to be applied to, can you direct me to that code? I never could find it again.
Thanks again,
TD
Thanks again,
TD
Re: Modifying login page
Hi,
look in the /hooks/tablename.php -> _init function. There you can change the header for that table and for tableview, detailview etc. It's already in the function, you just need to add your own code to the specific switch-statement.
Please note, the comment to this, that is: If you add your header code there, header-extras is not used EXECPT you include it also with %header%
Olaf
look in the /hooks/tablename.php -> _init function. There you can change the header for that table and for tableview, detailview etc. It's already in the function, you just need to add your own code to the specific switch-statement.
Please note, the comment to this, that is: If you add your header code there, header-extras is not used EXECPT you include it also with %header%
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: Modifying login page
Thank you, I'll go look there now. BTW, are the files in the hocks folder ever overwritten by Appgini?
Re: Modifying login page
Finally got it, thanks to the help I received here and watching the "Customizing the Appearance of the login page" video at Udemy.com.
Here is the code:
/hooks/footer-extras.php:
Notice that I am prepending my code to the html FORM tag using JQuery. If this page had had more than one form on it then this would not have worked.
/hooks/_global.php
This code stores the dept_id in a session variable so it is available throughout the app.
/hooks/apparatus.php
This code needs to be applied to every table in the app as it limits the records shown the user to just his dept_id. Be sure to change the table name and session variable name as needed.
Hope this helps someone else,
TD
Here is the code:
/hooks/footer-extras.php:
Code: Select all
<?php
$Script_name = basename($_SERVER['PHP_SELF']);
if ($Script_name == 'index.php' && isset($_GET['signIn'])) {
?>
<script>
var deptId_fld = '<div class="form-group">';
deptId_fld += '<label class="control-label" for="dept_id"><?php echo 'Department ID'; ?></label>';
deptId_fld += '<input class="form-control" name="dept_id" id="dept_id" type="text" placeholder="<?php echo 'Department ID'; ?>" required>';
deptId_fld += "</div>";
$j('form').prepend(deptId_fld);
$j("#dept_id").focus();
</script>
<?php
}
?>
/hooks/_global.php
Code: Select all
<?php
function login_ok($memberInfo, &$args) {
$_SESSION['dept_id'] = $_POST['dept_id'];
return '';
}
?>
/hooks/apparatus.php
Code: Select all
<?php
function apparatus_init(&$options, $memberInfo, &$args) {
$dept_id = $_SESSION['dept_id'];
$options->QueryWhere = 'WHERE `apparatus`.`dept_id` = '.$dept_id;
return TRUE;
}
?>
Hope this helps someone else,
TD
Re: Modifying login page
Hi,
thanks for sharing.
Just a thought:
But: Why do you want the department id? This should be tied to the user in an internal table, so you can always look it up after the user has logged in.
Or: Simply use usergroupd and let people see only records from their group (e.g. department).
Olaf
thanks for sharing.
Just a thought:
But: Why do you want the department id? This should be tied to the user in an internal table, so you can always look it up after the user has logged in.
Or: Simply use usergroupd and let people see only records from their group (e.g. department).
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view