This repository has been archived by the owner on Jun 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Default.cshtml
129 lines (124 loc) · 6.17 KB
/
Default.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
@{
Layout = "~/Shared/_Layout.cshtml";
Page.Title = "Studenten Volg Systeem";
App.LoginShow = true; //laat inlogknop zien
//stuurt naar juiste pagina wanneer is ingelogd
if (WebSecurity.IsAuthenticated && Roles.IsUserInRole(WebSecurity.CurrentUserName, "Student"))
{
Response.Redirect("~/Students/");
}
else if (WebSecurity.IsAuthenticated && Roles.IsUserInRole(WebSecurity.CurrentUserName, "SLB"))
{
Response.Redirect("~/SLB/");
}
else if (WebSecurity.IsAuthenticated && Roles.IsUserInRole(WebSecurity.CurrentUserName, "Admin"))
{
Response.Redirect("~/Admin/");
}
var username = "";
var password = "";
var rememberMe = false;
//nhl richtlijnen invoegen...
Validation.RequireField("username", "Je moet een gebruikersnaam invullen.");
Validation.RequireField("password", "Je moet een wachtwoord invullen.");
Validation.Add("password", Validator.StringLength(maxLength: Int32.MaxValue, minLength: 3, errorMessage: "Wachtwoord moet minimaal 8 characters lang zijn."));
username = Request.Form["username"];
rememberMe = Request.Form["rememberMe"].AsBool();
if (IsPost)
{
if (Validation.IsValid())
{
password = Request.Form["password"];
if (WebSecurity.UserExists(username) && WebSecurity.GetPasswordFailuresSinceLastSuccess(username) > 4 && WebSecurity.GetLastPasswordFailureDate(username).AddSeconds(60) > DateTime.UtcNow)
{
Response.Redirect("~/Account/AccountLockedOut");
return;
}
if (WebSecurity.Login(username, password, rememberMe))
{
Response.Redirect("~");
}
else
{
ModelState.AddFormError("Je gebruikersnaam of wachtwoord is niet goed!");
}
}
<script type="text/javascript">
$(window).load(function () {
$('#inloggen').modal('show');
});
</script>
}
@section navbar{
}
<div class="jumbotron">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h1>Studenten Volg Systeem</h1>
<p>Hét online portaal voor elke SLB'er</p>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-4">
<h3>Overzicht</h3>
<p>Leerling gegevens.</p>
<p>Met één klik op de knop</p>
</div>
<div class="col-lg-4">
<h3>Gesprekken</h3>
<p>Wie, waar, wanneer.</p>
<p>In een makkelijke agenda</p>
</div>
<div class="col-lg-4">
<h3>Tijdbesparend</h3>
<p>Minder tijd aan administratie.</p>
<p>Meer tijd voor studenten</p>
</div>
</div><!--einde row-->
</div><!--einde container-->
</div><!--einde jumbotron -->
<!--Begin Login popup-->
@section popup{
<div class="modal fade" id="inloggen" tabindex="-1" role="dialog" aria-labelledby="Inloggen" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Inloggen</h4>
</div><!--einde modal-header-->
<form method="post">
<div class="modal-body">
@* If one or more validation errors exist, show an error *@
@Html.ValidationSummary("Login is niet gelukt. Corrigeer de fouten en probeer het opnieuw.", excludeFieldErrors: true, htmlAttributes: null)
<div class="test">
<table id="loginpopup">
<tr>
<td class="hidden-sm hidden-xs"><label for="username" @if (!ModelState.IsValidField("username")) { <text> class="error-label" </text> }>Gebruikersnaam:</label></td>
<td><input type="text" id="username" name="username" @Validation.For("username") placeholder="gebruikersnaam" required /></td>
<td class="error-label" style="width: 245px">@Html.ValidationMessage("username")</td>
</tr>
<tr>
<td class="hidden-sm hidden-xs"><label for="password" @if (!ModelState.IsValidField("password")) { <text> class="error-label" </text> }>Wachtwoord:</label></td>
<td><input type="password" id="password" name="password" @Validation.For("password") placeholder="wachtwoord" required /></td>
<td class="error-label">@Html.ValidationMessage("password")</td>
</tr>
<tr>
<td><label class="checkbox" for="rememberMe">Onthoud mij?</label></td>
<td class="error-label"><input type="checkbox" id="rememberMe" name="rememberMe" value="true" /></td>
</tr>
</table><!-- einde table login pop up-->
</div>
</div><!-- einde modal-body-->
<div class="modal-footer">
<a href="/Account/ForgotPassword" class="btn btn-default">Wachtwoord Vergeten</a>
<input type="submit" value="Inloggen" class="btn btn-primary" />
</div><!--einde modal-footer-->
</form>
</div><!--einde modal-content-->
</div><!--einde modal-dialog-->
</div><!-- einde modal-fade-->
}
<!--Einde Login popup-->
}