Skip to content

Commit

Permalink
Fixes #205
Browse files Browse the repository at this point in the history
  • Loading branch information
dlidstrom committed Sep 22, 2019
1 parent 752f908 commit 5d498b4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 25 deletions.
11 changes: 9 additions & 2 deletions MinaGlosor.Web/Controllers/AccountInviteController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ public ActionResult Invite(RequestCreateAccount request)
{
ModelState.AddModelError("Request", "Invalid request");
}
else if (ExecuteQuery(new GetUserByEmailQuery(request.UserEmail)) != null)
else if (string.IsNullOrWhiteSpace(request.UserEmail) == false)
{
// try to catch the spammers
return RedirectToAction("Index", "Home");
}
else if (ExecuteQuery(new GetUserByEmailQuery(request.UserEmail2)) != null)
{
ModelState.AddModelError("Email", "E-postadressen finns redan");
}
Expand All @@ -36,8 +41,10 @@ public ActionResult InviteSuccess()

public class RequestCreateAccount
{
[Required, MaxLength(254)]
public string UserEmail { get; set; }

[Required, MaxLength(254)]
public string UserEmail2 { get; set; }
}
}
}
1 change: 0 additions & 1 deletion MinaGlosor.Web/MinaGlosor.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@
<None Include="NLog.xsd">
<SubType>Designer</SubType>
</None>
<None Include="Properties\PublishProfiles\MinaGlosor-Netcetera.pubxml" />
<Content Include="Views\Emails\InviteUser.cshtml" />
<Content Include="Views\ResetPassword\Reset.cshtml" />
<Content Include="Views\Emails\ResetPassword.cshtml" />
Expand Down

This file was deleted.

4 changes: 3 additions & 1 deletion MinaGlosor.Web/Views/Home/RegisterOrLogin.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
</p>
<form method="POST" name="inviteform" action="@Url.Action("Invite", "AccountInvite")">
@Html.DisplayFor(model => Html.ViewData.ModelState, "ValidationSummary")
@* try to catch the spammers *@
<input style="display: none;" type="email" class="form-control" placeholder="Lämna den här tom" name="useremail" />
<div class="row">
<div class="col-md-4">
<div class="form-group" ng-class="{'has-error': inviteform.useremail.$dirty && inviteform.useremail.$invalid}">
Expand All @@ -17,7 +19,7 @@
</label>
<input type="email"
class="form-control"
name="useremail"
name="useremail2"
ng-model="user.email"
placeholder="Skriv e-postadress"
autofocus="autofocus"
Expand Down

0 comments on commit 5d498b4

Please sign in to comment.