Ejemplo n.º 1
0
        /// <summary>
        /// The btnCreate_Click.
        /// </summary>
        /// <param name="loginDetails">The loginDetails<see cref="LoginDetails"/>.</param>
        /// <returns>The <see cref="bool"/>.</returns>
        internal static bool AddProfile(LoginDetails loginDetails)
        {
            bool isSucceed = false;

            sqlQuery = "INSERT INTO LOGINDETAILS(NAME,ADDRESS,USERNAME,PASSWORD,CONTACTNUMBER,ISADMIN,ISACTIVE,INSERTEDBY)VALUES(@NAME,@ADDRESS,@USERNAME,@PASSWORD,@CONTACTNUMBER,@ISADMIN,@ISACTIVE,@INSERTEDBY)";
            OpenSqlCeConnection();

            SqlCeCommand cm = new SqlCeCommand(sqlQuery, _con);

            cm.Parameters.AddWithValue("@NAME", loginDetails.Name);
            cm.Parameters.AddWithValue("@ADDRESS", loginDetails.Address);
            cm.Parameters.AddWithValue("@USERNAME", loginDetails.UserName);
            cm.Parameters.AddWithValue("@PASSWORD", loginDetails.Password);
            cm.Parameters.AddWithValue("@CONTACTNUMBER", loginDetails.ContactNumber);
            cm.Parameters.AddWithValue("@ISADMIN", loginDetails.IsAdminUser);
            cm.Parameters.AddWithValue("@ISACTIVE", loginDetails.IsActiveUser);
            cm.Parameters.AddWithValue("@INSERTEDBY", loginDetails.UserId);
            try
            {
                int intAffectedRow = cm.ExecuteNonQuery();
                if (intAffectedRow > 0)
                {
                    isSucceed = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            _con.Close();
            return(isSucceed);
        }
Ejemplo n.º 2
0
        public OtpResponse SendLoginDetails(LoginDetails request)
        {
            OtpResponse response = new OtpResponse();

            try
            {
                string fromEmail         = GlobalConstants.FromEmail;
                string fromEmailPassword = GlobalConstants.FromEmailPasword;

                MailMessage message = new MailMessage();
                SmtpClient  smtp    = new SmtpClient();
                message.From = new MailAddress(fromEmail);
                message.To.Add(new MailAddress(request.To));
                message.Subject            = "First time login details";
                message.IsBodyHtml         = true; //to make message body as html
                message.Body               = "<h2>Please use below credentitals to login to system. Please change your password after login. </h2><br/> Username : "******"<br/>Password : "******"smtp.gmail.com"; //for gmail host
                smtp.EnableSsl             = true;
                smtp.UseDefaultCredentials = false;
                smtp.Credentials           = new NetworkCredential(fromEmail, fromEmailPassword);
                smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;
                smtp.Send(message);

                response.Status  = "Success";
                response.Details = "Email sent successfully";
            }
            catch (Exception)
            {
                response.Status  = "Failed";
                response.Details = "Email sent failed";
            }
            return(response);
        }
Ejemplo n.º 3
0
        public Employee ValidateEmployee(LoginDetails loginDetails)
        {
            Employee emp = new Employee();

            connection.Open();
            SqlCommand cmd = new SqlCommand("sp_validation", connection);

            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            cmd.Parameters.AddWithValue("@username", loginDetails.Username);
            cmd.Parameters.AddWithValue("@password", loginDetails.Password);
            DataTable dt = new DataTable();

            da.Fill(dt);
            connection.Close();
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    emp.EmpID    = Convert.ToInt32(dr["EmpID"]);
                    emp.Name     = Convert.ToString(dr["EmpName"]);
                    emp.MailID   = Convert.ToString(dr["MailID"]);
                    emp.category = Convert.ToString(dr["EmpType"]);
                }
            }
            return(emp);
        }
Ejemplo n.º 4
0
        public LoginResult AttemptLogin(LoginDetails input)
        {
            if (input == null)
            {
                return(LoginResult.Failed);
            }

            using (var context = new ShopContext())
            {
                var userDetails = context.Users.Where(p => p.Username == input.Username).FirstOrDefault();

                if (userDetails == null)
                {
                    return(LoginResult.Failed);
                }

                var encryptedPassword = convertToMd5(input.Password);
                var token             = convertToMd5(DateTime.Now.ToString());

                if (!encryptedPassword.Equals(userDetails.Password))
                {
                    return(LoginResult.Failed);
                }

                return(new LoginResult()
                {
                    LoginSucceeded = true,
                    Token = token
                });
            }
        }
Ejemplo n.º 5
0
        public JsonNetResult GeneralAppOneAuthenticate([FromBody] LoginDetails credentials)
        {
            var auth = new LoginResult()
            {
                UserInfo = new UserLoginInfo()
            };

            auth.UserInfo.loginstatus = false;

            auth = TryLogin(credentials);

            List <JsonErrorModel> errorList = new List <JsonErrorModel>();

            if (!auth.UserInfo.loginstatus)
            {
                errorList.Add(new DotNetNancy.GeneralApps.WebApi.Common.JsonErrorModel
                {
                    ErrorMessage = "Authentication Failed, please check credientials."
                });
            }


            JsonNetResult jsonNetResult = new JsonNetResult();

            jsonNetResult.Formatting    = Newtonsoft.Json.Formatting.Indented;
            jsonNetResult.Data          = (auth.UserInfo.loginstatus) ? auth : null;
            jsonNetResult.DomainSuccess = auth.UserInfo.loginstatus;
            jsonNetResult.DomainErrors  = errorList.Any() ? errorList : null;
            return(jsonNetResult);
        }
Ejemplo n.º 6
0
        private async void btnLogin_Clicked(object sender, EventArgs e)
        {
            var username  = Convert.FromBase64String(entryUsername.Text);
            var password  = Convert.FromBase64String(entryPassword.Text);
            var LoginUser = new LoginDetails();

            using (var rsa = new RSACryptoServiceProvider(2048))
            {
                rsa.PersistKeyInCsp = false;
                rsa.ImportParameters(publicKey);
                LoginUser.encrytedUsername = rsa.Encrypt(username, true);
                LoginUser.encrytedPassword = rsa.Encrypt(password, true);
                using (var webClient = new WebClient())
                {
                    webClient.Headers.Add("Content-Type", "application/json");
                    var jsonData = JsonConvert.SerializeObject(LoginUser);
                    var response = await webClient.UploadDataTaskAsync($"http://10.0.2.2:51908/LoginUsers/Login", "POST", Encoding.UTF8.GetBytes(jsonData));

                    if (Encoding.Default.GetString(response) != "\"User not found or credentials are incorrect!\"")
                    {
                        await DisplayAlert("Login", "Login successful", "Ok");
                    }
                    else
                    {
                        await DisplayAlert("Login", "Login unsuccessful! Please check your credentials", "Ok");
                    }
                }
            }
        }
        public void TestIdpLoginEndpointRedirect()
        {
            LoginDetails login       = new LoginDetails(new ApiConsoleAuthManager());
            string       redirectUrl = login.RedirectIfIdpPointsAtLoginSso("your-idp-url&TargetResource=https://rally1.rallydev.com/login/sso");

            Assert.AreEqual(redirectUrl, "your-idp-url&TargetResource=https://rally1.rallydev.com/slm/empty.sp");
        }
        public LoginDetails GetLoginDetails(string serviceName)
        {
            var returnValue = new LoginDetails();

            try
            {
                var vault = new PasswordVault();
                IReadOnlyList <PasswordCredential> credentials = null;
                credentials = vault.FindAllByResource(serviceName);

                if (null != credentials)
                {
                    foreach (var credential in credentials)
                    {
                        try
                        {
                            var credentialWithPassword = vault.Retrieve(credential.Resource, credential.UserName);
                            returnValue.Password = credentialWithPassword.Password;
                            returnValue.Username = credentialWithPassword.UserName;
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
            catch (Exception) // No stored credentials, so none to delete
            {
            }
            return(returnValue);
        }
 protected void Logbutton_Click(object sender, EventArgs e)
 {
     if (uname.Value.ToUpper() == "ADMIN" && psw.Value.ToUpper() == "ADMIN@123")
     {
         Session["id"]     = "1";
         Session["Type"]   = "Admin";
         Session["Name"]   = "Admin";
         Session["IsAuth"] = "true";
         Response.Redirect("Home.aspx");
     }
     else
     {
         LoginDetails log = ValidateUser(uname.Value, psw.Value);
         if (log.IsAuthUser)
         {
             Session["id"]     = log.UserId;
             Session["Name"]   = log.UserName;
             Session["IsAuth"] = log.IsAuthUser;
             Session["Type"]   = log.Role;
             Response.Redirect("Home.aspx");
         }
         else
         {
             Response.Redirect("Login.aspx");
         }
     }
 }
Ejemplo n.º 10
0
        public async Task <IActionResult> PutLoginDetails(int id, LoginDetails loginDetails)
        {
            if (id != loginDetails.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 11
0
        public UserDetailsVm Login(LoginDetails loginDetails)
        {
            UserDetail userDetails = new UserDetail();

            using (GrowUpIncubatorEntities db = new GrowUpIncubatorEntities())
            {
                userDetails = db.UserDetails.Where(x => x.UserName.Equals(loginDetails.UserName, StringComparison.OrdinalIgnoreCase) && x.Password == loginDetails.Password).FirstOrDefault();
            }
            UserDetailsVm userDetailsVm = new UserDetailsVm();

            if (userDetails != null)
            {
                userDetailsVm = new UserDetailsVm()
                {
                    Id       = userDetails.Id,
                    UserName = userDetails.UserName,
                    Password = string.Empty,
                    RoleType = userDetails.RoleType
                }
            }
            ;
            else
            {
                userDetailsVm = null;
            }
            return(userDetailsVm);
        }
    private LoginDetails ValidateUser(string username, string password)
    {
        LoginDetails obj = new LoginDetails();

        obj.IsAuthUser = false;
        try
        {
            SqlConnection  con = new SqlConnection(ConfigurationManager.ConnectionStrings["App"].ConnectionString);
            SqlDataAdapter da;
            DataSet        ds    = new DataSet();
            string         query = "select * from Account where FirstName='" + username.Trim() + "' and Empid='" + password.Trim() + "'";
            da = new SqlDataAdapter(query, con);
            con.Open();
            da.Fill(ds);
            // Console.WriteLine(ds.Tables[0].Rows.Count);
            if (ds.Tables[0].Rows.Count > 0)
            {
                obj.IsAuthUser = true;
                obj.UserName   = ds.Tables[0].Rows[0]["FirstName"].ToString();
                obj.UserId     = ds.Tables[0].Rows[0]["Empid"].ToString();
                obj.Role       = ds.Tables[0].Rows[0]["Type"].ToString();
            }
        }
        catch (Exception ex)
        {
            obj.IsAuthUser = false;
            Response.Write("<script>alert('" + ex.Message.Replace("\'", " ") + "')</script>");
        }
        return(obj);
    }
Ejemplo n.º 13
0
        public ActionResult Login(LoginDetails l)
        {
            LoginDetails ld = dbcontext.LoginDetails.Single(log => (log.UserName == l.UserName) && (log.Password == l.Password));


            return(RedirectToAction("Index", l));
        }
Ejemplo n.º 14
0
        internal bool Register(string username, SecureString password, Person p)
        {
            string salt;
            string hash = CreatePasswordHash(password, out salt);

            LoginDetails l = new LoginDetails()
            {
                Email    = username,
                Password = hash,
                Salt     = salt,
                Role     = p.Role,
                UserId   = p.Id
            };

            password.Dispose();

            try
            {
                LoginDetails.InsertNewObject(l);
                l = null;
                GC.Collect();
                return(true);
            }
            catch (Exception e)
            {
                l = null;
                GC.Collect();
                Console.WriteLine(e.Message);
                return(false);
            }
        }
Ejemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LoginDetails loginDetails = User.Identity as LoginDetails;
        string       userId       = loginDetails.UserId;

        deptRepId = Convert.ToInt32(userId);


        if (!IsPostBack)
        {
            using (SSISEntities ctx = new SSISEntities())
            {
                int depCp = (int)ctx.Departments.Where(x => x.Department_Representative == deptRepId).Select(x => x.CollectionPoint_ID).First();
                rblCollectionPoint.SelectedValue = depCp.ToString();
            }
            using (SSISEntities ctx = new SSISEntities())
            {
                var qry = ctx.CollectionPoints.ToList()
                          .Select(x => new { id = x.CollectionPoint_ID, cpAndTime = x.CollectionPoint_Name + " | " + x.CollectionPoint_Time });
                rblCollectionPoint.DataSource     = qry;
                rblCollectionPoint.DataTextField  = "cpAndTime";
                rblCollectionPoint.DataValueField = "id";
                rblCollectionPoint.DataBind();
            }
        }
    }
Ejemplo n.º 16
0
 public IActionResult Index(LoginDetails employeeLoginDetails)
 {
     if (ModelState.IsValid)
     {
         if (UnitOfWork.PracownicyRepository.CheckIfLoginDetailsCorrect(employeeLoginDetails))
         {
             if (UnitOfWork.PracownicyRepository.CheckIfAdmin(employeeLoginDetails))
             {
                 return(RedirectToAction("Index", "AdminPanel"));
             }
             else
             {
                 return(RedirectToAction("Index", "EmployeePanel"));
             }
         }
         else
         {
             return(RedirectToAction("Index", "Home"));
         }
     }
     else
     {
         return(View(employeeLoginDetails));
     }
 }
Ejemplo n.º 17
0
        public OtpResponse SendLoginDetails(LoginDetails request)
        {
            OtpResponse otpresponse = new OtpResponse();

            using (var client = new HttpClient())
            {
                string url = _apiurl + _apiKey + "/ADDON_SERVICES/SEND/TSMS";

                client.BaseAddress = new Uri(url);

                var responseTask = client.PostAsync <LoginDetails>("", request, new JsonMediaTypeFormatter(), null);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <OtpResponse>();
                    readTask.Wait();

                    otpresponse = readTask.Result;
                }
            }

            return(otpresponse);
        }
Ejemplo n.º 18
0
        protected async Task <PhishingToken> ValidateAsync(LoginDetails loginDetails, string _phishingTokenString)
        {
            // new in FUT20
            // phishing token comes from /ut/auth, so i change a little bit to receive as a parameter and create an object to return
            PhishingToken _phishingToken = new PhishingToken();

            _phishingToken.Code   = "200";
            _phishingToken.String = "OK";
            _phishingToken.Token  = _phishingTokenString;
            return(_phishingToken);


            AddLoginHeaders();
            HttpClient.AddRequestHeader(NonStandardHttpHeaders.NucleusId, LoginResponse.Persona.NucUserId);

            HttpClient.AddRequestHeader(NonStandardHttpHeaders.SessionId, LoginResponse.AuthData.Sid);
            var validateResponseMessage = await HttpClient.GetAsync(String.Format(Resources.ValidateQuestion, DateTime.Now.ToUnixTime()));

            validateResponseMessage = await HttpClient.PostAsync(String.Format(Resources.ValidateAnswer, Hasher.Hash(loginDetails.SecretAnswer)), new FormUrlEncodedContent(
                                                                     new[]
            {
                new KeyValuePair <string, string>("answer", Hasher.Hash(loginDetails.SecretAnswer))
            }));

            var phishingToken = await DeserializeAsync <PhishingToken>(validateResponseMessage);

            var validateResponseMessageContent = await validateResponseMessage.Content.ReadAsStringAsync();

            if (phishingToken.Code != "200" || phishingToken.Token == null)
            {
                throw new Exception($"Unable to get Phishing Token {LoginDetails?.AppVersion}.");
            }

            return(phishingToken);
        }
Ejemplo n.º 19
0
        private LoginDetails ValidateUser(string username, string password)
        {
            LoginDetails obj = new LoginDetails();

            obj.IsAuthUser = false;
            try
            {
                SqlConnection  con = new SqlConnection(ConfigurationManager.ConnectionStrings["bs"].ConnectionString);
                SqlDataAdapter da;
                DataSet        ds    = new DataSet();
                string         query = "select * from users_table where username='******' and pwd='" + password.Trim() + "'";
                da = new SqlDataAdapter(query, con);
                con.Open();
                da.Fill(ds);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    obj.IsAuthUser = true;
                    obj.UserName   = ds.Tables[0].Rows[0]["UserName"].ToString();
                    obj.UserId     = int.Parse(ds.Tables[0].Rows[0]["UserId"].ToString());
                    obj.Role       = ds.Tables[0].Rows[0]["Role"].ToString();
                }
            }
            catch (Exception ex)
            {
                obj.IsAuthUser = false;
            }
            return(obj);
        }
Ejemplo n.º 20
0
        public void Init(ISupplementReceiptRegistration hostform, LoginDetails LD, string ID, string Mode, bool IsSup, bool IsPostBack)
        {
            IsSup      = false;
            this._host = hostform;
            UserInfo   = LD;


            if (!IsPostBack)
            {
                Utility.FillCombo(BI.ReturnBankName(), _host.ddl_bank, "ID", "title", false);
                Utility.FillCombo(BI.ReturnReceiptType(), _host.ddlReceiptType, "Value", "Title", false);
                Utility.FillCombo(BI.ReturnAllAlephabetSeri(), _host.ddlSeri, "ID", "Title", false);

                if (ID != "0" && Mode == "S")
                {
                    BI.ReturnReceiptNoByReceiptID(Convert.ToInt32(ID), out ParentSerialNo, out ParentNumberSeri, out ParentSeriAlphabet);
                    _host.txtParentReceiptID.Text    = ParentSerialNo;
                    _host.txtParentSeri.Text         = ParentNumberSeri;
                    _host.txtParentSeriAlphabet.Text = ParentSeriAlphabet;
                }
                else if (ID != "0" && Mode == "E")
                {
                    IsSup = LoadDataForEdit(ID);
                }

                _host.ddlReceiptType.SelectedValue = BI.ReturnReceiptTypeValueByID(ID);

                //_host.lblSlash.Visible =
                //_host.txtParentSeri.Visible =
                //_host.txtParentSeriAlphabet.Visible=
                //_host.lblParentReceipt.Visible =
                //_host.txtParentReceiptID.Visible = IsSup;
            }
        }
Ejemplo n.º 21
0
        public async Task <Tuple <bool, LoginDetails> > VerifyStudentAysnc(LoginDetails details)
        {
            bool found = false;

            using (NpgsqlConnection connection = new NpgsqlConnection(Variables.connectionStringRhodesDB))
            {
                connection.Open();
                NpgsqlCommand    command    = new NpgsqlCommand("select * from student_staff where student_staff_id=" + "'" + details.User_ID + "'" + ";", connection);
                NpgsqlDataReader dataReader = command.ExecuteReader();
                dataReader.Read();
                string user_id     = dataReader[2].ToString();
                string password    = dataReader[1].ToString();
                string eth_address = dataReader[3].ToString();
                details.Ethereum_Address = eth_address;
                found = user_id == details.User_ID && password == details.Password;
                if (!found)
                {
                    throw new LoginException("Invalid login credentials please ensure they match the ones you use to access ross or ruconnected");
                }
                connection.Close();
                command.Dispose();
                dataReader.Close();
            }
            return(await Task.FromResult(new Tuple <bool, LoginDetails>(found, details)));
        }
Ejemplo n.º 22
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     if (inputEmail.Value.ToUpper() == "ADMIN" && inputPassword.Value.ToUpper() == "ADMIN@123")
     {
         Session["userid"]   = "1";
         Session["role"]     = "Admin";
         Session["username"] = "******";
         Session["IsAuth"]   = "true";
         Response.Redirect("Home.aspx");
     }
     else
     {
         LoginDetails log = ValidateUser(inputEmail.Value, inputPassword.Value);
         if (log.IsAuthUser)
         {
             Session["userid"]   = log.UserId;
             Session["username"] = log.UserName;
             Session["IsAuth"]   = log.IsAuthUser;
             Session["role"]     = log.Role;
             Response.Redirect("Home.aspx");
         }
         else
         {
             Response.Redirect("Login.aspx");
         }
     }
 }
Ejemplo n.º 23
0
        public static void RunBank()
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("**********************************************************************************************");
            Console.WriteLine("*  Welcome to the International Bank of Rivendell, Middle Earth. How Can We help you today?  *");
            Console.WriteLine("**********************************************************************************************");
Register:
            //Code to register a customer
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("\t\tTo Register an account, press 'R'\n\t\tTo log into an existing account press 'L'\n\t\tTo exit type 'E'");
            string registerChoice = Console.ReadLine().ToLower();

            if (registerChoice == "e")
            {
                goto End;
            }
            while (registerChoice != "r" && registerChoice != "l" && registerChoice != "e")
            {
                Console.WriteLine("Please type in a correct option");
                goto Register;
            }
            if (registerChoice == "r")
            {
                CustomerAuth.CreateCustomer();
                Console.WriteLine("What will you like to do next?");
                goto Register;
            }
            else if (registerChoice == "l")
            {
                //To login
LoginDetails:
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("**************************************************************************");
                Console.WriteLine("*  Please type in your valid login Id and Email to login or 'E' to exit  *");
                Console.WriteLine("**************************************************************************");
                Console.WriteLine("\t\t\tEnter your Email: ");
                string customerEmail = Console.ReadLine();
                if (customerEmail.ToLower() == "e")
                {
                    goto Register;
                }
                Console.WriteLine("\t\t\tEnter your password: "******"Please enter valid Details");
                    goto LoginDetails;
                }
                LoginDetails customerDetails = new LoginDetails(customerEmail, password);
                Customer     currentCustomer = CustomerAuth.Login(customerDetails.Email, customerDetails.Password);
                if (currentCustomer == null)
                {
                    Console.WriteLine("Wrong user Input");
                    goto LoginDetails;
                }

ActionCenter:
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("\t\tTo create an account, press 'O'\n\t\tTo make deposit type 'D'\n\t\tTo make Withdrawal, type 'W'\n\t\tTo transfer Funds, type 'T'\n\t\tTo check your balance, type 'C'\n\t\tTo get transaction Details type 'G'\n\t\tTo logout, type 'E'");
                string choice = Console.ReadLine();
Ejemplo n.º 24
0
 public ActionResult LoginPage(LoginDetails login)
 {
     details.Username = login.Username;
     details.Password = PasswordGenerator.HashPassword(login.Password);
     bool userValid = AuthenticateUser(details);
     if(userValid)
     {
         CreateCookie(details);
         if(StaticVariables.Role.Equals("Director"))
         {
             return RedirectToAction("Director", "Home");
         }
         else if (StaticVariables.Role.Equals("Advisor"))
         {
             return RedirectToAction("Advisor", "Home");
         }
         else
         {
             return RedirectToAction("Student", "Home");
         }
     }
     else
     {
         details = new LoginDetails();
         return View(details);
     }
 }
Ejemplo n.º 25
0
        public IActionResult Login(LoginDetails loginDetails)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    EmployeeService employeeService = new EmployeeService();
                    Employee        emp             = employeeService.ValidateEmployee(loginDetails);

                    if (emp.category == "employee" || emp.category == "manager")
                    {
                        return(RedirectToAction("Index", "Employee", new { id = emp.EmpID }));
                    }
                    else if (emp.category == "admin")
                    {
                        return(RedirectToAction("Display", "Admin"));
                    }
                    else
                    {
                        return(RedirectToAction("Login", "Home"));
                    }
                }
            }
            catch (Exception e)
            {
                ErrorViewModel errorView = new ErrorViewModel();
                errorView.Message = "Error Occured while login";
                errorView.Reason  = e.Message;
                return(RedirectToAction("Error", "ErrorHandling", errorView));
            }
            return(View());
        }
