コード例 #1
0
ファイル: IDLink.aspx.cs プロジェクト: NuzzIndustries/Zolilo
        protected void ButtonSubmit_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                DR_Accounts record = new DR_Accounts();
                record._Username = TextBoxUserName.Text;
                record.QueryRow();

                if (record.Cells["ID"].Data != null)
                {
                    if (SecurityEncryption.VerifyCode(TextBoxPassword.Text, record._PCode))
                    {
                        //Successful login
                        DR_OpenIDMap openidrec = new DR_OpenIDMap();
                        openidrec._AccountID = record.ID;
                        openidrec._OpenIdentifier = zContext.Session.OpenIDAuthenticationInformation.OpenIdentifier;
                        openidrec.SaveChanges();
                        int records = 1; //refactor
                        if (records > 0)
                        {
                            TextBoxResult.Text = "Successfully linked accounts!";
                            zContext.Session.Flags.OpenIDNotLinked = false;
                            zContext.Session.ProcessLogin();
                            Response.Redirect("~/home");
                        }
                    }
                    else
                    {
                        TextBoxResult.Text = "Invalid Password.";
                    }
                }
                else
                {
                    TextBoxResult.Text = "Username not found.";
                }
            }
        }
コード例 #2
0
ファイル: DR_Accounts.cs プロジェクト: NuzzIndustries/Zolilo
 public static DR_Accounts ResolveFromOpenID(string openIdentifier)
 {
     DR_Accounts account = new DR_Accounts(openIdentifier);
     return DR_Accounts.Get(account);
 }
コード例 #3
0
 private void LoadCurrentUserInfo(AuthenticationInformation info)
 {
     currentAccount = DR_Accounts.ResolveFromOpenID(info.OpenIdentifier);
 }
コード例 #4
0
        //Needs refactor
        internal void ResetData()
        {
            currentAccount = null;
            requests = new RequestContextTable();
            //RefreshSessionObjects();

            if (flags == null)
                flags = new SessionStateFlags();

            if (OpenIDAuthenticationInformation != null)
                LoadCurrentUserInfo(OpenIDAuthenticationInformation);
        }
コード例 #5
0
 internal void ProcessLogin()
 {
     if (requests == null)
         requests = new RequestContextTable();
     if (flags == null)
         flags = new SessionStateFlags();
     if (OpenIDAuthenticationInformation != null)
         currentAccount = DR_Accounts.ResolveFromOpenID(OpenIDAuthenticationInformation.OpenIdentifier);
 }
コード例 #6
0
 internal void BeginProcessLogin(DR_Accounts currentAccount)
 {
     if (currentAccount != null && ZoliloCache.Instance.Accounts.ContainsKey(currentAccount.ID))
     {
         this.currentAccount = currentAccount;
         ProcessLogin();
     }
     else
         throw new ZoliloWebException("Login error");
 }
コード例 #7
0
ファイル: Login.aspx.cs プロジェクト: NuzzIndustries/Zolilo
 void loginControl_LoginAccepted(DR_Accounts account)
 {
     ZoliloSession.Current.BeginProcessLogin(account);
     WebDirector.Instance.Redirect("/browse");
 }
コード例 #8
0
 /// <summary>
 /// OVERRIDDEN -- Translates Form Abstraction Layer to Data Abstraction Layer
 /// </summary>
 /// <returns></returns>
 internal override DataRecord GenerateNewDataRecord()
 {
     DR_Accounts record = new DR_Accounts();
     record._Username = username;
     record._PCode = SecurityEncryption.ComputeHash(password);
     record._Email = email;
     return record;
 }
コード例 #9
0
            /// <summary>
            /// Use this constructor to set up the parameters and the validation
            /// </summary>
            internal AccountRegistrationFormParameters(
                string username,
                string password,
                string confirmpassword,
                string email)
                : base()
            {
                this.username = username;
                this.password = password;
                this.confirmpassword = confirmpassword;
                this.email = email;

                Regex regexusername = new Regex(@"^[0-9a-zA-Z]{3,30}$");
                Regex regexpassword = new Regex(@"^.{8,30}$");
                Regex regexemail = new Regex(@"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$");

                if (password != confirmpassword)
                    throw new SecurityValidationException("");

                if (regexusername.Matches(username).Count == 0)
                    throw new SecurityValidationException("");

                if (regexpassword.Matches(password).Count == 0)
                    throw new SecurityValidationException("");

                if (regexemail.Matches(email).Count == 0)
                    throw new SecurityValidationException("");

                newRecord = (DR_Accounts)GenerateNewDataRecord();
            }
コード例 #10
0
 void AccountLoginControl_D_LoginAccepted(DR_Accounts account)
 {
 }