public ActionResult Create(RegisterInput viewModel, string returnUrl = null) { Organization org = UserContext.Organization; if (org.IsPasscodeRequired && string.IsNullOrEmpty(viewModel.Passcode)) ModelState.AddModelError("Passcode", "The Company passcode field is required."); if (org.IsPasscodeRequired && viewModel.Passcode != org.Passcode) ModelState.AddModelError("Passcode", "Invalid Passcode."); if (!_registrationService.IsAllowedEmailDomain(org, viewModel.Email)) ModelState.AddModelError("Email", "Please register using an approved company email address."); if (viewModel.Password != viewModel.ConfirmPassword) ModelState.AddModelError("ConfirmPassword", "confirmation does not match"); if (ModelState.IsValid) { if (_registrationService.IsRegistered(org, viewModel.Email)) { ModelState.AddModelError("Email", "email address has already been registered"); } else { RegisterUser(org, viewModel.Email, viewModel.Password, viewModel.FirstName, viewModel.LastName,viewModel.IATA,viewModel.Affiliation); return Redirect(returnUrl ?? "/"); } } return View(viewModel); }
public ActionResult Create(string returnUrl = null) { var viewModel = new RegisterInput(); return View(viewModel); }
public ActionResult FacebookCallback(string code) { var fb = new FacebookClient(); dynamic result = fb.Post("oauth/access_token", new { client_id = "1413945942187674", client_secret = "4b4dbffff26c7f1ea9dcb9efa7abe1a1", redirect_uri = RedirectUri.AbsoluteUri, code = code }); var accessToken = result.access_token; //// Store the access token in the session Session["AccessToken"] = accessToken; // update the facebook client with the access token so // we can make requests on behalf of the user fb.AccessToken = accessToken; // Get the user's information dynamic me = fb.Get("me?fields=first_name,last_name,id,email"); string email = me.email; // Set the auth cookie // FormsAuthentication.SetAuthCookie(email, false); var viewModel = new RegisterInput(); viewModel.FirstName=me.first_name; viewModel.LastName=me.last_name; viewModel.Email=me.email; return View("Create",viewModel); }