Example #1
0
 public Response UsePasswordResetKey(string key, bool isDJ, out int ID)
 {
     Response r = ValidatePasswordResetKey(key, isDJ, out ID);
     if (ID != -1)
     {
         using (DatabaseConnectivity db = new DatabaseConnectivity())
         {
             r = db.OpenConnection();
             if (r.error)
                 return r;
             if (isDJ)
                 r = db.DJClearPasswordResetID(ID, key);
             else
                 r = db.MobileClearPasswordResetID(ID, key);
             if (r.error)
                 return r;
         }
     }
     return r;
 }
Example #2
0
        /// <summary>
        /// Retrieves the DJ or MobileID associated with a password reset key and then removes it from the DB.
        /// ID will be set to -1 if it was invalid.
        /// </summary>
        /// <param name="key">The key to remove.</param>
        /// <param name="isDJ">Whether this is for DJs or mobile users.</param>
        /// <param name="ID">The userID associated with this user.</param>
        /// <returns>The outcome of the operation.</returns>
        public Response UsePasswordResetKey(string key, bool isDJ, out int ID)
        {
            Response r1 = ValidatePasswordResetKey(key, isDJ, out ID);
            if (r1.error)
                return r1;

            ExpResponse r = new ExpResponse();
            if (ID != -1)
            {
                using (DatabaseConnectivity db = new DatabaseConnectivity())
                {
                    r = db.OpenConnection();
                    if (r.error)
                        return Common.LogErrorRetNewMsg(r, Messages.ERR_SERVER, Common.LogFile.Web);
                    if (isDJ)
                        r = db.DJClearPasswordResetID(ID, key);
                    else
                        r = db.MobileClearPasswordResetID(ID, key);
                    if (r.error)
                        return Common.LogErrorRetNewMsg(r, Messages.ERR_SERVER, Common.LogFile.Web);
                }
            }
            return r;
        }