Hi,


I have to login only when the user exists else, I have to redirect it to Access denied page, not like a feedback message. how can I the achieve it?

Hi,

You have to login instead of giving a feedback message and ending the flow in an End, remove the feedback message and put a screen at the end of the flow, the screen where you want the user to be directed.

Cheers,
Nuno Verdasca

Hi Nuno,


I am getting CustomHandlers error page, if I am trying to connect it to screen.


Is this this the way you mentioned?


Thanks & Regards,

Manasa

Yes Manasa, but add the exception handling.

Regards,
Nuno

Hi Manasa, 

Login is done by the Login page. By default, only an existing user can login. 

If your page needs a logged in user, just uncheck the 'Anonymous' option of that page, and only registered (logged in) users can go to that page. 

The system checks this for you, ypu don't need extra code. 

Cheers 

P. S. If the user tries to reach a registered page without being logged in, he will be redirected to the Login Page, so he can login. 

This is the normal behaviour of the application. 

If you don't want this (don't recommend), you can manipulate the global exception handler on common flow to navigate to your desired warning page, on security exception handler. 

Cheers. 

P. S. 2 There is already a Invalid Permissions page, by default, that you can use, replacing the Destination to the Login page for this page instead, in the Global Exception handler. 

Hi Eduardo,

Eduardo Jauch wrote:

P. S. 2 There is already a Invalid Permissions page, by default, that you can use, replacing the Destination to the Login page for this page instead, in the Global Exception handler. 

Can I get any sample to define exception handler for this? 


Thanks & Regards,

Manasa.Ks


Traditional web app, react or mobile? 

I'm assuming it's the first. 

But you simply don't need to create code. Just select the screen and in the properties of the screen, uncheck the Anonymous Role option (leave the mark on Registered) 

Only logged in users will be able to reach the page. Anonymous users will be sent to the Login page automatically (normal expected behaviour) 

Hi,

Eduardo Jauch wrote:

Traditional web app, react or mobile? 

I'm assuming it's the first. 

But you simply don't need to create code. Just select the screen and in the properties of the screen, uncheck the Anonymous Role option (leave the mark on Registered) 

Only logged in users will be able to reach the page. Anonymous users will be sent to the Login page automatically (normal expected behaviour) 

In traditional web, I have given access to Registered users only, where I will get back to the Login page. But I want the page to Navigate to Invalid permission page.

Yes, newbie to outsystems.



Hi,

Method 1) Go to the NoPermissions screen, open the preparation, and delete everything between the Start and the Destination to Common\InvalidPermissions.

Method 2) Go to the OnException and change the Common|NoPermission destination on the Security Exception Handler to Common\InvalidPermissions.

Both will redirect any user (be logged or not) to the InvalidPermissions screen every time security (permissions) exception raises. You can personalize this screen.

Hope this helps.

Cheers.

Eduardo Jauch

Hi Eduardo,


Thank you very much for your reply. I tried both the methods, still not able to direct it to the Common\InvalidPermissions or to the Personalised page. Its giving CustomHandlers/internalerror.aspx error page, before getting into the Login page.

Does any other exceptions need to be set up? or way out?


Thanks & Regards,

Manasa


Hi, Manasa.

Please, open the Service Center and find the error message. Put it here, please.

Cheers.

Hi Eduardo,


In service center error log is- Registered Role required. As I have user list for my application, and Login page is public and for both Anonymous and Registered have access.

I have set the Users in User management, and getting those Users in the application as well(System-User).

Can please tell me what else I have to do?

Thanks & Regards,

Manasa

Hi Manasa,


can you provide sample oml or images . it will help full for us to understand what you are trying.


Regards

Rahul Sahu

Hi Rahul,


As of validation, If the users exists then will be able to access the URL/Application. If the User doesn't exists In the User(Registered) it has to redirect it to the ERROR or INVALID page. This is what I am trying to do, where as the login preparation I have shared above. 


Also user list exists for the application. But why am I getting the Error Registered role required.


I just want to check User Registered or not, is non-registered user it should redirect to Access denied page, not the Login page.


Regards,

Manasa

HI please add a breakpoint in the login preparation and then debug it and check what is going on. I hope there are any other issues. You have to check it in the debugging method and then you will need to update the section as needed.

Hello Manasa,

Please, refer to the attached OML.

I created a new application and the only changes I did were:

1. Replaced the destination of the Security Exception on the OnException handler:


2. Replaced the TEXT of the message in the InvalidPermissions page, just to be more explicitly that when you click in the link, you go to the Login page.

I didn't change anything else. Login code is the original one. Didn't add any other code to deal with the login on any other page. Just standard stuff. 

Notice that the InvalidPermissions page Roles the Anonymous role is checked.

What happens is that when you open the app without being logged in, you are redirected to the InvalidPermissions page. From there you can click to go to the login, and after successful login, you are redirected to the Home page.

Hope this helps.

Cheers.