Permo Jacobs · Mar 18, 2019

How to create a CSP Login Page and control user sessions

How to create a CSP Login Page and control user sessions?

3 0 12 1,033
Log in or sign up to continue

Hi Permo!

Could you please provide more details?

adapt :== create your own class and inherit %CSP.Login

 If (%session.NewSession = 1) {
    // this is a new session
Set %session.Data("MyData") = 22 Write $Get(%session.Data("MyData")) // this should print 22 

Works, but customize ?

change Look & feel ?

i try override any method and gets 404

you better not change   %CSP.Login but make a personal copy and change this

404 = HTTP page not found. Most likely you put your copy to the wrong directory or namespace   

And then you have to put the reference in MgmtPortal Security-> WebApplications as Login page:
Again with the correct namespace and the correct directory.

i so sad, this history never end ...

this solution have no interaction with login failure, some ideas ??

Name the file login.csp

And inside it check for Error:ErrorCode request parameter:

My login page:</br>
<form method='post'>
Name: <input name="CacheUserName"/><br/>
Password: <input type='password' name="CachePassword"/><br/>
<input type='submit'/>

Set tMsg = $Get(%request.Data("Error:ErrorCode",1))
    If ((tMsg'="")&&($SYSTEM.Status.GetErrorCodes(tMsg)'[$$$ERRORCODE($$$RequireAuthentication))) {
        write "Auth failed!"

i forget something ...

file exist, but :

Not Found

The requested URL /csp/user/index.csp was not found on this server.

If you have index.csp and it is specified as login page and you are seeing 404 error, try following:

a) Enable Audit
b) Enable Protect event in Audit
c) Reproduce the problem.
e) Check Audit records if any Protect errors were logged

A few weird things with custom login pages:

CSPSystem needs read permission on the DB containing them. (You'll need to close CSPGateway connections after making this change so that it can reconnect with the right privileges.)

It's specified with the ".cls" extension in the web application configuration, not just the classname.

best solution to my problem look like stupid solution :

In my case : i need a custom home page, look no cache system (Custom Logo, Custom Form)

my solution :

1.- create a simple index.html with a login form (Action page is my App Home)
2.- put this file in web app folder

3.- Set "Login Page" to my index.html

Bingo !

to create your own Login Page you best start with  Class  %CSP.Login and adapt it to your specific needs.

defaulting to

and then you add the new Login Page to Security-> WebApplications