help with security redirect.....logout function

Geetings alll

I have modified the project management template to suite my needs and created a group security using the provided security modules, but am having a problem with the
“access_logged” page, I have modified the OnValidate to redirect depending on group… which isnt working… it doesnt redirect and am not sure if it logs the user out.
As its something I would do on just about every project its important for me to get this one right and working, so any help would be greatly appreciated!

I initially copied the login form and created another 2, ie one for client, one for member and one for admin, but I cant seem to find the link or redirect which tells the login page to open the access_logged page if user still logged in, otherwise I would simply create 2 more versions of that also and change the redirect for that… maybe that would be a better option if somebody knows where I can edit that.

OnValidate code:
sc_log_add(‘login’, {lang_login_ok});
sc_logged_out([user]);
sc_logged_in([user]);
sc_user_logout(‘logged_user’, ‘logout’, ‘login_admin’);

// Redirection
if ([glo_usr] == ‘Administrator’)
{
sc_redir(‘menu_admin’);
}
elseif ([glo_usr] == ‘Client’)
{
sc_redir(‘menu_client’);
}
elseif ([glo_usr] == ‘Member’)
{
sc_redir(‘menu_member’);
}

Are you sure that the redir part is hit? I have a feeling that it doesn’t due to the sc_user_logout. These procs are not documented, so I suggest you add some log code to see what your app is doing. Further, I have a feeling that glo_usr is the user name, not the group name?

Hey Albert :slight_smile:

Am not sure the redirect is working, it sticks on the access_logged page, basically the pages are created by script-case not myself as am using the built in security module for groups and its one of the pages it creates to check if the user is still logged in or not.
process is as follows: user opens index page being a selection page of which type of user. then the login page which there are 3 off (copied the original an extra 2 times and changed names and redirect to the menu i wanted), when user logs in it then opens the “access_logged” page which either logs you out and back in again or redirects. At the moment it just sticks on the stupid window, no idea if it is still logging the user out or if its simply the redirect which isnt working…

The only thing I changed was the redir(menu); to the one above.
The user global is [usr_login], found somewhere either here in forum that the one for group is [glo_usr]… but maybe even that is incorrect… as you said this is very badly documented, even thou it should be one of the basics to be logged in my humble opinion.

Not sure. Would it be an option to add just a ‘role’ field to the logonpage? Then start from there? You don’t have to clone all the pages. I still would start logging or displaying fields to see what’s in them. I always use a switch in stead of elseif because if none of the argues are hit, you have a default to move you to an error page. But in this case you program is hanging in some module.

thanks albert a role field might be the solution, will give that a go se if i get anywhere :slight_smile: