Esempio n. 1
0
        public bool MatchRegistered(object[] MatchArgs, AckMessage.StatusType status, object data, AckMessage OrigAck)
        {
            bool Sent = false;

            foreach (RegisteredMessage RegMsg in RegisteredMessages)
            {
                if (RegMsg.Matches(MatchArgs))
                {
                    // we send an EventMessage based on this match using the args provided.
                    AckMessage ack;
                    ack             = new AckMessage(status, data, (CommandMessage)RegMsg);
                    ack.MatchParams = MatchArgs;
                    if (null != OrigAck)
                    {
                        if (RegMsg.sender == OrigAck.sender)// really next a Next type jump.
                        {
                            goto End;
                        }
                        ack.sender = OrigAck.sender; // override source.
                    }
                    Sent |= Send(ack);
End:
                    // stupid labels must come before code.
                    int x = 1;
                    x    += 1;
                }
            }
            return(Sent);
        }
Esempio n. 2
0
        public async Task <IActionResult> Registration(RegMsg reg)
        {
            var res = await um.CreateAsync(new IdentityUser { UserName = reg.Uname }, reg.Pass);

            if (res.Succeeded)
            {
                await um.AddToRoleAsync(await um.FindByNameAsync(reg.Uname), "Admin");

                log.LogInformation("Succesfully registered");
                return(Ok());
            }
            log.LogError("There was mistake trying to register user");
            return(BadRequest("Not registered"));
        }
Esempio n. 3
0
        public async Task <IActionResult> Login(RegMsg reg)
        {
            log.LogInformation("log in");
            var kor = await um.FindByNameAsync(reg.Uname);

            if (kor is null)
            {
                log.LogError("User doesnt exist");
                return(BadRequest("User null"));
            }
            var res = await sim.PasswordSignInAsync(kor, reg.Pass, false, false);

            if (res.Succeeded)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest("Error"));
            }
        }
Esempio n. 4
0
        public async Task Login(RegMsg l)
        {
            await api.Login(l);

            NotifyAuthenticationStateChanged(GetAuthenticationStateAsync());
        }
Esempio n. 5
0
        public async Task Registration(RegMsg r)
        {
            await api.Registration(r);

            NotifyAuthenticationStateChanged(GetAuthenticationStateAsync());
        }
Esempio n. 6
0
 public async Task Registration(RegMsg r)
 {
     await http.PostAsJsonAsync("api/userinfo/registration", r);
 }
Esempio n. 7
0
        public async Task Login(RegMsg l)
        {
            var res = await http.PostAsJsonAsync("api/userinfo/login", l);

            res.EnsureSuccessStatusCode();
        }