public ActionResult AddUser(ValidateLogin login) { var check = _context.MyLogins.SingleOrDefault(m => m.EmployeeDetailsId == login.EmployeeID); if (check != null) { login.Valid = false; login.ErrorMessage = "Employee Id already Exists"; return(View("CreateUser", login)); } var emp = new myLogin() { EmployeeDetailsId = login.EmployeeID, Password = login.Password }; login.Valid = true; _context.MyLogins.Add(emp); _context.SaveChanges(); login.ErrorMessage = "User Created Successfully with id = " + login.EmployeeID + " Password = "******"CreateUser", login)); }
// // GET: /CMS/ public ActionResult Index() { ValidateLogin valLogin = new ValidateLogin(); ViewData["Result"] = ""; return(View(valLogin)); }
public string ForgotPassword(string uid, string pass, string invitecode) { ValidateLogin ValidateLogin = new ValidateLogin(); var res = ValidateLogin.ForgotPassword(uid, pass, invitecode); return(res); }
//public string validate(string uid, string pass, string invitecode) //{ // ValidateLogin ValidateLogin = new ValidateLogin(); // // var res = ValidateLogin.(uid, pass, invitecode); // //return res; // return ""; //} public string NewRegistration(string uid, string pass, string invitecode, string BackgroundLocationUpdate) { ValidateLogin ValidateLogin = new ValidateLogin(); var res = ValidateLogin.NewRegistration(uid, pass, invitecode); return(res); }
public ActionResult Index(ValidateLogin login, FormCollection form) { ViewData["Result"] = ""; if (ModelState.IsValid) { RepositoryOBTRS mOBTRS = new RepositoryOBTRS(); List <tbl_Administrator> LogName = mOBTRS.Login(form.Get("email").Trim(), form.Get("password").Trim()); if (LogName == null) { //Khong the ket noi Database ViewData["Result"] = "Can't connect to database server, please try again later!"; return(View(login)); } else if (LogName.Count == 1) { if (LogName[0].Admin_Active != false) { if (form.Get("Remember").ToString().ToLower() != "false") { //Luu vao Cookie //HttpCookie cookie = HttpContext.Response.Cookies.Get("cmsOBTRS"); HttpCookie cookie = new HttpCookie("cmsOBTRS"); cookie.Values["Username"] = LogName[0].Admin_Name; cookie.Values["ID"] = LogName[0].Admin_ID.ToString(); cookie.Expires = DateTime.Now.AddDays(+14); HttpContext.Response.Cookies.Set(cookie); } //Luu vào Session Session["LogedName"] = LogName[0].Admin_Name; Session["Admin_ID"] = LogName[0].Admin_ID; //Lay Alias Role cua Admin dang nhap he thong Session["Role"] = mOBTRS.CheckRole(LogName[0].Admin_RoleID); string a = Session["Role"].ToString(); //Dang nhap thanh cong if (!Response.IsRequestBeingRedirected) { Response.Redirect("/CMS/WelcomeAptech"); } } else { //Bi cam truy cap ViewData["Result"] = "Access Denied!"; return(View(login)); } } else { //Login sai mat khau va ten dang nhap ViewData["Result"] = "Username or password invalid.Login failure!"; return(View(login)); } } //Login unsuccessful return(View(login)); }
public ActionResult Login(LoginViewModel login) { //string username; //username = (Request["Username"]).ToString(); if (ModelState.IsValid) { try { customer.CustomerMobile = Convert.ToInt64(login.Username); } catch (FormatException) { customer.CustomerEMail = login.Username; } customer.CustomerPassword = login.Password; customer = ValidateLogin.validateSignIn(customer); //string role = (ValidateLogin.validateSignIn(user.role)).ToString(); //bool isvalid = ValidateLogin.validateSignIn(username,username, login.password); //if (isvalid) //{ // if ( == "Admin") // { // return RedirectToAction("AdminIndex", "Admin"); // } //} // //Response.Write("Login Successfully"); //else // Response.Write("Username and Password is incorrect"); //if (user == null) //{ // Response.Write("Username and Password is incorrect"); //} //else if (user.Role == "Admin") //{ // return RedirectToAction("Index", "Product"); //} //else if (user.Role == "Customer") //{ // return RedirectToAction("AdminIndex", "Admin"); //} if (customer != null) { FormsAuthentication.SetAuthCookie(customer.CustomerName, false); var authticket = new FormsAuthenticationTicket(1, customer.CustomerName, DateTime.Now, DateTime.Now.AddMinutes(20), false, customer.Role); string encryptedticket = FormsAuthentication.Encrypt(authticket); var authcookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedticket); HttpContext.Response.Cookies.Add(authcookie); Session["Id"] = customer.CustomerId; return(RedirectToAction("Index", "Home")); } else { Response.Write("Username and Password is Incorrect"); return(View()); } } return(View()); }
public ActionResult Index() { var login = new ValidateLogin() { EmployeeID = 0, Valid = true }; return(View(login)); }
public ActionResult Reset() { var login = new ValidateLogin() { Valid = true, ErrorMessage = "" }; return(View("ResetPassword", login)); }
// GET: Admin public ActionResult Index() { var validinfo = new ValidateLogin() { Valid = true, ErrorMessage = "" }; return(View(validinfo)); }
public IActionResult Login(string email, string password) { var user = ValidateLogin.ReturnLogin(email, password); if (user == null) { return(BadRequest("E-mail or Password invalid")); } return(Ok(user)); }
public ActionResult Validate(ValidateLogin login) { if (login.Password != "@admin123") { login.ErrorMessage = "Please provide right credentials"; login.Valid = false; return(View("Index", login)); } return(RedirectToAction("Manage", "Home")); }
public ActionResult Add() { var emp = new ValidateLogin() { EmployeeID = 0, Password = "", Valid = true, ErrorMessage = "Please enter the Employee Details" }; return(View("CreateUser", emp)); }
public void ValidationTest() { //Arrange var VL = new ValidateLogin(); //Act int result1 = VL.Validation("Eddy", "3ddy!"); int result2 = VL.Validation("Username", "Password"); //Assert Assert.AreNotEqual(0, result1); Assert.AreEqual(0, result2); }
// GET: Login public ActionResult ValidateUser(UserDetail userDetails) { //string cs = ConfigurationManager.ConnectionStrings["EstimatorDbContext"].ConnectionString; //EstimatorDbContext db = new EstimatorDbContext(); ValidateLogin vdal = new ValidateLogin(); if (vdal.Validate(userDetails)) { ViewBag.Message = "successful login"; //RedirectTo } else { ViewBag.Message = "Login failure"; } return(View()); }
private async void BtnLogin_Click(object sender, EventArgs e) { ValidateLogin login = new ValidateLogin(); await login.QueryAsync(EtUser.Text, EtPassword.Text); if (IsLogged) { AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog alertDialog = builder.Create(); alertDialog.SetTitle("Intelligent Identificator Security System"); //alertDialog.SetIcon(Resource.Drawable.Icon); alertDialog.SetMessage( $"Welcome back {Obj.User} !!!"); alertDialog.SetButton("Continue", (s, ev) => { try { var cameraIntent = new Intent(this, typeof(MainActivity)); StartActivity(cameraIntent); } catch (Exception exception) { System.Diagnostics.Debug.Write(exception.Message); } }); alertDialog.Show(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog alertDialog = builder.Create(); alertDialog.SetTitle("Intelligent Identificator Security System"); //alertDialog.SetIcon(Resource.Drawable.Icon); alertDialog.SetMessage( "Sorry you're not registered !!!"); alertDialog.SetButton("Continue", (s, ev) => { }); EtPassword.Text = ""; EtUser.Text = ""; alertDialog.Show(); } }
public ActionResult ChangePassword(ValidateLogin login) { var emp = _context.MyLogins.SingleOrDefault(m => m.EmployeeDetailsId == login.EmployeeID); if (emp == null) { login.Valid = false; login.ErrorMessage = "EmployeeId Does not Exist"; return(View("ManageAdmin", login)); } if (emp != null) { emp.Password = login.Password; _context.SaveChanges(); return(RedirectToAction("Index", "Login")); } return(View("ManageAdmin", login)); }
public ActionResult Login(Usuario usuario, string returnUrl) { if (ModelState.IsValid) { if (!usuario.IsValid(db)) { foreach (LoginValidate status in usuario.ErrorStates) { ModelState.AddModelError("", ValidateLogin.ErrorCodeToString(status)); } return(View(usuario)); } Usuario oUsr = db.Usuario.First(x => x.Clave == usuario.Clave); Session["UsuarioId"] = oUsr.UsuarioId; FormsAuthentication.SetAuthCookie(oUsr.Nombre, false); return(RedirectToAction("FiltroOrdenes", "OrdenTrabajo")); } return(View(usuario)); }
public ActionResult Index() { var validinfo = new ValidateLogin() { Valid = true, ErrorMessage = "", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, } }; return(View(validinfo)); }
public string ChangePassword(string strpass, string strnewpass, string memberid, string email) { MembersTableAdapters.MembersTableAdapter taMember = new MembersTableAdapters.MembersTableAdapter(); if (taMember.GetDataByMemberID(memberid).Count > 0) { DataRow dtMember = taMember.GetDataByMemberID(memberid).Rows[0]; ValidateLogin valLogin = new ValidateLogin(); if (valLogin.isValid(email, strpass)) { ICryptoService cryptoService = new PBKDF2(); //save this salt to the database string PasswordSalt = cryptoService.GenerateSalt(); //save this hash to the database string hashedPassword = cryptoService.Compute(strnewpass); taMember.UpdatePassword(hashedPassword, PasswordSalt, DateTime.Now, Convert.ToInt32(dtMember["AutoID"])); return "valid"; } else { return "invalid"; } } taMember.Dispose(); return "invalid"; }
public ActionResult Save(ValidateLogin logininfo) { if (!ModelState.IsValid) { var validinfo = new ValidateLogin() { Valid = false, ErrorMessage = "Please Enter proper Credentials", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo)); } var myLogin = _context.MyLogins.SingleOrDefault(c => c.EmployeeDetailsId == logininfo.EmployeeID); if (myLogin == null) { var validinfo = new ValidateLogin() { Valid = false, ErrorMessage = "The Employee Id does not exist", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo)); } if (logininfo.Password != myLogin.Password) { var validinfo = new ValidateLogin() { Valid = false, ErrorMessage = "The UserName or Password does not match", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo)); } if (logininfo.MonthVal == 1) { var employee = _context.Employess.SingleOrDefault(c => c.EmployeeId == logininfo.EmployeeID); var tablevalid = _context.TableValid.SingleOrDefault(c => c.Id == 1); if (!tablevalid.IsValid) { var validinfo = new ValidateLogin() { Valid = false, ErrorMessage = "Table has been not updated for the Month.Please Contact Administrator for details", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo)); } if (employee == null) { var validinfo = new ValidateLogin() { Valid = false, ErrorMessage = "User does not exist", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo)); } return(View("Sucess", employee)); } if (logininfo.MonthVal == 2) { var employee = _context.Employee2.SingleOrDefault(c => c.EmployeeId == logininfo.EmployeeID); var tablevalid = _context.TableValid.SingleOrDefault(c => c.Id == 2); if (!tablevalid.IsValid) { var validinfo = new ValidateLogin() { Valid = false, ErrorMessage = "Table has been not updated for the Selected Month.Please Contact Administrator for details", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo)); } if (employee == null) { // if (employee == null) { var validinfo = new ValidateLogin() { Valid = false, ErrorMessage = "User does not exist", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo)); } } return(View("Success2", employee)); } if (logininfo.MonthVal == 3) { var employee = _context.Employee3.SingleOrDefault(c => c.EmployeeId == logininfo.EmployeeID); var tablevalid = _context.TableValid.SingleOrDefault(c => c.Id == 3); if (!tablevalid.IsValid) { var validinfo = new ValidateLogin() { Valid = false, ErrorMessage = "Table has been not updated for the Selected Month.Please Contact Administrator for details", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo)); } if (employee == null) { var validinfo = new ValidateLogin() { Valid = false, ErrorMessage = "User does not exist", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo)); } return(View("Success3", employee)); } var validinfo4 = new ValidateLogin() { Valid = false, ErrorMessage = "Please Choose a proper month", Month = new[] { new SelectListItem { Value = "1", Text = DateTime.Now.AddMonths(-1).ToString("MMMM") }, new SelectListItem { Value = "2", Text = DateTime.Now.AddMonths(-2).ToString("MMMM") }, new SelectListItem { Value = "3", Text = DateTime.Now.AddMonths(-3).ToString("MMMM") }, }, MonthVal = logininfo.MonthVal }; return(View("Index", validinfo4)); }
static void Main(string[] args) { loginuser lu = new loginuser(); ValidateLogin vl = new ValidateLogin(); Addtask at = new Addtask(); Showtask st = new Showtask(); AddComment ac = new AddComment(); Showcomments sc = new Showcomments(); List <loginuser> user; user = lu.addloginuser(); Console.WriteLine("Login Page"); Console.WriteLine("Enter the user name:"); String Username = Console.ReadLine(); Console.WriteLine("Enter the password:"******"1.Add a Task\n2.Show tasks assigned to me\n3.WriteComments\n4.Show Comments\n5.Logout"); Console.WriteLine("Enter your choice:"); int ch = Convert.ToInt32(Console.ReadLine()); switch (ch) { case 1: { task = at.addtask(Username); break; } case 2: { st.showtask(Username, task); break; } case 3: { comments = ac.Addcomment(Username, task); break; } case 4: { sc.showcomments(Username, comments); break; } case 5: { Username = "******"; Console.WriteLine("Successfully Logout!!"); break; } } Console.WriteLine("Do You want to continue? yes/no"); String ans = Console.ReadLine(); if (ans == "yes" || ans == "y" || ans == "Yes") { flag = true; } else { flag = false; } } }
public static void Main(string[] args) { string PAT = string.Empty; string accountName = string.Empty; string projectName = string.Empty; Console.WriteLine("Please enter Account Name"); accountName = Console.ReadLine(); Console.WriteLine("Please enter Personal access token"); PAT = Console.ReadLine(); Console.WriteLine("Please enter project name"); projectName = Console.ReadLine(); Configuration sourceconfig = new Configuration() { UriString = "https://" + accountName + ".visualstudio.com:", PersonalAccessToken = PAT, Project = projectName }; VstsRestAPI.Configuration vstsAPIConfiguration = new VstsRestAPI.Configuration() { UriString = "https://" + accountName + ".visualstudio.com:", PersonalAccessToken = PAT, Project = projectName }; ValidateLogin objLogin = new ValidateLogin(vstsAPIConfiguration); bool isValidAccount = objLogin.isValidAccount(); if (isValidAccount) { Console.WriteLine("Generating templates...."); Console.WriteLine(); ExportQueries objQuery = new ExportQueries(vstsAPIConfiguration); //queryList = objQuery.GetQueries(projectName); objQuery.GetQueriesByPath(projectName, string.Empty); ExportDashboards objWidgetAndCharts = new ExportDashboards(vstsAPIConfiguration); objWidgetAndCharts.GetDashboard(projectName); Console.WriteLine("Queries and Dashboard JSONs are saved into Template folder"); Console.WriteLine(""); Teams objTeam = new Teams(vstsAPIConfiguration); objTeam.ExportTeams(projectName); Console.WriteLine("Teams JSON is saved into Template folder"); Console.WriteLine(""); SourceCode objSourceCode = new SourceCode(vstsAPIConfiguration); objSourceCode.ExportSourceCode(projectName); Console.WriteLine("ImportSourceCode JSON is saved into Template folder"); Console.WriteLine(""); BoardColumns objColumn = new BoardColumns(vstsAPIConfiguration); objColumn.ExportBoardColumns(projectName); Console.WriteLine("BoardColumn JSON file is saved into Template folder"); Console.WriteLine(""); GenerateWIFromSource wiql = new GenerateWIFromSource(sourceconfig, accountName); wiql.UpdateWorkItem(); Console.WriteLine("Work item JSON files are saved into Templates folder"); Console.WriteLine(""); BuildDefinitions objBuild = new BuildDefinitions(vstsAPIConfiguration, accountName); ReleaseDefinitions objRelease = new ReleaseDefinitions(vstsAPIConfiguration, accountName); objBuild.ExportBuildDefinitions(projectName); objRelease.ExportReleaseDefinitions(projectName); Console.WriteLine("Build and Release Definitions are saved into Templates folder"); Console.WriteLine(""); CardFieldsAndCardStyles objCards = new CardFieldsAndCardStyles(vstsAPIConfiguration); objCards.GetCardFields(projectName); objCards.GetCardStyles(projectName); Console.WriteLine("CardField and CardStyle JSON files are saved into Templates folder"); Console.WriteLine(""); PullRequests objPullRequest = new PullRequests(vstsAPIConfiguration); objPullRequest.ExportPullRequests(projectName); Console.WriteLine("PullReqests and comments JSON files are saved into Templates folder"); Console.WriteLine(""); Console.WriteLine("Completed generating templates from " + projectName); var wait = Console.ReadLine(); } else { Console.WriteLine(""); Console.WriteLine("Invalid Account name or PAT, re-run the application and try again!"); var wait = Console.ReadLine(); } }
public LoginControl(LoginWindow loginWindow) { _validateLogin = new ValidateLogin(); _loginWindow = loginWindow; _loadDatabase = new LoadDatabase(); }