Пример #1
0
        public async Task <ActionResult <ClientPassword> > PostClientPassword(ClientPassword clientPassword)
        {
            _context.ClientPasswords.Add(clientPassword);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetClientPassword", new { id = clientPassword.Id }, clientPassword));
        }
Пример #2
0
        public async Task <IActionResult> PutClientPassword(int id, ClientPassword clientPassword)
        {
            if (id != clientPassword.Id)
            {
                return(BadRequest());
            }

            _context.Entry(clientPassword).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClientPasswordExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #3
0
        public ActionResult ModifierPassword(ClientPassword client)
        {
            if (ModelState.IsValid)
            {
                if (!dal.MotDePassClienExiste(client.id, client.Password))
                {
                    ModelState.AddModelError("Password", "L'ancien mot de passe n'est pas correct");
                    return(View(client));
                }

                dal.ModifierMdp(client.id, client.Password, client.NewPass);
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(client));
            }
        }
Пример #4
0
 private void ValidateClientAuthAccessRequestState()
 {
     if (AccessTokenUrl.IsNullOrBlank())
     {
         throw new ArgumentException("You must specify an access token URL");
     }
     if (ConsumerKey.IsNullOrBlank())
     {
         throw new ArgumentException("You must specify a consumer key");
     }
     if (ConsumerSecret.IsNullOrBlank())
     {
         throw new ArgumentException("You must specify a consumer secret");
     }
     if (ClientUsername.IsNullOrBlank() || ClientPassword.IsNullOrBlank())
     {
         throw new ArgumentException("You must specify user credentials");
     }
 }
Пример #5
0
        public ActionResult ModifierPassword(int?id)
        {
            if (!id.HasValue)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Client client = dal.ObtenirTousLesClients().FirstOrDefault(c => c.Id == id);

            if (client == null)
            {
                return(HttpNotFound());
            }
            ClientPassword cli = new ClientPassword()
            {
                id = id.Value
            };

            return(View(cli));
        }
Пример #6
0
        public static void Initialize(HindsiteContext context)
        {
            if (context.Clients.Any())
            {
                return;
            }

            //Clients
            var clients = new Client[]
            {
                new Client
                {
                    CompanyName = "Jonah Energy",
                    Location    = "Jonah Energy LLC, 83 Luman Road Pinedale, WY 82941, Boulder, WY 82923"
                },
                new Client
                {
                    CompanyName = "Linn Energy",
                    Location    = "E Oklahoma Ave, Ulysses, KS 67880"
                }
            };

            foreach (Client c in clients)
            {
                context.Clients.Add(c);
            }
            context.SaveChanges();

            // Client Password Table
            var clientPasswords = new ClientPassword[]
            {
                new ClientPassword
                {
                    ClientUserName  = "******",
                    ClientPasswords = "Password"
                }
            };

            foreach (ClientPassword p in clientPasswords)
            {
                context.ClientPasswords.Add(p);
            }
            context.SaveChanges();

            // Employee's
            var employees = new Employee[]
            {
                new Employee
                {
                    FirstName = "David",
                    LastName  = "Jones"
                },
                new Employee
                {
                    FirstName = "Nolan",
                    LastName  = "Jones"
                }
            };

            foreach (Employee e in employees)
            {
                context.Employees.Add(e);
            }
            context.SaveChanges();

            // Employee Passwords Table
            var employeePasswords = new EmployeePassword[]
            {
                new EmployeePassword
                {
                    EmployeeUserName  = "******",
                    EmployeePasswords = "Password"
                }
            };

            foreach (EmployeePassword ep in employeePasswords)
            {
                context.EmployeePasswords.Add(ep);
            }
            context.SaveChanges();

            // Gps Info table
            var gpsInfos = new GpsInfo[]
            {
                new GpsInfo
                {
                    GpsFile   = "file address",
                    Locations = "SHB 101",
                    Date      = DateTime.Parse("2019-07-10")
                }
            };

            foreach (GpsInfo g in gpsInfos)
            {
                context.GpsInfoes.Add(g);
            }
            context.SaveChanges();
        }
Пример #7
0
        public JsonResult VerifPassword(ClientPassword client)
        {
            bool result = dal.MotDePassCorrect(client.Password);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }