Advertisement
yanni_yagami

Untitled

May 28th, 2021
1,363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'use strict'
  2.  
  3. const USERS = [
  4.     {
  5.         id: 1,
  6.         name:"karim",
  7.         email: "karms@gmail.com"
  8.     },
  9.     {
  10.         id: 2,
  11.         name:"bob",
  12.         email: "bob@gmail.com"
  13.     },
  14.     {
  15.         id: 3,
  16.         name:"akira",
  17.         email: "akira@gmail.com"
  18.     },
  19. ];
  20.  
  21. function connect()
  22. {
  23.     const name = document.getElementById('inputName');
  24.  
  25.     if(name.value == "")
  26.         return;
  27.  
  28.     for(const user of USERS)
  29.         if(name.value == user.name)
  30.         {
  31.             alert('vous êtes connectés !');
  32.             location.replace('../../index.html');
  33.             return;
  34.         }
  35.  
  36.     alert('identifiant inconnu');
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement