Browse Source

Added config to disable password resets.

tags/2.0.3
Teknikode 4 years ago
parent
commit
e66d2fcd06

+ 4
- 1
Teknik/Areas/User/Views/User/Login.cshtml View File

@@ -20,7 +20,10 @@
<input id="loginRememberMe" type="checkbox" value="true" name="Login.RememberMe" data-val-required="The Remember Me field is required." data-val="true" /><input name="Login.RememberMe" type="hidden" value="false"> Remember Me
</label>
</div>
<p class="text-center"><a href="@Url.SubRouteUrl("user", "User.ResetPassword")">Forgotten Password?</a></p>
@if (Model.Config.UserConfig.PasswordResetEnabled)
{
<p class="text-center"><a href="@Url.SubRouteUrl("user", "User.ResetPassword")">Forgotten Password?</a></p>
}
<div class="form-group text-center">
<button class="btn btn-primary" id="loginSubmit" type="submit" name="Login.Submit">Sign In</button>
</div>

+ 20
- 13
Teknik/Areas/User/Views/User/ResetPassword.cshtml View File

@@ -6,19 +6,26 @@
<div class="row">
<div class="col-md-12">
<div class="text-center">
<h1>Reset Password</h1>
<div class="col-md-4 col-md-offset-4">
<form role="form" id="reset_pass_send" action="@Url.SubRouteUrl("user", "User.Action", new { action = "SendResetPasswordVerification" })" method="post" accept-charset="UTF-8">
<div class="form-group">
<label for="reset_username">Username</label>
<input type="text" class="form-control" id="reset_username" value="@Model.Username" placeholder="Username" name="reset_username" />
<span id="helpBlock" class="help-block">Send a temporary link to your recovery email to reset your password.</span>
</div>
<div class="form-group text-center">
<button class="btn btn-primary" id="reset_pass_send_submit" type="submit" name="reset_pass_send_submit">Send Reset Link</button>
</div>
</form>
</div>
@if (Model.Config.UserConfig.PasswordResetEnabled)
{
<h1>Reset Password</h1>
<div class="col-md-4 col-md-offset-4">
<form role="form" id="reset_pass_send" action="@Url.SubRouteUrl("user", "User.Action", new { action = "SendResetPasswordVerification" })" method="post" accept-charset="UTF-8">
<div class="form-group">
<label for="reset_username">Username</label>
<input type="text" class="form-control" id="reset_username" value="@Model.Username" placeholder="Username" name="reset_username" />
<span id="helpBlock" class="help-block">Send a temporary link to your recovery email to reset your password.</span>
</div>
<div class="form-group text-center">
<button class="btn btn-primary" id="reset_pass_send_submit" type="submit" name="reset_pass_send_submit">Send Reset Link</button>
</div>
</form>
</div>
}
else
{
<h3>Password Resets are Disabled</h3>
}
</div>
</div>
</div>

+ 28
- 21
Teknik/Areas/User/Views/User/ResetPasswordVerification.cshtml View File

@@ -6,27 +6,34 @@
<div class="row">
<div class="col-md-12">
<div class="text-center">
<h1>@(Model.Success ? "Reset Your Password" : "Invalid Password Reset Verification")</h1>
<div class="col-md-4 col-md-offset-4">
@if (Model.Success)
{
<form role="form" id="setNewPass" action="@Url.SubRouteUrl("user", "User.Action", new { action = "SetUserPassword" })" method="post" accept-charset="UTF-8">
<div class="form-group">
<input type="password" class="form-control" id="setNewPass_Password" value="" placeholder="Password" name="setNewPass_Password" data-val-required="The Password field is required." data-val="true" />
</div>
<div class="form-group">
<input type="password" class="form-control" id="setNewPass_ConfirmPassword" value="" placeholder="Confirm Password" name="setNewPass_ConfirmPassword" data-val-required="The Confirm Password field is required." data-val="true" />
</div>
<div class="form-group text-center">
<button class="btn btn-primary" id="setNewPass_submit" type="submit" name="setNewPass_submit">Reset Password</button>
</div>
</form>
}
else
{
<p>The verification you provided is not valid. Please check the URL and try again.</p>
}
</div>
@if (Model.Config.UserConfig.PasswordResetEnabled)
{
<h1>@(Model.Success ? "Reset Your Password" : "Invalid Password Reset Verification")</h1>
<div class="col-md-4 col-md-offset-4">
@if (Model.Success)
{
<form role="form" id="setNewPass" action="@Url.SubRouteUrl("user", "User.Action", new { action = "SetUserPassword" })" method="post" accept-charset="UTF-8">
<div class="form-group">
<input type="password" class="form-control" id="setNewPass_Password" value="" placeholder="Password" name="setNewPass_Password" data-val-required="The Password field is required." data-val="true" />
</div>
<div class="form-group">
<input type="password" class="form-control" id="setNewPass_ConfirmPassword" value="" placeholder="Confirm Password" name="setNewPass_ConfirmPassword" data-val-required="The Confirm Password field is required." data-val="true" />
</div>
<div class="form-group text-center">
<button class="btn btn-primary" id="setNewPass_submit" type="submit" name="setNewPass_submit">Reset Password</button>
</div>
</form>
}
else
{
<p>The verification you provided is not valid. Please check the URL and try again.</p>
}
</div>
}
else
{
<h3>Password Resets are Disabled</h3>
}
</div>
</div>
</div>

+ 2
- 0
Teknik/Configuration/UserConfig.cs View File

@@ -10,6 +10,7 @@ namespace Teknik.Configuration
{
public bool RegistrationEnabled { get; set; }
public bool LoginEnabled { get; set; }
public bool PasswordResetEnabled { get; set; }
public string UsernameFilter { get; set; }
public string UsernameFilterLabel { get; set; }
public int MinUsernameLength { get; set; }
@@ -20,6 +21,7 @@ namespace Teknik.Configuration
{
RegistrationEnabled = true;
LoginEnabled = true;
PasswordResetEnabled = true;
UsernameFilter = "^[a-zA-Z0-9_-]+(?:\\.[a-zA-Z0-9_-]+)*$";
UsernameFilterLabel = "AlphaNumeric Characters with Dashes, Underlines, and 0-1 Periods not in the beginning or end.";
MinUsernameLength = 1;

Loading…
Cancel
Save