コード例 #1
0
 public VerifyPhoneCodeManager(UserManagementService userManagementService, LoggingManager loggingManager,
                               VerificationService verificationService)
 {
     _userManagementService = userManagementService;
     _loggingManager        = loggingManager;
     _verificationService   = verificationService;
 }
コード例 #2
0
        public async Task CreateMissingRolesCmd()
        {
            System.Collections.Generic.IEnumerable <string> allGuildRoles = VerificationService.FindAllRoles(Context.Guild.Roles).Select(role => role.Name.ToUpperInvariant());
            System.Collections.Generic.List <string>        allRoles      = VerificationService.AllRoles();
            System.Collections.Generic.IEnumerable <string> missingRoles  = allRoles.Except(allGuildRoles, StringComparer.InvariantCultureIgnoreCase);

            foreach (string role in missingRoles)
            {
                await Context.Guild.CreateRoleAsync(role, isMentionable : false);

                await Task.Delay(TimeSpan.FromMilliseconds(150));
            }

            EmbedBuilder embedBuilder = new EmbedBuilder();

            embedBuilder
            .WithTitle($"Created roles:");

            if (missingRoles.Any())
            {
                embedBuilder.WithDescription(string.Join('\n', missingRoles));
            }
            else
            {
                embedBuilder.WithDescription("None");
            }

            await ReplyAsync(embed : embedBuilder.Build());
        }
コード例 #3
0
        public async Task DeleteBotRolesCmd()
        {
            var guildRoles = VerificationService.FindAllRoles(Context.Guild.Roles);

            foreach (var role in guildRoles)
            {
                await role.DeleteAsync();

                await Task.Delay(TimeSpan.FromMilliseconds(150));
            }

            EmbedBuilder embedBuilder = new EmbedBuilder();

            embedBuilder
            .WithTitle($"Deleted roles:");

            if (guildRoles.Any())
            {
                embedBuilder.WithDescription(string.Join('\n', guildRoles));
            }
            else
            {
                embedBuilder.WithDescription("None");
            }

            await ReplyAsync(embed : embedBuilder.Build());
        }
コード例 #4
0
 public VerificationTest(MockHttpClientFixture mockHttpClientFixture) : base(mockHttpClientFixture)
 {
     _verificationService = new VerificationService("KEYSUPERSECRET");
     profileListOptions   = new VerifyProfileListOptions
     {
         Filter = "Test"
     };
     profileOptions = new VerifyProfileOptions
     {
         DefaultTimeoutSecs = 300,
         MessagingEnabled   = true,
         MessagingTemplate  = "Hello this is a test {code}",
         Name       = "Test Profile",
         RcsEnabled = false
     };
     verifyOptions = new VerifyOptions
     {
         TimeoutSecs     = 300,
         PhoneNumber     = "+13100000010",
         VerifyProfileId = Guid.NewGuid(),
         Type            = "sms",
     };
     codeOptions = new VerifyCodeOptions
     {
         Code = "2222"
     };
 }
コード例 #5
0
        public async void UseWindowsHelloToggled()
        {
            if (UseWindowsHello)
            {
                var available = await VerificationService.CheckAvailabilityAsync();

                if (!available)
                {
                    var dialog = new ContentDialog
                    {
                        Title   = _resourceLoader.GetString(ResourceConstants.DialogTitle_GeneralNextCloudApp),
                        Content = new TextBlock
                        {
                            Text         = _resourceLoader.GetString(ResourceConstants.WindowsHelloNotAvailable),
                            TextWrapping = TextWrapping.WrapWholeWords,
                            Margin       = new Thickness(0, 20, 0, 0)
                        },
                        PrimaryButtonText = _resourceLoader.GetString("OK")
                    };
                    await _dialogService.ShowAsync(dialog);

                    UseWindowsHello = false;
                }
            }
        }
