예제 #1
0
 protected void RequestCard()
 {
     string xmlToken;
     xmlToken = Request.Params["xmlToken"];
     if (xmlToken == null || xmlToken.Equals(""))
     {
         return;
     }
     else
     {
         Token token = new Token(xmlToken);
         Session["Token"] = token;
         ClientScript.RegisterClientScriptBlock(GetType(), "redirect",
             String.Format("window.opener.location = '{0}'; window.close();",
             Config.Urls.Home + "/Registration.aspx?token=1"), true);
         return;
     }
 }
예제 #2
0
        public Address(string infoCardToken)
        {
            Token token=null;
            token = new Token(infoCardToken);

            this.FirstName = token.Claims[ClaimTypes.GivenName];
            this.LastName = token.Claims[ClaimTypes.Surname];
            this.Email = token.Claims[ClaimTypes.Email];
            this.Street1 = token.Claims[ClaimTypes.StreetAddress];
            this.City = token.Claims[ClaimTypes.Locality];
            this.StateOrProvince = token.Claims[ClaimTypes.StateOrProvince];
            this.Country = token.Claims[ClaimTypes.Country];
            this.Zip = token.Claims[ClaimTypes.PostalCode];
            
            this.UserName = token.UniqueID;


        }
예제 #3
0
 protected void RequestCard()
 {
     string xmlToken;
     xmlToken = Request.Params["xmlToken"];
     if (xmlToken == null || xmlToken.Equals(""))
     {
         return;
     }
     else
     {
         Token token = new Token(xmlToken);
         CurrentUserSession.TokenUniqueId = token.UniqueID;
         CurrentUserSession.Update();
         StatusPageMessage = Lang.Trans("Information card saved successfully.");
         ClientScript.RegisterClientScriptBlock(GetType(), "redirect",
             String.Format("window.opener.location = '{0}'; window.close();",
             Config.Urls.Home + "/ShowStatus.aspx"), true);
         return;
     }
 }
예제 #4
0
 public ClaimTextCollection(Token instance)
 {
     _instance = instance;
 }
예제 #5
0
        protected void TryLogin()
        {
            string xmlToken;
            xmlToken = Request.Params["xmlToken"];
            if (xmlToken == null || xmlToken.Equals(""))
            {
                return;
            }

            Token token = new Token(xmlToken);
            UserSession user = null;
            try
            {
                string username = Classes.User.GetUsernameByTokenUniqueId(token.UniqueID);
                if (username == null)
                {
                    ClientScript.RegisterClientScriptBlock(GetType(), "error",
                        String.Format("var alert_string = '{0}';", Lang.Trans("This card is not associated with any account!")), 
                        true);
                    return;
                }
                user = new UserSession(username);
                Classes.User.AuthorizeByToken(token.UniqueID);
                user.Authorize(Session.SessionID);
            }
            catch (NotFoundException err)
            {
                ClientScript.RegisterClientScriptBlock(GetType(), "error", String.Format("var alert_string = '{0}';",
                                                                                         err.Message), true);
                return;
            }
            catch (AccessDeniedException err)
            {
                ClientScript.RegisterClientScriptBlock(GetType(), "error", String.Format("var alert_string = '{0}';",
                                                                                         err.Message), true);
                return;
            }
            catch (SmsNotConfirmedException err)
            {
                ClientScript.RegisterClientScriptBlock(GetType(), "error",
                    String.Format("var alert_string = '{0}'; window.opener.location = 'SmsConfirm.aspx?username={1}'; window.close();",
                    err.Message, user.Username), true);
                return;
            }
            catch (ArgumentException err)
            {
                ClientScript.RegisterClientScriptBlock(GetType(), "error", String.Format("var alert_string = '{0}';",
                                                                                         err.Message), true);
                return;
            }
            catch (Exception err)
            {
                Global.Logger.LogWarning(err);
                ClientScript.RegisterClientScriptBlock(GetType(), "error", String.Format("var alert_string = '{0}';",
                                                                                         err.Message), true);
                return;
            }

            ((PageBase)Page).CurrentUserSession = user;

            if (user.PrevLogin.Date != DateTime.Now.Date)
                Classes.User.AddScore(user.Username, Config.UserScores.DailyLogin, "Login");

            try
            {
                IPLogger.Log(user.Username, Request.UserHostAddress, IPLogger.ActionType.LoginCardSpace);
            }
            catch (Exception err)
            {
                Global.Logger.LogError("LoginCardSpace IP Logger", err);
            }

            if (Request.Params["back_url"] != null
                && Request.Params["back_url"].Length > 0)
            {
                ClientScript.RegisterClientScriptBlock(GetType(), "redirect",
                    String.Format("window.opener.location = '{0}'; window.close();",
                    user.Username), true);
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(GetType(), "redirect",
                    String.Format("window.opener.location = '{0}'; window.close();",
                    Config.Urls.Home + "/Home.aspx"), true);
            }
        }