Ejemplo n.º 26
0
        // DELETE: api/User/5
        public async Task <HttpResponseMessage> Delete([FromBody] LoginDetails user)
        {
            try
            {
                var result = await userRepository.DeleteUser(user.UserName);

                if (result)
                {
                    return(new HttpResponseMessage()
                    {
                        StatusCode = HttpStatusCode.OK
                    });
                }
                return(new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.BadRequest
                });
            }
            catch (Exception ex)
            {
                loggers.LogError(ex);
                return(new HttpResponseMessage()
                {
                    StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(JsonConvert.SerializeObject(ex.Message))
                });
            }
        }
Ejemplo n.º 27
0
        public UserDetails AuthenticateUser(LoginDetails loginDetails)
        {
            var userDetails = new UserDetails();
            var details     = userDetails.AuthenticateUser(loginDetails);

            return(details);
        }
Ejemplo n.º 28
0
        public LoginDetails Login(string userName, string password)
        {
            LoginDetails output = new LoginDetails();

            try
            {
                using (MySqlCommand cmd = new MySqlCommand("select userFirstName ,userLastName,userEmail,B.rolName " +
                                                           "from users as A join roles as B on A.rolId=B.rolId where userEmail=@userEmail and userPassword=@userPassword", con))
                {
                    con.Open();
                    cmd.Parameters.AddWithValue("@userEmail", userName);
                    cmd.Parameters.AddWithValue("@userPassword", password);
                    MySqlDataAdapter da = new MySqlDataAdapter(cmd);
                    DataSet          ds = new DataSet();
                    da.Fill(ds);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        output.firstName = ds.Tables[0].Rows[0]["userFirstName"].ToString();
                        output.lastName  = ds.Tables[0].Rows[0]["userLastName"].ToString();
                        output.email     = ds.Tables[0].Rows[0]["userEmail"].ToString();
                        output.role      = ds.Tables[0].Rows[0]["rolName"].ToString();
                    }

                    da.Dispose();
                    con.Close();
                }
            }
            catch (Exception e)
            {
                throw;
            }

            return(output);
        }