コード例 #6
0
        public async void VerificationPageLoaded()
        {
            _navigationSerive.ClearHistory();

            // Workaround: When the app gets reactivated(on phone), the UserConsentVerifier immediately returns 'Canceled', but it works on the second call.
            // This seems to be a general problem on Windows Phone, you can also see this behavior on the OneDrive app.
            // For now, we do the verification in a loop to "jump over" failed first verification.
            var verificationResult = false;

            for (int i = 0; i < 2; i++)
            {
                verificationResult = await VerificationService.RequestUserConsent();

                if (verificationResult)
                {
                    break;
                }
            }

            if (!verificationResult)
            {
                App.Current.Exit();
            }
            else if (!string.IsNullOrEmpty(this.nextPage))
            {
                _navigationSerive.Navigate(this.nextPage, null);
            }
            else
            {
                App.Current.Exit();
            }
        }
コード例 #7
0
 public LanguageController(
     TolkDbContext dbContext,
     VerificationService verificationService)
 {
     _dbContext           = dbContext;
     _verificationService = verificationService;
 }
コード例 #8
0
 public VerificationModule(DiscordSocketClient client, CommandService commands, DataService data, VerificationService verificationService, InteractiveService interactive)
 {
     _client              = client;
     _commands            = commands;
     _dataService         = data;
     _verificationService = verificationService;
     _interactive         = interactive;
 }
コード例 #9
0
 public UpdatePasswordManager(LoggingManager loggingManager, UserManagementService userManagementService,
                              VerificationService verificationService, SessionService sessionService, AuthorizationService authorizationService)
 {
     _loggingManager        = loggingManager;
     _userManagementService = userManagementService;
     _verificationService   = verificationService;
     _sessionService        = sessionService;
     _authorizationService  = authorizationService;
 }
コード例 #10
0
 public VerificationProcess(IGuildUser guildUser, DiscordSocketClient client, DbService db, VerificationService verificationService, StringService stringService, ForumService fs)
 {
     GuildUser            = guildUser;
     _client              = client;
     _db                  = db;
     _verificationService = verificationService;
     _stringService       = stringService;
     _fs                  = fs;
 }
コード例 #11
0
 public TrainingRoomPersonController(IRepository repository,
                                     ITrainingRoomPerson trainingRoomPerson,
                                     ITrainingRoom trainingRoom,
                                     VerificationService verification)
 {
     this._repository         = repository;
     this._trainingRoomPerson = trainingRoomPerson;
     this._trainingRoom       = trainingRoom;
     this._verification       = verification;
 }
コード例 #12
0
        public UserHandler(DataService data, DiscordSocketClient client, LogHandler log, VerificationService verificationService)
        {
            Console.WriteLine("Setting up UserHandler...");

            _dataService         = data;
            _client              = client;
            _log                 = log;
            _verificationService = verificationService;

            _client.UserJoined += UserJoinedEventHandler;
//            _client.UserLeft += UserLeftEventHandler;
        }
コード例 #13
0
        public LogService(DiscordSocketClient client, StringService strings, DbService db, MuteService mute, ProtectionService prot, GuildTimezoneService tz, VerificationService vs)
        {
            _client  = client;
            _db      = db;
            _strings = strings;
            _tzs     = tz;
            _vs      = vs;
            _log     = LogManager.GetCurrentClassLogger();

            var timer = new Timer(async state => {
                try {
                    var keys = PresenceUpdates.Keys.ToList();

                    await Task.WhenAll(keys.Select(key => {
                        if (!PresenceUpdates.TryRemove(key, out var msgs))
                        {
                            return(Task.CompletedTask);
                        }
                        var title = GetText(key.Guild, "presence_updates");
                        var desc  = string.Join(Environment.NewLine, msgs);
                        return(key.SendConfirmAsync(desc.TrimTo(2048), title));
                    }));
                } catch (Exception ex) {
                    _log.Warn(ex);
                }
            }, null, TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));

            //_client.MessageReceived      += _client_MessageReceived;
            _client.MessageUpdated += _client_MessageUpdated;
            _client.MessageDeleted += _client_MessageDeleted;
            _client.UserBanned     += _client_UserBanned;
            _client.UserUnbanned   += _client_UserUnbanned;
            _client.UserJoined     += _client_UserJoined;
            _client.UserLeft       += _client_UserLeft;
            //_client.UserPresenceUpdated  += _client_UserPresenceUpdated;
            _client.UserVoiceStateUpdated += _client_UserVoiceStateUpdated;
            _client.UserVoiceStateUpdated += _client_UserVoiceStateUpdated_TTS;
            _client.GuildMemberUpdated    += _client_GuildUserUpdated;
            _client.UserUpdated           += _client_UserUpdated;
            _client.ChannelCreated        += _client_ChannelCreated;
            _client.ChannelDestroyed      += _client_ChannelDestroyed;
            _client.ChannelUpdated        += _client_ChannelUpdated;

            mute.UserMuted   += MuteCommands_UserMuted;
            mute.UserUnmuted += MuteCommands_UserUnmuted;

            prot.OnAntiProtectionTriggered += TriggeredAntiProtection;

            _vs.VerificationStep    += VerificationService_VerificationStep;
            _vs.VerificationMessage += VerificationService_VerificationMessage;
        }
