Exemple #1
0
 public bool CheckPhoneInDb(IAutorizationModel authModel)
 {
     if (authModel.Login == "+0 930 987 39 20" && authModel.Password == "12345678")
     {
         Console.WriteLine($"{authModel.Login} is Authorized");
         return(true);
     }
     else
     {
         Console.WriteLine($"{authModel.Login} is not Authorized");
         return(false);
     }
 }
Exemple #2
0
 public bool CheckEmailInDb(IAutorizationModel authModel)
 {
     if (authModel.Login == "*****@*****.**" && authModel.Password == "12345678")
     {
         Console.WriteLine($"{authModel.Login} is Authorized");
         return(true);
     }
     else
     {
         Console.WriteLine($"{authModel.Login} is not Authorized");
         return(false);
     }
 }
Exemple #3
0
 public IAutorizationModel Handle(IAutorizationModel request)
 {
     if (request.Login.Contains("facebook"))
     {
         Console.WriteLine($"FacebookAuthorizationHandler handeled the autorization of {request.Login}.\n");
         _ = new FacebookAuthorizationService().CheckEmailInFacebook(request);
         return(request);
     }
     else
     {
         Console.WriteLine($"FacebookAuthorizationHandler didn't handele the autorization of {request.Login}.\n");
         if (this._nextHandler != null)
         {
             return(this._nextHandler.Handle(request));
         }
         else
         {
             return(null);
         }
     }
 }
Exemple #4
0
 public IAutorizationModel Handle(IAutorizationModel request)
 {
     if (!request.Login.Any(c => char.IsLetter(c)))
     {
         Console.WriteLine($"NativePhoneAuthorizationHandler handeled the autorization of {request.Login}.\n");
         _ = new NativeAuthorizationService().CheckPhoneInDb(request);
         return(request);
     }
     else
     {
         Console.WriteLine($"NativePhoneAuthorizationHandler didn't handele the autorization of {request.Login}.\n");
         if (this._nextHandler != null)
         {
             return(this._nextHandler.Handle(request));
         }
         else
         {
             return(null);
         }
     }
 }