Skip to content
Permalink
Browse files

Demo site: restrict password resets

  • Loading branch information...
yetanotherchris committed Jul 27, 2018
1 parent 4a2f170 commit 2cb858e0a0c3f3cc2e3f5c1980dd374f97499bd8
@@ -19,11 +19,11 @@ public class UserController : ControllerBase
{
private SignupEmail _signupEmail;
private ResetPasswordEmail _resetPasswordEmail;

public UserController(ApplicationSettings settings, UserServiceBase userManager,
IUserContext context, SettingsService settingsService,
IUserContext context, SettingsService settingsService,
SignupEmail signupEmail, ResetPasswordEmail resetPasswordEmail)
: base(settings, userManager, context, settingsService)
: base(settings, userManager, context, settingsService)
{
_signupEmail = signupEmail;
_resetPasswordEmail = resetPasswordEmail;
@@ -58,7 +58,7 @@ public ActionResult CompleteResetPassword(string id)
return RedirectToAction("Index", "Home");

RoadkillUser user = UserService.GetUserByResetKey(id);

if (user == null)
{
return View("CompleteResetPasswordInvalid");
@@ -154,7 +154,7 @@ public ActionResult Login(string email, string password, string fromUrl)
if (!string.IsNullOrWhiteSpace(fromUrl))
return Redirect(fromUrl);
else
return RedirectToAction("Index","Home");
return RedirectToAction("Index", "Home");
}
else
{
@@ -270,10 +270,11 @@ public ActionResult ResetPassword(string email)
if (ApplicationSettings.UseWindowsAuthentication)
return RedirectToAction("Index", "Home");

#if DEMOSITE
ModelState.AddModelError("General", "The demo site login cannot be changed.");
return View();
#endif
if (ApplicationSettings.IsDemoSite)
{
ModelState.AddModelError("General", "The demo site login cannot be changed.");
return View();
}

if (string.IsNullOrEmpty(email))
{
@@ -297,7 +298,7 @@ public ActionResult ResetPassword(string email)
Configuration.SiteSettings siteSettings = SettingsService.GetSiteSettings();
_resetPasswordEmail.Send(new UserViewModel(user));

return View("ResetPasswordSent",(object) email);
return View("ResetPasswordSent", (object)email);
}
else
{
@@ -307,7 +308,7 @@ public ActionResult ResetPassword(string email)
}

return View();
}
}

/// <summary>
/// Resends a signup confirmation email, from the signupcomplete page.
@@ -341,7 +342,7 @@ public ActionResult Signup()
Configuration.SiteSettings siteSettings = SettingsService.GetSiteSettings();
if (Context.IsLoggedIn || !siteSettings.AllowUserSignup || ApplicationSettings.UseWindowsAuthentication)
{
return RedirectToAction("Index","Home");
return RedirectToAction("Index", "Home");
}
else
{
@@ -358,7 +359,7 @@ public ActionResult Signup(UserViewModel model, bool? isCaptchaValid)
{
Configuration.SiteSettings siteSettings = SettingsService.GetSiteSettings();
if (Context.IsLoggedIn || !siteSettings.AllowUserSignup || ApplicationSettings.UseWindowsAuthentication)
return RedirectToAction("Index","Home");
return RedirectToAction("Index", "Home");

if (ModelState.IsValid)
{
@@ -409,4 +410,4 @@ public ActionResult LoggedInAs()
return PartialView();
}
}
}
}
@@ -1 +0,0 @@
//# sourceMappingURL=installerconstants.js.map

0 comments on commit 2cb858e

Please sign in to comment.
You can’t perform that action at this time.