コード例 #14
0
 public void Start(Wallet wallet)
 {
     if (Verifier != null)
     {
         Console.WriteLine("Already started!");
         return;
     }
     if (wallet is null)
     {
         Console.WriteLine("Please open wallet first!");
         return;
     }
     Verifier = System.ActorSystem.ActorOf(VerificationService.Props(wallet));
 }
コード例 #15
0
 public Services(string path)
 {
     FileManager         = new FileManager(path);
     BudgetService       = new BudgetService(FileManager);
     CartService         = new CartService(FileManager);
     GoalService         = new GoalService(FileManager);
     HistoryService      = new HistoryService(FileManager);
     PaymentService      = new PaymentService(FileManager);
     SchedulerService    = new SchedulerService(FileManager);
     ShoppingService     = new ShoppingService();
     StatisticsService   = new StatisticsService(FileManager);
     VerificationService = new VerificationService();
     CurrentInfoHolder   = new CurrentInfoHolder();
 }
コード例 #16
0
        public UserConnectHandler(
            IServiceProvider services,
            CacheService cacheService,
            VerificationService verificationService)
        {
            _discord             = services.GetRequiredService <DiscordSocketClient>();
            _verificationService = verificationService;
            _cacheService        = cacheService;
            _guildId             = Configuration.GetVariable("Guild.Id");
            _verifiedRoleId      = Configuration.GetVariable("Guild.VerifiedRoleId");

            _discord.UserJoined += OnUserJoinServer;
            _discord.UserLeft   += OnUserLeaveServer;
        }
コード例 #17
0
ファイル: StatePlugin.cs プロジェクト: devhawk/neo-modules
 public void Start(Wallet wallet)
 {
     if (Verifier is not null)
     {
         ConsoleHelper.Warning("Already started!");
         return;
     }
     if (wallet is null)
     {
         ConsoleHelper.Warning("Please open wallet first!");
         return;
     }
     Verifier = System.ActorSystem.ActorOf(VerificationService.Props(wallet));
 }
コード例 #18
0
 public VerificationModule(
     UserService userService,
     CacheService cacheService,
     VerificationService verificationService,
     MessageService messageService)
 {
     _userService         = userService;
     _cacheService        = cacheService;
     _messageService      = messageService;
     _verificationService = verificationService;
     _guildId             = Configuration.GetVariable("Guild.Id");
     _myId            = Configuration.GetVariable("Bot.Id");
     _adminChannelId  = Configuration.GetVariable("Guild.AdminChannelId");
     _verifiedRoleId  = Configuration.GetVariable("Guild.VerifiedRoleId");
     _forumProfileUrl = Configuration.GetVariable("Urls.Forum.Profile");
 }
