logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
RaelMatrix  
#1 Posted : Wednesday, October 18, 2017 3:32:17 PM(UTC)
RaelMatrix

Rank: Newbie

Groups: Registered
Joined: 9/25/2017(UTC)
Posts: 0
Man
Italy
Location: Turin

Hi there,

i'm new to Seal Report but i can say its a great product!

Seal reports are used by intranet users already logged on intranet-system.
I call Seal web application (eg. Seal/Main) from a front-end program (which is resident into Seal virtual dir).
That FEP create Session() with intranet userid.
The goal is fill the Seal login authentication panel with the login name passed via Session().

Here the basic authentication routine. It work fine but i wish pre-fill WEBUSERNAME with a name coming from DB.

Thank you.


@using System
@using Seal.Model
@using System.Data
@using System.Data.OleDb
@using Seal.Helpers
@using System.Web
@using System.Web.Routing;
@using System.Collections.Generic
@using System.Data.SqlClient
@{
SecurityUser user = Model;

user.Name = user.WebUserName; //Display name
string utente = user.WebUserName.ToUpper();
string password = user.WebPassword.ToUpper();

string connectionString = "Provider=SQLOLEDB; Data Source=192.168.0.137,1433; Persist Security Info=True; Initial Catalog=INTRANET; User Id=xxxxx; Password=xxxxxx;";
OleDbConnection connection = new OleDbConnection(connectionString);
connection.Open();
string sql = "select dwh from alfaomega left join userlist on userlist.id = alfaomega.id where upper(userlist.name) = '" + utente +"'";
sql = sql + " And upper(userlist.password) = '" + password +"'";
OleDbCommand command = new OleDbCommand(sql, connection);

string dwh = Convert.ToString(command.ExecuteScalar());
if(dwh == "")
{
dwh = "NO";
}
command.Dispose();
connection.Close();

switch(dwh)
{
case "NO":
throw new Exception("Utente non autorizzato");
break;
default:
user.AddSecurityGroup(dwh);
break;
}

var usr = user.AuthenticationSummary;

System.Web.HttpContext.Current.Session["utente"] = "";
if(usr.Contains("User login name:"))
{
usr = usr.Substring(usr.IndexOf("User login name:")+17);
usr = usr.Substring(0,usr.IndexOf("User display name:")-1);
System.Web.HttpContext.Current.Session["utente"] = usr.ToUpper();
}
}
RaelMatrix  
#2 Posted : Friday, October 27, 2017 7:25:38 PM(UTC)
RaelMatrix

Rank: Newbie

Groups: Registered
Joined: 9/25/2017(UTC)
Posts: 0
Man
Italy
Location: Turin

Hi folks,
anyone can help me about read a outside session("userid") value for use it on sql select? Thanks
epf  
#3 Posted : Monday, October 30, 2017 8:40:53 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
Your question is not so clear...what is really your problem...Webusername comes from the login window.
RaelMatrix  
#4 Posted : Tuesday, October 31, 2017 5:51:47 AM(UTC)
RaelMatrix

Rank: Newbie

Groups: Registered
Joined: 9/25/2017(UTC)
Posts: 0
Man
Italy
Location: Turin

hi, i"ll explain the scenario.
a session('xxx") string contain the user name that I wish use for login.
need populate webusername before show the panel login.
that filled only the webusername, user must only type the password.

thankyou.
epf  
#5 Posted : Tuesday, October 31, 2017 7:23:34 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
Ok, I understand, you have to modify JavaScript omn client side to achieve this,
either
you store the username in a Cookie on your browser and you reuse it when displaying the Login window
OR
you call the Server (using a new call or perhaps enhancing GetProfile ?) to get the name to display in the Login Window

You won't be able to do that through the Login Script...

Good luck.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.