public ActionResult Create(UserRegisterForm u) { try { if (ModelState.IsValid) { RegisterUser ru = new RegisterUser(); ru.Login = u.Login; ru.Mail = u.Mail; ru.BirthDate = u.BirthDate; int country; Int32.TryParse(u.SelectedCountry, out country); ru.Country = country; byte[] pwEncrypt; _encrypt = new RSAEncryption(ConsumeInstance.Get <byte[]>("Auth")); pwEncrypt = _encrypt.Encrypt(u.Password); ru.Password = Convert.ToBase64String(pwEncrypt); UserResponse ur = ConsumeInstance.PostWithReturn <RegisterUser, UserResponse>("User", ru); if (ur.ErrorCode == 1) { FlashMessage.Warning("Email already in use"); return(RedirectToAction("Create")); } else if (ur.ErrorCode == 2) { FlashMessage.Warning("Login already in use"); return(RedirectToAction("Create")); } else { FlashMessage.Confirmation("Account created"); } return(RedirectToAction("Login")); } else { return(View(u)); } } catch { return(View()); } }
public ActionResult Login(UserLoginForm ul) { try { if (ModelState.IsValid) { _encrypt = new RSAEncryption(ConsumeInstance.Get <byte[]>("Auth")); LoginUser lu = new LoginUser(); lu.Login = ul.Login; byte[] pwEncrypt = _encrypt.Encrypt(ul.Password); lu.Password = Convert.ToBase64String(pwEncrypt); User u = ConsumeInstance.PostWithReturn <LoginUser, User>("User/Login", lu); if (u.Login != lu.Login) { FlashMessage.Warning("Those credentials didn't match an existing user account"); return(View(ul)); } else if (u.IsActive == false) { FlashMessage.Warning("Your account has been deactivate, Please contact the admin"); return(RedirectToAction("Contact")); } else { SessionManager.Id = u.UserID; SessionManager.Login = u.Login; FlashMessage.Confirmation("Welcome " + u.Login); return(RedirectToAction("Index", "Home")); } } else { return(View(ul)); } } catch { return(View()); } }
public ActionResult Login(LogUser lu) { try { if (ModelState.IsValid) { byte[] pwEncrypt; _encrypt = new RSAEncryption(ConsumeInstance.Get <byte[]>("Auth/GetKey")); pwEncrypt = _encrypt.Encrypt(lu.Password); lu.Password = Convert.ToBase64String(pwEncrypt); User u = ConsumeInstance.PostWithReturn <LogUser, User>("User/Login", lu); if (u.Login != lu.Login) { FlashMessage.Warning("This account doesn't exists"); return(View(lu)); } else if (u.IsActive == false) { FlashMessage.Warning("Your account has been deactivate, Please contact the admin"); return(RedirectToAction("Contact")); } else { SessionManager.Id = u.Id; SessionManager.Login = u.Login; FlashMessage.Confirmation("Welcome " + u.Login); return(RedirectToAction("Index", "Home")); } } else { return(View(lu)); } } catch { return(View()); } }
public ActionResult Create(RegisterUser ru) { try { if (ModelState.IsValid) { byte[] pwEncrypt; _encrypt = new RSAEncryption(ConsumeInstance.Get <byte[]>("Auth/GetKey")); pwEncrypt = _encrypt.Encrypt(ru.Password); ru.Password = Convert.ToBase64String(pwEncrypt); UserResponse ur = ConsumeInstance.PostWithReturn <RegisterUser, UserResponse>("User", ru); if (ur.ErrorCode == 1) { FlashMessage.Warning("Email already in use"); return(View(ru)); } else if (ur.ErrorCode == 2) { FlashMessage.Warning("Login already in use"); return(View(ru)); } else { FlashMessage.Confirmation("Account created"); } return(RedirectToAction("Login")); } else { return(View(ru)); } } catch { return(View()); } }
public ActionResult Create(RegisterUser u) { try { if (ModelState.IsValid) { byte[] pwEncrypt; _encrypt = new RSAEncryption(Instance.Get <byte[]>("Auth")); pwEncrypt = _encrypt.Encrypt(u.Password); u.Password = Convert.ToBase64String(pwEncrypt); Instance.Post <RegisterUser>("User/", u); return(RedirectToAction("Index", "Home")); } else { return(View(u)); } } catch { return(View(u)); } }
public ActionResult EditPw(EditPasswordForm user) { try { if (ModelState.IsValid) { byte[] pwEncrypt; UserPassword up = new UserPassword(); _encrypt = new RSAEncryption(ConsumeInstance.Get <byte[]>("Auth")); pwEncrypt = _encrypt.Encrypt(user.Password); up.Password = Convert.ToBase64String(pwEncrypt); pwEncrypt = _encrypt.Encrypt(user.OldPassword); up.OldPassword = Convert.ToBase64String(pwEncrypt); UserResponse ur = ConsumeInstance.PutWithReturn <UserPassword, UserResponse>("User/ChangePw/" + SessionManager.Id, up); if (ur.ErrorCode == 3) { FlashMessage.Warning("The old password doesn't match"); return(View(user)); } else { FlashMessage.Confirmation("Password Changed, Please reconnect"); } SessionManager.Abandon(); return(RedirectToAction("Index", "Home")); } else { return(View(user)); } } catch { return(View()); } }
public BookingController(IRSAEncryption encrypt, IBooking bookingService) : base(encrypt, bookingService) { }
public CountryController(IRSAEncryption encrypt, IUser userService, ICountry countryService) : base(encrypt, userService) { _countryService = countryService; }
public AuthController(IRSAEncryption encrypt, IUser userService) : base(encrypt, userService) { }
public BaseController(IRSAEncryption encrypt, IArtist artistService) { _encrypt = encrypt; _artistService = artistService; }
public ArtistController(IRSAEncryption encrypt, IArtist artistService) : base(encrypt, artistService) { }
public BaseController(IRSAEncryption encrypt, IUser userService) { _encrypt = encrypt; _userService = userService; }
public HomeViewModel(IMvxNavigationService navigationService, IRSAEncryption rsaEncryption, IPermissionManager permissionManager) { _navigationService = navigationService; _rsaEncryption = rsaEncryption; _permissionManager = permissionManager; }
public AuthController(IRSAEncryption encrypt) { _encrypt = encrypt; }
public BaseController(IRSAEncryption encrypt, IBooking bookingService) { _encrypt = encrypt; _bookingService = bookingService; }
public UserController(IRSAEncryption encrypt) { _encrypt = encrypt; }
public EventController(IRSAEncryption encrypt, IEvent eventService) : base(encrypt, eventService) { }
public BaseController(IRSAEncryption encrypt, IEvent eventService) { _encrypt = encrypt; _eventService = eventService; }