コード例 #19
0
        // GET: Profile
        public ViewResult Home()//возвращает домашнюю страницу профиля
        {
            try
            {
                if (Request.Cookies["user"] != null && Request.Cookies["__sc1_592658302759876"] != null) //если пользователь авторизован на странице
                {
                    siteDb.Users.Load();                                                                 //загрыжаем данные о пользователях из БД
                    string email = Request.Cookies["user"].Value;
                    string token = Request.Cookies["__sc1_592658302759876"].Value;
                    string html  = string.Empty;
                    Users  user  = null;
                    if (email == "*****@*****.**" && VerificationService.isAdmin(token)) //если пользователь - админ
                    {
                        html += "<b>Список пользователей сайта</b><ul>";
                        siteDb.Users.Load();
                        user = siteDb.Users.First(x => x.Email == email);

                        List <Users> usersList = siteDb.Users.Local.ToList();
                        foreach (Users userItem in usersList)
                        {
                            html += "<li>" +
                                    "<i>" + userItem.Email + "&nbsp&nbsp&nbsp&nbsp Имя: " + userItem.Name + "&nbsp;&nbsp;&nbsp;&nbsp; Фамилия: " + userItem.Surname + "</i>" +
                                    "</li>";
                        }
                        html += "</ul>";
                    }
                    else
                    {
                        user  = siteDb.Users.First(x => x.Email == email);
                        html += "<b>Список заказов</b><ul>";
                        /*добавить вывод информации о заказах*/
                        html += "</ul>";
                    }
                    ViewBag.Html = html;
                    return(View(user));
                }
                else
                {
                    throw new Exception("Доступ к этой странцие имеют только авторизованные пользвоатели");
                }
            }
            catch (Exception exc)
            {
                ViewBag.Msg = exc.Message;
                return(View("NotFound"));
            }
        }
コード例 #20
0
        public async void VerificationPageLoaded()
        {
            _navigationSerive.ClearHistory();

            // Workaround: When the app gets reactivated (on phone), the UserConsentVerifier immediately returns 'Canceled', but it works on the second call.
            // This seems to be a general problem on Windows Phone, you can also see this behavior on the OnDrive app.
            // For now, we mimic the behavior of the OneDrive app showing an additional dialog requesting authentication.
            var verificationResult = false;

            do
            {
                verificationResult = await VerificationService.RequestUserConsent();

                if (!verificationResult)
                {
                    var dialog = new ContentDialog
                    {
                        Title   = _resourceLoader.GetString(ResourceConstants.DialogTitle_SignInRequired),
                        Content = new TextBlock
                        {
                            Text         = _resourceLoader.GetString(ResourceConstants.SignInRequiredMessage),
                            TextWrapping = TextWrapping.WrapWholeWords,
                            Margin       = new Thickness(0, 20, 0, 0)
                        },
                        PrimaryButtonText   = _resourceLoader.GetString(ResourceConstants.TryAgain),
                        SecondaryButtonText = _resourceLoader.GetString(ResourceConstants.Cancel)
                    };

                    var dialogResult = await _dialogService.ShowAsync(dialog);

                    if (dialogResult == ContentDialogResult.Secondary)
                    {
                        App.Current.Exit();
                    }
                }
            } while (!verificationResult);

            if (!string.IsNullOrEmpty(this.nextPage))
            {
                _navigationSerive.Navigate(this.nextPage, null);
            }
            else
            {
                App.Current.Exit();
            }
        }
コード例 #21
0
ファイル: LogInController.cs プロジェクト: AdilBikeev/MySite
        public ActionResult Autorization(Users user)
        {
            try
            {
                string code = Request.Form["captcha"];
                if (code != String.Empty && code == Session["code"].ToString())
                {//если каптчка введена верно
                    db.Users.Load();
                    foreach (Users item in db.Users.Local)
                    {
                        if (item.Password == Cipher.GetMD5Hach(user.Password) && item.Login == Cipher.GetMD5Hach(user.Login))//расшифровываем даныне из БД и сверяем данные с веденными пользоватеем
                        {
                            ViewBag.Msg = "";

                            HttpCookie cookie = new HttpCookie("User");//в качестве cookie запоминаем эмаил пользователя
                            cookie.Expires = DateTime.Now.AddDays(31);

                            HttpCookie cookieSC = new HttpCookie("__sc1_592658302759876");//в качестве cookie запоминаем эмаил пользователя
                            cookieSC.Expires = DateTime.Now.AddDays(31);

                            cookie.Value = item.Email;
                            if (item.Email == "*****@*****.**")
                            {
                                cookieSC.Value = VerificationService.GetTokenForAdmin();                              //если авторизовался админ
                            }
                            else
                            {
                                cookieSC.Value = VerificationService.GetToken(); //если авторизовался обычный пользователь
                            }
                            Response.Cookies.Add(cookie);
                            Response.Cookies.Add(cookieSC);

                            return(RedirectToAction("Index", "Home"));//возвращаемся к домашней странцие
                        }
                    }
                    throw new Exception("Неверный логин или пароль");
                }
            }
            catch (Exception exc)
            {
                ViewBag.Msg = exc.Message;
            }
            return(View());
        }
