示例#1
0
        ///<summary>
        ///Changes the given httpContext user's password on db
        ///with parameters inside the httpContext.Request.Form
        ///</summary>
        public static string PasswordChange(PDKS.Context context, HttpContext httpContext)
        {
            string prev = httpContext.Request.Form["prevPwInput"];
            string new1 = httpContext.Request.Form["newPwInput"];
            string new2 = httpContext.Request.Form["newPwInput2"];

            if (new1 != new2)
            {
                return("respPWMatchErr");
            }

            User user = new User();

            try
            {
                user = (User)context.UserSet.Single(b => (b.Username == httpContext.User.FindFirst("UserName").Value));
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.Message);
                return("serverErr");
            }
            if (user.Password != Crypt.Encrypt(prev))
            {
                return("wrongPWErr");
            }
            if (new1.Length < 6)
            {
                return("shortPWErr");
            }
            user.Password = Crypt.Encrypt(new1);
            context.SaveChanges();
            return("pwSuccess");
        }
示例#2
0
 ///<summary>
 ///Fetches the context and configuration to the current model
 ///</summary>
 public RequestRespondModel(PDKS.Context context)
 {
     _context = context;
 }
示例#3
0
 ///<summary>
 ///Fetches the context and configuration to the current model
 ///</summary>
 public HoursTableModel(PDKS.Context context)
 {
     _context = context;
 }
示例#4
0
 ///<summary>
 ///Fetches the context to the current model
 ///</summary>
 public AuthorizeModel(PDKS.Context context)
 {
     _context = context;
 }
示例#5
0
 ///<summary>
 ///Fetches the context and configuration to the current model
 ///</summary>
 public AdminModel(PDKS.Context context, IConfiguration configuration)
 {
     Configuration = configuration;
     _context      = context;
 }
示例#6
0
 ///<summary>
 ///Fetches the context and configuration to the current model
 ///</summary>
 public AuthTableModel(PDKS.Context context)
 {
     _context = context;
 }
示例#7
0
 ///<summary>
 ///Fetches the context and configuration to the current model
 ///</summary>
 public HoursChangeModel(PDKS.Context context)
 {
     _context = context;
 }
示例#8
0
 ///<summary>
 ///Fetches the context to the current model
 ///</summary>
 public ExcuseStatesModel(PDKS.Context context)
 {
     _context = context;
 }
示例#9
0
 ///<summary>
 ///Fetches the context to the current model
 ///</summary>
 public LoginModel(PDKS.Context context)
 {
     _context = context;
 }
示例#10
0
 ///<summary>
 ///Fetches the context and configuration to the current model
 ///</summary>
 public ExcuseModel(PDKS.Context context)
 {
     _context = context;
 }
示例#11
0
 ///<summary>
 ///Fetches the context and configuration to the current model
 ///</summary>
 public RequestsTableModel(PDKS.Context context)
 {
     _context = context;
 }
示例#12
0
 ///<summary>
 ///Fetches the context to the current model
 ///</summary>
 public WorkedModel(PDKS.Context context)
 {
     _context = context;
 }