protected void uxChangePassword_Click(object sender, ImageClickEventArgs e) { if (!string.Equals(uxNewPassword.Text, uxConfirmNewPassword.Text)) { plus.Util.Helper.error("رمز عبور جدید و تکرار رمز عبور باید یکی باشد. لطفاٌ دقت نمایید.", ""); return; } if (uxNewPassword.Text.Contains(" ") || uxNewPassword.Text.Trim().Length < 8) { FailureText.Text = "رمز عبور باید حد اقل <b>۸ حرف</b> بوده و دارای <b>فاصله نباشد</b>."; FailureText.Visible = true; //plus.Util.Helper.error("رمز عبور باید حد اقل ۸ حرف بوده و دارای فاصله نباشد.", ""); return; } plus.Security.Principal.Identity user = plus.Security.Principal.Identity.Current; if (user.IsAuthenticated) { try { bool isChanged = plus.Security.Authentication.ChangePassword(UserName.Text, Password.Text, uxNewPassword.Text); if (isChanged) { Response.Redirect("PasswordChanged.aspx"); } } catch (Exception ex) { FailureText.Text = ex.Message; FailureText.Visible = true; } } }
public string Apply(object id, string Category) { bool isAuthorized = plus.Security.Authorization.Authorize(plus.Security.Util.GetClientIP(), false); if (!isAuthorized) { return(new plus.Web.Response(null, ResponseType.FAILED_AUTHORIZATION, plus._System.Configuration.Manager.Get(plus._System.Configuration.ConfigurationElement.SECURITY_PATH) + "unauthorized/").Serialize()); } plus.Security.Principal.Identity user = plus.Security.Principal.Identity.Current; IDictionary values = new Dictionary <string, object>(); values.Add("ProfileID", user.record.get("EmployeeID")); values.Add("RecordID", id); values.Add("Category", Category); values.Add("token", "token"); Response r = plus.Web.Service.Transaction.SaveNormal(System.Data.CommandType.StoredProcedure, values, "RegistryServices.dbo.spApply"); return(r.Serialize()); //object retVal = plus.Data.DAL.valueOf("RegistryServices", @"EXEC dbo.spApply @ProfileID, @RecordID, @Category", "ProfileID", user.record.get("EmployeeID"), "Category", Category, "RecordID", id); //return new Response(retVal, ResponseType.SUCCESS, "").Serialize(); }
protected void uxLogin_Click(object sender, EventArgs e) { //for test purpose plus.Security.Principal.Identity user = plus.Security.Authentication.Authenticate("jamshid.massomy", "password4321", "8989"); if (user.IsAuthenticated) { Response.Redirect("~/cpanel/"); } }
protected void Page_Load(object sender, EventArgs e) { plus.Security.Principal.Identity user = plus.Security.Principal.Identity.Current; FailureText.Visible = false; FailureText.Text = ""; if (!user.IsAuthenticated) { Response.Redirect("~/security/unauthorized"); } if (!IsPostBack) { UserName.Text = user.record.UserName; } }
protected void Page_Load(object sender, EventArgs e) { plus.Security.Authorization.Authorize(plus.Security.Util.GetClientIP(), true); if (!IsPostBack) { plus.Security.Principal.Identity user = plus.Security.Principal.Identity.Current; if (user.record.ID == 1) { //this else nothing } prepare(user); LoadSideBar(user); } }
protected void uxLogin_Click(object sender, EventArgs e) { plus.Security.Principal.Identity user = plus.Security.Authentication.Authenticate(UserName.Text, Password.Text, SecurityCode.Text); //var usr = user; //user.record.ID = 1202; FailureText.Visible = !user.IsAuthenticated; FailureText.Text = ""; if (!user.IsAuthenticated) { FailureText.Text = user.record.errorMessage; return; } if (user.IsAuthenticated) { Response.Redirect("~/cpanel/"); } }
void prepare(plus.Security.Principal.Identity user) { System.Text.StringBuilder sb = new System.Text.StringBuilder(""); Int16 ApplicationID = 0; string category = ""; IDictionary _screens = user.GetScreens(); foreach (DictionaryEntry screen in _screens) { IDictionary screenObj = (Dictionary <string, object>)screen.Value; if (screenObj["ParentID"] != DBNull.Value) { continue; } if (!Int16.Equals(ApplicationID, Convert.ToInt16(screenObj["ApplicationID"]))) { if (ApplicationID != 0) { sb.Append("</div>"); } // Applicatio div sb.AppendFormat("<h2>{0}</h2><h2 style='font: 0.9em/22px calibri; color:#666;'>{1}</h2><div class='div-application'>", screenObj["Application"], screenObj["APPDescription"]); } else if (!string.Equals(category, screenObj["Category"])) { sb.AppendFormat("<div class='div-application' style='border:none; min-height:1px'></div>"); } string icon = screenObj["icon"].ToString(); if (!icon.Contains("http")) { icon = "../skin/cpanel/" + icon + ".png"; } sb.AppendFormat("<div class='div-screen'><a href='../page/init#path:=::{0}'><img src='{1}'><label><bdi>{2}</bdi></label><span><bdi>{3}</bdi></span></a></div>", plus.Security.Cryptography.SimpleEncryption.EncryptPath((string)screenObj["FullPath"]), icon, screenObj["Name"], screenObj["Description"]); category = screenObj["Category"] as string; ApplicationID = Convert.ToInt16(screenObj["ApplicationID"]); } cpanel.InnerHtml = sb.ToString(); }
void LoadSideBar(plus.Security.Principal.Identity user) { string ustr = ""; ustr = "<img class='UserLogo' src='../skin/logo/Transport1.png'>"; ustr += "<span class='UserName'>" + " " + user.record.get("UserName").ToString().Replace('.', ' ') + "</span>"; ustr += "<span class='Desc'>(Traffic archive)</span>"; MenuUserDiv.InnerHtml = ustr; string val = Convert.ToString(plus.Data.DAL.valueOf("default", "select count(1) from [reg].[Notification] where StatusID = 1 AND ReceiverUserID = @ReceiverUserID", "ReceiverUserID", user.record.ID)); notification.InnerHtml = val; notificationCount.InnerHtml = val; string str = ""; foreach (System.Data.DataRow row in plus.Data.DAL.GetTable("Default", "select ID, Title, Notification, fromuser from reg.vNotification where StatusID = 1 AND ReceiverUserID = @ReceiverUserID", "ReceiverUserID", user.record.ID).Rows) { string s = row["Notification"].ToString(); if (s.Length > 25) { s = s.Substring(0, 25); } str = str + "<div class='notification' data-id='" + row["ID"] + "' onclick='showNotification(this)' >" + "<img class='icon' src='../skin/icon/notification1.png' />" + "<div class='info' >" + "<span class='Sender'><bdi>" + row["fromuser"] + "</bdi></span>" + "<span class='Title'><bdi>" + row["Title"] + " </bdi></span>" + "</div>" + "<span class='Description'><bdi>" + s + " ...</bdi></span>" + "</div>"; } notificationList.InnerHtml = str; }