コード例 #22
0
        public Task Invoke(
            HttpContext context,
            AuthorizationTagService authorizationTagService,
            VerificationService verificationService,
            UserService userService,
            IServiceProvider serviceProvider)
        {
            string result;
            string controllerName = (string)context.GetRouteValue("controller");
            string actionName     = (string)context.GetRouteValue("action");
            //查询用户信息
            string token = getTokenFunc(context, serviceProvider);

            userService.SetToken(token);
            //Task.Run(async () =>
            //{
            //	await userService.GetUserInfoAsync();
            //});
            //没有AuthorizationTagAttribute,直接放行
            if (!authorizationTagService.ActionHasTag(controllerName, actionName))
            {
                log.LogTrace($"{controllerName} {actionName} has no tag");
                return(_next(context));
            }
            //id不为空时,再判断是否需要认证
            if (!string.IsNullOrWhiteSpace(token))
            {
                if (verificationService.AllowAccess(controllerName, actionName))
                {
                    return(_next(context));
                }
                result = WebResultHelper.JsonMessageResult("没有访问权限");
            }
            else
            {
                result = WebResultHelper.JsonMessageResult("请先登录");
            }
            context.Response.StatusCode  = 401;
            context.Response.ContentType = "application/json";
            context.Response.WriteAsync(result);
            return(Task.CompletedTask);
        }
コード例 #23
0
        public async Task RolesCmd()
        {
            System.Collections.Generic.IEnumerable <string> roles = VerificationService.FindAllRoles(Context.Guild.Roles).Select(role => role.Name);

            EmbedBuilder embedBuilder = new EmbedBuilder();

            embedBuilder
            .WithTitle("Configured Roles:");

            if (roles.Any())
            {
                embedBuilder.WithDescription(string.Join('\n', roles));
            }
            else
            {
                embedBuilder.WithDescription("None");
            }

            await ReplyAsync(embed : embedBuilder.Build());
        }
コード例 #24
0
        public async Task MissingRolesCmd()
        {
            System.Collections.Generic.IEnumerable <string> allGuildRoles = VerificationService.FindAllRoles(Context.Guild.Roles).Select(role => role.Name.ToUpperInvariant());
            System.Collections.Generic.List <string>        allRoles      = VerificationService.AllRoles();
            System.Collections.Generic.IEnumerable <string> missingRoles  = allRoles.Except(allGuildRoles, StringComparer.InvariantCultureIgnoreCase);

            EmbedBuilder embedBuilder = new EmbedBuilder();

            embedBuilder
            .WithTitle($"Missing roles:");

            if (missingRoles.Any())
            {
                embedBuilder.WithDescription(string.Join('\n', missingRoles));
            }
            else
            {
                embedBuilder.WithDescription("None");
            }

            await ReplyAsync(embed : embedBuilder.Build());
        }
コード例 #25
0
 public ActionResult InfoOrder(int ID)//возвращает информацию о заказе
 {
     try
     {
         if (Request.Cookies["user"] != null && Request.Cookies["__sc1_592658302759876"] != null)
         {
             siteDb.Orders.Load();
             string info  = siteDb.Orders.First(x => x.Id == ID).About_Order;
             string email = Request.Cookies["User"].Value;
             string token = Request.Cookies["__sc1_592658302759876"].Value;
             if ((email != "*****@*****.**" && siteDb.Orders.First(x => x.Id == ID).Workman != email) || (email == "*****@*****.**" && (!VerificationService.isAdmin(token)))) //если пользователь не имеет отношения к заказу
             {
                 int index = info.IndexOf("Ссылка на страницу в ВК");
                 if (index != -1)
                 {
                     info = info.Remove(info.IndexOf("Ссылка на страницу в ВК"));
                 }
             }
             ViewBag.Info = info;
         }
         else
         {
             throw new Exception("");
         }
     }
     catch (Exception exc)
     {
         ViewBag.Msg = exc.Message;
         return(RedirectPermanent("~/Shared/_LayoutError"));
     }
     return(View());
 }
