示例#1
0
        protected void UnlockAccountBtn_Click(object sender, EventArgs e)
        {
            UnlockResult.Visible = false;
            UnlockError.Visible  = false;

            int userId = int.Parse(SelectedAccount.Value);

            if (userId > 0)
            {
                User lockedUser = UserUtil.GetUser(userId);
                FirebaseUtil.ForgotPassword(lockedUser.Email);
                UserUtil.ValidLogin(lockedUser);
                User user = (User)Session["User"];
                if (user != null)
                {
                    Log.Info(user.Identity + " unlocked an account " + user.Identity);
                }
                else
                {
                    Log.Info("System unlocked an account " + user.Identity);
                }
                UnlockResult.Visible = true;
                UnlockResult.Text    = "Unlocked account " + lockedUser.Identity;
            }
            else
            {
                UnlockError.Visible = true;
                UnlockError.Text    = "Please select an account to unlock";
            }

            ClearFields();
        }
示例#2
0
        protected void ChangePassword_Click(object sender, EventArgs e)
        {
            PasswordChangeError.Visible = true;
            User user = (User)Session["User"];

            if (FirebaseUtil.ForgotPassword(user.Email))
            {
                PasswordChangeError.CssClass = "success";
                PasswordChangeError.Text     = "Check your email for a password reset link";
            }
            else
            {
                PasswordChangeError.Text = "Couldn't send you a reset email";
            }
        }
示例#3
0
 //Run the follow code when the user want to change their password.
 protected void ChangeBtn_Click(object sender, EventArgs e)
 {
     if (Email.Text.Length > 0)
     {
         if (FirebaseUtil.ForgotPassword(Email.Text))
         {
             ErrorLabel.Text   = "";
             SuccessLabel.Text = "Check your email for a password reset link!";
             Email.Visible     = false;
             changeBtn.Visible = false;
         }
         else
         {
             SuccessLabel.Text = "";
             ErrorLabel.Text   = Email.Text + " is not valid.";
         }
     }
     else
     {
         ErrorLabel.Text = "Please enter your email!";
     }
 }