Ejemplo n.º 29
0
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";
            var logon = new LoginDetails();

            return(View("~/Views/Login/LoginCRSFPage.cshtml", logon));
        }
Ejemplo n.º 30
0
        public async Task <ActionResult <LoginDetails> > PostLoginDetails(LoginDetails loginDetails)
        {
            _context.LoginDetails.Add(loginDetails);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLoginDetails", new { id = loginDetails.id }, loginDetails));
        }
Ejemplo n.º 31
0
 public string Execute(string query, LoginDetails loginDetails)
 {
     string result;
     using (var ms = new MemoryStream(2048))
     using (var tw = new StreamWriter(ms))
     {
         var executor = new SqlExecutor(tw, loginDetails);
         executor.Execute(query);
         tw.Flush();
         ms.Position = 0;
         using (var tr = new StreamReader(ms))
         {
             result = tr.ReadToEnd();
         }
     }
     return result;
 }
Ejemplo n.º 32
0
    public ErrCode AuthenticateUser(LoginDetails login, out int functionary_id, out string role)
    {
        ErrCode err = SiteProvider.CurrentProvider.AuthenticateUser(login, out functionary_id, out role);

        return err;
    }
 public LoginWindow(LoginDetails loginDetails)
 {
     _loginDetails = loginDetails;
     InitializeComponent();
 }
        public frmSyncManager(CloudService mezeoFileCloud, LoginDetails loginDetails, NotificationManager notificationManager)
        {
            InitializeComponent();

            cMezeoFileCloud = mezeoFileCloud;

            cMezeoFileCloud.fileCloud.downloadStoppedEvent += new MezeoFileCloud.FileDownloadStoppedEvent(cMezeoFileCloud_downloadStoppedEvent);

            cMezeoFileCloud.fileCloud.uploadStoppedEvent += new MezeoFileCloud.FileUploadStoppedEvent(cMezeoFileCloud_uploadStoppedEvent);

            cLoginDetails = loginDetails;
            cnotificationManager = notificationManager;

            LoadResources();

            watcher = new Watcher(BasicInfo.SyncDirPath);
            EventQueue.WatchCompletedEvent += new EventQueue.WatchCompleted(queue_WatchCompletedEvent);
            CheckForIllegalCrossThreadCalls = false;

            watcher.StartMonitor();
            dbHandler = new DbHandler();
            dbHandler.OpenConnection();

            frmIssuesFound = new frmIssues(mezeoFileCloud, this);
            offlineWatcher = new OfflineWatcher(dbHandler);

            myDelegate = new MezeoFileSupport.CallbackIncrementProgress(this.CallbackSyncProgress);
            ContinueRunningDelegate = new MezeoFileSupport.CallbackContinueRunning(this.CallbackContinueRun);
        }