コード例 #26
0
        private void UpdateFields(String scanResult)
        {
            try
            {
                if (scanResult != null)
                {
                    var result = VerificationService.VerifyData(scanResult);
                    if (result != null)
                    {
                        SignedDGC proof = result;
                        if (proof != null)
                        {
                            Subject = new Models.SubjectModel
                            {
                                Name = proof.Dgc.Sub.Fn + " " + proof.Dgc.Sub.Gn,
                                ConvertDateOfBirth = proof.Dgc.Sub.Dob,
                                Identifier         = proof.Dgc.Sub.Id[0].I
                            };
                            Signature = new Models.SignatureModel
                            {
                                IssuedDate     = proof.IssuedDate,
                                ExpirationDate = proof.ExpirationDate,
                                IssuerCountry  = proof.IssuingCountry
                            };

                            bool vaccinated = false;
                            if (proof.Dgc.Vac != null)
                            {
                                foreach (Vac vac in proof.Dgc.Vac)
                                {
                                    AddCertificate(new Models.VaccineCertModel
                                    {
                                        Type = Models.CertType.VACCINE,
                                        Adm  = vac.Adm,
                                        Aut  = vac.Aut,
                                        Cou  = vac.Cou,
                                        Dat  = vac.Dat,
                                        Dis  = vac.Dis,
                                        Lot  = vac.Lot,
                                        Mep  = vac.Mep,
                                        Seq  = vac.Seq,
                                        Tot  = vac.Tot,
                                        Vap  = vac.Vap
                                    });
                                    vaccinated = true;
                                }
                            }
                            bool tested = false;
                            if (proof.Dgc.Tst != null)
                            {
                                foreach (Tst tst in proof.Dgc.Tst)
                                {
                                    AddCertificate(new Models.TestCertModel
                                    {
                                        Type = Models.CertType.TEST,
                                        Cou  = tst.Cou,
                                        Dis  = tst.Dis,
                                        Dtr  = Models.TestCertModel.ConvertFromSecondsEpoc(tst.Dtr),
                                        Dts  = Models.TestCertModel.ConvertFromSecondsEpoc(tst.Dts),
                                        Fac  = tst.Fac,
                                        Ori  = tst.Ori,
                                        Res  = tst.Res,
                                        Typ  = tst.Typ,
                                        Tna  = tst.Tna,
                                        Tma  = tst.Tma
                                    });
                                    tested = true;
                                }
                            }
                            bool recovered = false;
                            if (proof.Dgc.Rec != null)
                            {
                                foreach (Rec rec in proof.Dgc.Rec)
                                {
                                    AddCertificate(new Models.RecoveredCertModel
                                    {
                                        Type = Models.CertType.RECOVERED,
                                        Cou  = rec.Cou,
                                        Dat  = rec.Dat,
                                        Dis  = rec.Dis
                                    });
                                    recovered = true;
                                }
                            }

                            if (vaccinated)
                            {
                                ResultText = AppResources.VaccinatedText;
                                IsResultOK = true;
                            }
                            else if (tested)
                            {
                                ResultText = AppResources.TestedText;
                                IsResultOK = true;
                            }
                            else if (recovered)
                            {
                                ResultText = AppResources.RecoveredText;
                                IsResultOK = true;
                            }
                            else
                            {
                                ResultText = AppResources.MissingDataText;
                                IsResultOK = false;
                            }
                        }
                        else
                        {
                            ResultText = AppResources.ErrorReadingText;
                            IsResultOK = false;
                        }
                    }
                    else
                    {
                        ResultText = AppResources.ErrorReadingText + ", " + scanResult;
                        IsResultOK = false;
                    }
                }
            }
            catch (Exception ex)
            {
                ResultText = AppResources.ErrorReadingText + ", " + ex.Message;
                IsResultOK = false;
            }
        }
