예제 #1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        ///      Set Widget - add or update ...
        /// </summary>
        public static void SetWidget(PasswordResetWidget paw)
        {
            RemoveWidget(paw);

            lock (PasswordReset.Widgets) {
                Widgets.Add(paw);
            }
        }
예제 #2
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        ///     Get Widget
        /// </summary>
        public static PasswordResetWidget GetWidget(int userID)
        {
            PasswordResetWidget paw = null;

            foreach (PasswordResetWidget tempPAW in Widgets)
            {
                if (tempPAW.UserID == userID)
                {
                    paw = tempPAW;
                    break;
                }
            }

            return(paw);
        }
예제 #3
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        ///      Remove widget
        /// </summary>
        public static void RemoveWidget(PasswordResetWidget paw)
        {
            int index = -1;
            int i     = 0;

            foreach (PasswordResetWidget tempPAW in Widgets)
            {
                if (tempPAW.UserID == paw.UserID)
                {
                    index = i;
                    break;
                }
                i++;
            }

            if (index >= 0)
            {
                lock (PasswordReset.Widgets) {
                    Widgets.RemoveAt(index);
                }
            }
        }
예제 #4
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        ///     Get Widget
        /// </summary>
        public static PasswordResetWidget GetWidget(StringBuilder guid)
        {
            PasswordResetWidget paw = null;

            if (guid != null && guid.Length > 0)
            {
                foreach (PasswordResetWidget tempPAW in Widgets)
                {
                    // 17-Jul-15 - the MGLPasswordHash is overkill here, lets just use one level of encryption...
                    //if (MGLPasswordHash.Compare(  tempPAW.Guid, hashedGUID ) == true) {
                    if (MGLEncryption.AreEqual(guid, tempPAW.Token) == true)
                    {
                        paw = tempPAW;
                        break;
                    }
                }
            }

            // random sleep to confuse on the checking if anyone is monitoring the timings!!
            Thread.Sleep(new Random().Next(0, 100));

            return(paw);
        }