Ejemplo n.º 35
0
        public  LoginViewModel()
        {

            GetLogin = new RelayCommand(() => Login(),OnCanLogin);
            CancelLogin = new RelayCommand(() => cancleLogin());
            Exceptionpopupcommand = new RelayCommand(() => dismisException());
            logindetails = new LoginDetails();
            logindetails.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(logindetails_PropertyChanged);
            Loginbuttonvisibility = "Visible";
            Cancelbuttonvisibility = "Collapsed";
            cts = new CancellationTokenSource();
            
        }
Ejemplo n.º 36
0
        private void Connect_Click(object sender, EventArgs e)
        {
            LoginDetails login = new LoginDetails();
            login.Hostname = _hostName;
            login.LoginName = _loginName;
            login.Proxy = _proxy;
            login.UseProxy = _useProxy;
            login.Port = _port;
            login.Password = _password;
            login.EditorPassword = _editorPassword;
            login.Sitename = _siteName;
            login.LoginHost = _loginHost;
            login.LocalDebug = _localDebug;
            login.iDLogin = _iDLogin;

            DialogResult result = login.ShowDialog();
            if (result == DialogResult.OK)
            {
                _hostName = login.Hostname;
                _loginName = login.LoginName;
                _proxy = login.Proxy;
                _useProxy = login.UseProxy;
                _port = login.Port;
                _password = login.Password;
                _editorPassword = login.EditorPassword;
                _siteName = login.Sitename;
                _loginHost = login.LoginHost;
                _localDebug = login.LocalDebug;
                _iDLogin = login.iDLogin;
                label1.Text = "Host: " + _hostName + ", Proxy: " + _proxy + ":" + _port + "\n"
                    + "Login: "******", Site: " + _siteName;
                label1.Text += "\nLog file: " + GetLogFile();
                ConnectToServer();

                this.Text = GetFriendlyHostname(_hostName);
            }
        }
        public int CheckServerStatus()
        {
            int nStatusCode = 0;

            if (cLoginDetails == null)
            {
                cLoginDetails = frmParent.loginFromSyncManager();
                if (cLoginDetails == null)
                    return -1;
            }

            NQLengthResult nqLengthRes = cMezeoFileCloud.NQGetLength(BasicInfo.ServiceUrl + cLoginDetails.szNQParentUri, BasicInfo.GetQueueName(), ref nStatusCode);
            if (nStatusCode == ResponseCode.LOGINFAILED1 || nStatusCode == ResponseCode.LOGINFAILED2)
            {
                StopSync();
                this.Hide();
                SetCanNotTalkToServer(true);
                frmParent.ShowLoginAgainFromSyncMgr();
                return -1;
            }
            else if (nStatusCode != ResponseCode.NQGETLENGTH)
            {
                StopSync();
                DisableSyncManager();
                SetCanNotTalkToServer(true);
                ShowSyncManagerOffline();
                return -2;
            }

            SetCanNotTalkToServer(false);

            return 1;
        }