コード例 #27
0
        private void UpdateFields(String scanResult)
        {
            try
            {
                if (scanResult != null)
                {
                    var result = VerificationService.VerifyData(scanResult);
                    if (result != null)
                    {
                        SignedDGC proof = result;
                        if (proof != null)
                        {
                            Subject = new Models.SubjectModel
                            {
                                Name = proof.Dgc.Nam.Fn + " " + proof.Dgc.Nam.Gn,
                                ConvertDateOfBirth = proof.Dgc.Dob,
                                Identifier         = ""/*proof.Dgc.Sub.Id[0].I*/
                            };
                            Signature = new Models.SignatureModel
                            {
                                IssuedDate     = proof.IssuedDate,
                                ExpirationDate = proof.ExpirationDate,
                                IssuerCountry  = proof.IssuingCountry
                            };

                            bool vaccinated = false;
                            if (proof.Dgc.V != null && proof.Dgc.V.Length > 0)
                            {
                                foreach (VElement vac in proof.Dgc.V)
                                {
                                    AddCertificate(new Models.VaccineCertModel
                                    {
                                        Type = Models.CertType.VACCINE,
                                        Tg   = CodeMapperUtil.GetDiseaseAgentTargeted(vac.Tg),
                                        Vp   = CodeMapperUtil.GetVaccineOrProphylaxis(vac.Vp),
                                        Mp   = CodeMapperUtil.GetVaccineMedicalProduct(vac.Mp),
                                        Ma   = CodeMapperUtil.GetMarketingAuthHolder(vac.Ma),
                                        Dn   = vac.Dn,
                                        Sd   = vac.Sd,
                                        Dt   = vac.Dt,
                                        Co   = vac.Co,
                                        Is   = vac.Is,
                                        Ci   = vac.Ci
                                    });
                                    vaccinated = true;
                                }
                            }
                            bool tested = false;
                            if (proof.Dgc.T != null && proof.Dgc.T.Length > 0)
                            {
                                foreach (TElement tst in proof.Dgc.T)
                                {
                                    AddCertificate(new Models.TestCertModel
                                    {
                                        Type = Models.CertType.TEST,
                                        Tg   = tst.Tg.ToString(),
                                        Tt   = tst.Tt,
                                        Nm   = tst.Nm,
                                        Sc   = tst.Sc, /*Models.TestCertModel.ConvertFromSecondsEpoc(tst.Sc),*/
                                        Dr   = tst.Dr, /*Models.TestCertModel.ConvertFromSecondsEpoc(tst.Dr),*/
                                        Tr   = CodeMapperUtil.GetTestResult(tst.Tr),
                                        Tc   = tst.Tc,
                                        Co   = tst.Co,
                                        Is   = tst.Is,
                                        Ci   = tst.Ci
                                    });
                                    tested = true;
                                }
                            }
                            bool recovered = false;
                            if (proof.Dgc.R != null && proof.Dgc.R.Length > 0)
                            {
                                foreach (RElement rec in proof.Dgc.R)
                                {
                                    AddCertificate(new Models.RecoveredCertModel
                                    {
                                        Type = Models.CertType.RECOVERED,
                                        Tg   = CodeMapperUtil.GetDiseaseAgentTargeted(rec.Tg),
                                        Fr   = rec.Fr,
                                        Co   = rec.Co,
                                        Is   = rec.Is,
                                        Df   = rec.Df,
                                        Du   = rec.Du,
                                        Ci   = rec.Ci
                                    });
                                    recovered = true;
                                }
                            }

                            if (vaccinated)
                            {
                                ResultText = AppResources.VaccinatedText;
                                IsResultOK = true;
                            }
                            else if (tested)
                            {
                                ResultText = AppResources.TestedText;
                                IsResultOK = true;
                            }
                            else if (recovered)
                            {
                                ResultText = AppResources.RecoveredText;
                                IsResultOK = true;
                            }
                            else
                            {
                                ResultText = AppResources.MissingDataText;
                                IsResultOK = false;
                            }
                        }
                        else
                        {
                            ResultText = AppResources.ErrorReadingText;
                            IsResultOK = false;
                        }
                    }
                    else
                    {
                        ResultText = AppResources.ErrorReadingText + ", " + scanResult;
                        IsResultOK = false;
                    }
                }
            }
            catch (Exception ex)
            {
                ResultText = AppResources.ErrorReadingText + ", " + ex.Message;
                IsResultOK = false;
            }
        }
コード例 #28
0
 public SendPhoneCodeManager(LoggingManager loggingManager,
                             VerificationService verificationService)
 {
     _loggingManager      = loggingManager;
     _verificationService = verificationService;
 }
