Skip to content

Commit c495940

Browse files
committed
Implemented login page.
1 parent 592bde0 commit c495940

File tree

10 files changed

+152
-165
lines changed

10 files changed

+152
-165
lines changed
Lines changed: 42 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
@using System.Globalization
2-
@using Abp.Extensions
3-
@using Abp.MultiTenancy
4-
@using AbpCompanyName.AbpProjectName.MultiTenancy
1+
@using Abp.Authorization.Users
52
@model AbpCompanyName.AbpProjectName.Web.Models.Account.LoginFormViewModel
63
@section Styles
74
{
@@ -24,83 +21,48 @@
2421
<script src="~/view-resources/Views/Account/Login.min.js" asp-append-version="true"></script>
2522
</environment>
2623
}
27-
<div class="container">
28-
<div id="LoginArea" class="row">
29-
<div class="col-lg-12">
30-
<div class="well bs-component">
31-
<form asp-action="Login" id="LoginForm" class="form-horizontal" method="POST">
32-
<input type="hidden" name="returnUrl" value="@Model.ReturnUrl" />
33-
<input type="hidden" name="returnUrlHash" />
34-
<fieldset>
35-
<legend>@L("LogIn")</legend>
36-
<div class="form-group">
37-
<div class="col-lg-12">
38-
<input type="text" class="form-control" name="usernameOrEmailAddress" placeholder="@L("UserNameOrEmail")" required maxlength="@AbpCompanyName.AbpProjectName.Authorization.Users.User.MaxEmailAddressLength">
39-
</div>
40-
</div>
41-
<div class="form-group">
42-
<div class="col-lg-12">
43-
<input type="password" class="form-control" name="Password" placeholder="@L("Password")" required maxlength="@AbpCompanyName.AbpProjectName.Authorization.Users.User.MaxPlainPasswordLength">
44-
<div class="checkbox">
45-
<label>
46-
<input type="checkbox" name="RememberMe" value="true">
47-
<span class="ripple"></span>
48-
<span class="check"></span> @L("RememberMe")
49-
</label>
50-
</div>
51-
</div>
52-
</div>
53-
<div class="form-group">
54-
<div class="col-lg-12">
55-
<button id="LoginButton" type="submit" class="btn btn-primary"><i class="fa fa-sign-in"></i> @L("LogIn")</button>
56-
@if (Model.IsSelfRegistrationAllowed)
57-
{
58-
<a class="btn btn-success" href="@Url.Action("Register")"><i class="fa fa-sign-in"></i> @L("Register")</a>
59-
}
60-
</div>
61-
</div>
62-
</fieldset>
63-
</form>
64-
@{
65-
var loginProviders = Context.Authentication
66-
.GetAuthenticationSchemes()
67-
.Where(s => !s.DisplayName.IsNullOrWhiteSpace())
68-
.ToList();
69-
70-
Func<string, string> getSocialIconClass = (provider) =>
24+
<div class="card">
25+
<div class="body">
26+
<form id="LoginForm" method="POST" asp-action="Login">
27+
<input type="hidden" name="returnUrl" value="@Model.ReturnUrl" />
28+
<input type="hidden" name="returnUrlHash" />
29+
<h4 class="text-center">@L("LogIn")</h4>
30+
<div class="input-group">
31+
<span class="input-group-addon">
32+
<i class="material-icons">person</i>
33+
</span>
34+
<div class="form-line">
35+
<input type="text" class="form-control" name="usernameOrEmailAddress" placeholder="@L("UserNameOrEmail")" required autofocus maxlength="@AbpUserBase.MaxEmailAddressLength">
36+
</div>
37+
</div>
38+
<div class="input-group">
39+
<span class="input-group-addon">
40+
<i class="material-icons">lock</i>
41+
</span>
42+
<div class="form-line">
43+
<input type="password" class="form-control" name="Password" placeholder="@L("Password")" required maxlength="@AbpUserBase.MaxPlainPasswordLength">
44+
</div>
45+
</div>
46+
<div class="row">
47+
<div class="col-xs-8 p-t-5">
48+
<input type="checkbox" name="RememberMe" id="rememberme" class="filled-in chk-col-pink" value="true">
49+
<label for="rememberme">@L("RememberMe")</label>
50+
</div>
51+
<div class="col-xs-4">
52+
<button id="LoginButton" class="btn btn-block bg-pink waves-effect" type="submit">@L("LogIn")</button>
53+
</div>
54+
</div>
55+
<div class="row m-t-15 m-b--20">
56+
<div class="col-xs-6">
57+
@if (Model.IsSelfRegistrationAllowed)
7158
{
72-
provider = provider.ToLowerInvariant();
73-
74-
if (provider == "microsoft")
75-
{
76-
return "windows";
77-
}
78-
79-
return provider;
80-
};
81-
}
82-
83-
@if (loginProviders.Count > 0)
84-
{
85-
<div class="login-options">
86-
<h4>@L("LoginWith")</h4>
87-
<ul class="social-icons">
88-
<form asp-action="ExternalLogin" method="post">
89-
<input type="hidden" name="returnUrl" value="@ViewBag.ReturnUrl" />
90-
<input type="hidden" name="provider" value="" />
91-
92-
@foreach (var p in loginProviders)
93-
{
94-
<a class="btn btn-default btn-sm fa fa-@(getSocialIconClass(p.DisplayName)) social-login-link" title="@p.DisplayName"
95-
data-provider="@p.DisplayName"
96-
href="javascript:;">
97-
</a>
98-
}
99-
</form>
100-
</ul>
101-
</div>
102-
}
59+
<a asp-action="Register">@L("Register")</a>
60+
}
61+
</div>
62+
<div class="col-xs-6 align-right">
63+
<a href="javascript:void(0);">Forgot Password?</a>
64+
</div>
10365
</div>
104-
</div>
66+
</form>
10567
</div>
10668
</div>

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/Views/Account/_Layout.cshtml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
@inject IAbpAntiForgeryManager AbpAntiForgeryManager
77
@inject IMultiTenancyConfig MultiTenancyConfig
88
@inject IWebResourceManager WebResourceManager
9-
109
@{
1110
Layout = null;
1211
AbpAntiForgeryManager.SetCookie(Context);
@@ -16,7 +15,7 @@
1615
<head>
1716
<meta charset="utf-8">
1817
<meta http-equiv="X-UA-Compatible" content="IE=edge">
19-
<meta name="viewport" content="width=device-width, initial-scale=1">
18+
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
2019
<meta name="description" content="">
2120
<meta name="author" content="">
2221

@@ -25,13 +24,21 @@
2524
<title>AbpProjectName</title>
2625

2726
<environment names="Development">
27+
<!-- TODO: Bundles! -->
28+
<!-- Google Fonts -->
29+
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
30+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">
31+
2832
<!-- ~/Bundles/vendor/css -->
2933
<link rel="stylesheet" href="~/lib/jquery-ui/themes/base/all.css" asp-append-version="true" />
30-
<link rel="stylesheet" href="~/lib/bootstrap-theme-cosmo/cosmo.min.css" asp-append-version="true" />
34+
<link rel="stylesheet" href="~/plugins/bootstrap/css/bootstrap.css" asp-append-version="true" />
3135
<link rel="stylesheet" href="~/lib/toastr/toastr.css" asp-append-version="true" />
3236
<link rel="stylesheet" href="~/lib/sweetalert/dist/sweetalert.css" asp-append-version="true" />
3337
<link rel="stylesheet" href="~/lib/famfamfam-flags/dist/sprite/famfamfam-flags.css" asp-append-version="true" />
3438
<link rel="stylesheet" href="~/lib/font-awesome/css/font-awesome.css" asp-append-version="true" />
39+
<link rel="stylesheet" href="~/plugins/node-waves/waves.css" asp-append-version="true" />
40+
<link rel="stylesheet" href="~/plugins/animate-css/animate.css" asp-append-version="true" />
41+
<link href="~/css/style.css" rel="stylesheet">
3542

3643
<link rel="stylesheet" href="~/css/main.css" asp-append-version="true" />
3744
</environment>
@@ -40,33 +47,33 @@
4047
<link rel="stylesheet" href="~/view-resources/Views/_Bundles/layout-libs.min.css" asp-append-version="true" />
4148
</environment>
4249

43-
4450
<!-- View specific styles -->
4551
@RenderSection("styles", required: false)
4652

4753
<script type="text/javascript">
4854
//This is used to get the application's root path from javascript. It's useful if you're running application in a virtual directory under IIS.
49-
var abp = abp || {}; abp.appPath = '@ApplicationPath';
55+
var abp = abp || {};
56+
abp.appPath = '@ApplicationPath';
5057
</script>
5158

5259
</head>
53-
<body>
54-
@if (ViewBag.DisableTopBar == null || ViewBag.DisableTopBar != true)
55-
{
56-
Html.RenderPartial("_TopBar");
57-
}
58-
59-
@if (MultiTenancyConfig.IsEnabled)
60-
{
61-
<div class="content tenant-change-box">
62-
<vc:tenant-change></vc:tenant-change>
60+
<body class="login-page">
61+
62+
<div class="login-box">
63+
<div class="logo">
64+
<a href="javascript:void(0);">AbpProjectName</a>
6365
</div>
64-
}
6566

66-
<div class="container">
67+
@if (MultiTenancyConfig.IsEnabled)
68+
{
69+
<div class="tenant-change-box">
70+
<vc:tenant-change></vc:tenant-change>
71+
</div>
72+
}
73+
6774
@RenderBody()
68-
</div>
6975

76+
</div>
7077
<environment names="Development">
7178
<script src="~/lib/json2/json2.js" asp-append-version="true"></script>
7279
<script src="~/lib/jquery/dist/jquery.js" asp-append-version="true"></script>
@@ -79,6 +86,7 @@
7986
<script src="~/lib/sweetalert/dist/sweetalert-dev.js" asp-append-version="true"></script>
8087
<script src="~/lib/spin.js/spin.js" asp-append-version="true"></script>
8188
<script src="~/lib/spin.js/jquery.spin.js" asp-append-version="true"></script>
89+
<script src="~/plugins/node-waves/waves.js"></script>
8290

8391
<script src="~/lib/abp-web-resources/Abp/Framework/scripts/abp.js" asp-append-version="true"></script>
8492
<script src="~/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.jquery.js" asp-append-version="true"></script>
@@ -89,6 +97,7 @@
8997

9098
<script src="~/lib/signalr/jquery.signalR.js" asp-append-version="true"></script>
9199

100+
<script src="~/js/admin.js"></script>
92101
<script src="~/js/main.js" asp-append-version="true"></script>
93102
</environment>
94103

@@ -98,8 +107,8 @@
98107
</environment>
99108

100109
<script>
101-
//Localizing momentjs
102-
moment.locale('@CultureInfo.CurrentUICulture.Name');
110+
//Localizing momentjs
111+
moment.locale('@CultureInfo.CurrentUICulture.Name');
103112
</script>
104113

105114
<!-- Dynamic scripts of ABP system (They are created on runtime and can not be bundled) -->
@@ -110,7 +119,7 @@
110119
<script src="~/signalr/hubs"></script>
111120
@*@Html.IncludeScript("~/Abp/Framework/scripts/libs/abp.signalr.js")*@
112121

113-
@WebResourceManager.RenderScripts();
122+
@WebResourceManager.RenderScripts()
114123

115124
<!-- View specific scripts -->
116125
@RenderSection("scripts", required: false)
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
@using Abp.MultiTenancy
2-
@using AbpCompanyName.AbpProjectName.Web.Models.Common.Modals
3-
@using AbpCompanyName.AbpProjectName.Web.Resources
1+
@using AbpCompanyName.AbpProjectName.Web.Resources
42
@inject IWebResourceManager WebResourceManager
53
@{
64
WebResourceManager.AddScript(ApplicationPath + "view-resources/Views/Shared/Components/TenantChange/Default.js");
75
}
8-
<div class="well tenant-change-component">
9-
<span>
10-
@L("CurrentTenant"):
6+
<div class="card tenant-change-component" style="margin-bottom: 3px;">
7+
<div class="body text-center">
8+
<span>
9+
@L("CurrentTenant"):
1110

12-
@if (Model.Tenant != null)
13-
{
14-
<span title="@Model.Tenant.Name"><strong>@Model.Tenant.TenancyName</strong></span>
15-
}
16-
else
17-
{
18-
<span>@L("NotSelected")</span>
19-
}
11+
@if (Model.Tenant != null)
12+
{
13+
<span title="@Model.Tenant.Name"><strong>@Model.Tenant.TenancyName</strong></span>
14+
}
15+
else
16+
{
17+
<span>@L("NotSelected")</span>
18+
}
2019

21-
(<a href="#" data-toggle="modal" data-target="#TenantChangeModal">@L("Change")</a>)
22-
</span>
20+
(<a href="#" data-toggle="modal" data-target="#TenantChangeModal">@L("Change")</a>)
21+
</span>
22+
</div>
2323
</div>
24-
2524
<div class="modal fade" id="TenantChangeModal" tabindex="-1" role="dialog" aria-labelledby="UserCreateModalLabel" data-backdrop="static">
2625
<div class="modal-dialog" role="document">
2726
<div class="modal-content">
28-
27+
2928
</div>
3029
</div>
31-
</div>
30+
</div>

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/Views/Shared/Components/TenantChange/TenantChangeViewComponent.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
52
using Abp.AutoMapper;
63
using AbpCompanyName.AbpProjectName.Sessions;
74
using Microsoft.AspNetCore.Mvc;

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/Views/Shared/Components/TenantChange/_ChangeModal.cshtml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
<div class="modal-body">
1111
<form name="TenantChangeForm" role="form" novalidate class="form-validation">
12-
<div class="form-group form-md-line-input form-md-floating-label">
13-
<label>@L("TenancyName")</label>
14-
<input class="form-control" type="text" name="TenancyName" maxlength="@AbpTenantBase.MaxTenancyNameLength" value="@Model.TenancyName">
15-
<span class="help-block">@L("LeaveEmptyToSwitchToHost")</span>
12+
<div class="form-group form-float">
13+
<div class="form-line">
14+
<input class="form-control" type="text" name="TenancyName" maxlength="@AbpTenantBase.MaxTenancyNameLength" value="@Model.TenancyName">
15+
<label class="form-label">@L("TenancyName")</label>
16+
</div>
1617
</div>
18+
<span class="help-block">@L("LeaveEmptyToSwitchToHost")</span>
1719
</form>
1820
</div>
1921

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<div class="modal-footer">
2-
<button type="button" class="btn btn-default close-button" data-dismiss="modal">@L("Cancel")</button>
3-
<button type="button" class="btn btn-primary save-button"><i class="fa fa-save"></i> <span>@L("Save")</span></button>
2+
<button type="button" class="btn btn-default close-button waves-effect" data-dismiss="modal">@L("Cancel")</button>
3+
<button type="button" class="btn btn-primary save-button waves-effect">@L("Save")</button>
44
</div>

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/wwwroot/js/admin.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,16 @@ $.AdminBSB.navbar = {
259259
*
260260
*/
261261
$.AdminBSB.input = {
262-
activate: function () {
262+
activate: function ($parentSelector) {
263+
$parentSelector = $parentSelector || $('body');
264+
263265
//On focus event
264-
$('.form-control').focus(function () {
266+
$parentSelector.find('.form-control').focus(function () {
265267
$(this).parent().addClass('focused');
266268
});
267269

268270
//On focusout event
269-
$('.form-control').focusout(function () {
271+
$parentSelector.find('.form-control').focusout(function () {
270272
var $this = $(this);
271273
if ($this.parents('.form-group').hasClass('form-float')) {
272274
if ($this.val() == '') { $this.parents('.form-line').removeClass('focused'); }
@@ -277,12 +279,12 @@ $.AdminBSB.input = {
277279
});
278280

279281
//On label click
280-
$('body').on('click', '.form-float .form-line .form-label', function () {
282+
$parentSelector.on('click', '.form-float .form-line .form-label', function () {
281283
$(this).parent().find('input').focus();
282284
});
283285

284286
//Not blank form
285-
$('.form-control').each(function () {
287+
$parentSelector.find('.form-control').each(function () {
286288
if ($(this).val() !== '') {
287289
$(this).parents('.form-line').addClass('focused');
288290
}

0 commit comments

Comments
 (0)