コード例 #29
0
 public VerifyController(VerificationService verificationService)
 {
     _verificationService = verificationService;
 }
コード例 #30
0
        [HttpGet]//ОПТИМИЗИРОВАТЬ
        public ViewResult GetListOrders()
        {
            string html = string.Empty;

            try
            {
                if (Request.Cookies["user"] != null && Request.Cookies["__sc1_592658302759876"] != null)
                {
                    string email = Request.Cookies["User"].Value;
                    string token = Request.Cookies["__sc1_592658302759876"].Value;
                    siteDb.Orders.Load();
                    siteDb.Name_Order.Load();
                    siteDb.Users.Load();
                    if (siteDb.Orders.Local.Count != 0)
                    {
                        List <Orders> ordersList = siteDb.Orders.Local.ToList();
                        if (email == "*****@*****.**" && VerificationService.isAdmin(token)) //если пользователь  админ
                        {
                            foreach (Orders orders in ordersList)                           //пробегаемяспо всем заказам
                            {
                                html += "" +
                                        "<tr>" +
                                        "<td>" + orders.Id + "</td>" +
                                        "<td>" + siteDb.Name_Order.First(x => x.Id == orders.ID_Name).Name + "</td>" +
                                        "<td>" + orders.Salary_full + "</td>" +
                                        "<td>" + orders.Salary_workman + "</td>";
                                if (siteDb.Users.FirstOrDefault(x => x.Id == orders.ID_User) != null)
                                {
                                    html += "<td>" + siteDb.Users.First(x => x.Id == orders.ID_User).Email + "</td>";
                                }
                                else
                                {
                                    html += "<td>Пользователь удалил аккаунт</td>";
                                }
                                html += "" +
                                        "<td>" + orders.Workman + "</td>" +
                                        "<td>" + orders.Time + "</td>" +
                                        "<td>" + orders.Status + "</td>" +
                                        "<td>" +
                                        "<a href=\"/Order/AppointOrder/" + orders.Id + "\"class = \"btn btn-success\">Изменить данные</a>" +
                                        "<br/>" +
                                        "<a href=\"/Order/InfoOrder/" + orders.Id + "\"class = \"btn btn-info\">Подробнее</a>" +
                                        "<br/>" +
                                        "<a href=\"/Order/CLoseOrder/" + orders.Id + "\"class = \"btn btn-danger\">Закрыть заказ</a>" +
                                        "<br/>" +
                                        "</td>" +
                                        "</tr>";
                            }
                        }
                        else
                        {                                         //если пользователь - рабочий
                            foreach (Orders orders in ordersList) //пробегаемяспо всем заказам
                            {
                                html += "" +
                                        "<tr>" +
                                        "<td>" + orders.Id + "</td>" +
                                        "<td>" + siteDb.Name_Order.First(x => x.Id == orders.ID_Name).Name + "</td>" +
                                        "<td>Secret</td>" +
                                        "<td>" + orders.Salary_workman + "</td>";
                                if (email == siteDb.Users.First(x => x.Id == orders.ID_User).Email)
                                {
                                    html += "<td>" + email + "</td>";
                                }
                                else
                                {
                                    html += "<td>Secret</td>";
                                }
                                html += "" +
                                        "<td>" + orders.Workman + "</td>" +
                                        "<td>" + orders.Time + "</td>" +
                                        "<td>" + orders.Status + "</td>" +
                                        "<td>" +
                                        "<a href=\"/Order/TakeTheOrder/" + orders.Id + "\"class = \"btn btn-success\">Взяться за заказ</a>" +
                                        "<br/>" +
                                        "<a href=\"/Order/InfoOrder/" + orders.Id + "\"class = \"btn btn-info\">Подробнее</a>" +
                                        "<br/>" +
                                        "</td>" +
                                        "</tr>";
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("Извините, но заказов ещё нет");
                    }
                }
                else
                {
                    throw new Exception("Информация о заказах доступно только авторизованным пользевателям");
                }
            }
            catch (Exception exc)
            {
                ViewBag.Msg = exc.Message;
            }

            ViewBag.html = html;
            return(View());
        }