diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj index eef65536..bc6fe3e4 100644 --- a/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -114,6 +114,9 @@ + + + @@ -147,7 +150,6 @@ - diff --git a/Bootstrap.Admin/Content/images/avatar1_small.jpg b/Bootstrap.Admin/Content/images/avatar1_small.jpg deleted file mode 100644 index 661cf883..00000000 Binary files a/Bootstrap.Admin/Content/images/avatar1_small.jpg and /dev/null differ diff --git a/Bootstrap.Admin/Content/images/bg2.jpg b/Bootstrap.Admin/Content/images/bg2.jpg new file mode 100644 index 00000000..802276b9 Binary files /dev/null and b/Bootstrap.Admin/Content/images/bg2.jpg differ diff --git a/Bootstrap.Admin/Content/images/bg3.png b/Bootstrap.Admin/Content/images/bg3.png new file mode 100644 index 00000000..f658fd55 Binary files /dev/null and b/Bootstrap.Admin/Content/images/bg3.png differ diff --git a/Bootstrap.Admin/Content/login-responsive.css b/Bootstrap.Admin/Content/login-responsive.css new file mode 100644 index 00000000..904ce55c --- /dev/null +++ b/Bootstrap.Admin/Content/login-responsive.css @@ -0,0 +1,38 @@ +@media (min-width: 375px) { + .form-signin { + width: 320px; + } +} + +@media (min-width: 768px) { + body { + background: url('images/bg2.jpg') fixed repeat; + } + + .container { + background: url('images/bg3.png') no-repeat; + background-size: contain; + width: 704px; + height: 404px; + margin: 0 auto; + } + + .form-signin { + border: none; + background: none; + width: auto; + } + + .form-signin .form-signin-heading { + background: none; + margin-top: 10px; + } + + .form-signin .input-group { + border: solid 1px #286090; + } + + .login-wrap { + margin: 30px 0 0 370px; + } +} diff --git a/Bootstrap.Admin/Content/login.css b/Bootstrap.Admin/Content/login.css index 942ff15d..5ad23fa6 100644 --- a/Bootstrap.Admin/Content/login.css +++ b/Bootstrap.Admin/Content/login.css @@ -1,70 +1,67 @@ -body { - color: #797979; - background: #f1f2f7; - font-family: 'Open Sans', sans-serif; - font-size: 13px; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-font-smoothing: antialiased; -} - -/*Login*/ -.form-signin { +.form-signin { margin: 0 auto; background: #fff; border-radius: 5px; - -webkit-border-radius: 5px; border: solid 1px #ddd; } - .form-signin h2.form-signin-heading { + .form-signin .form-signin-heading { margin: 0; - padding: 20px 15px; + padding: 15px; text-align: center; background: #41cac0; border-radius: 5px 5px 0 0; - -webkit-border-radius: 5px 5px 0 0; color: #fff; - font-size: 18px; + font-size: 34px; text-transform: uppercase; font-weight: 300; - font-family: 'Open Sans', sans-serif; } - .form-signin div.login-wrap { + .form-signin .login-wrap { padding: 20px; } - .form-signin div.login-wrap .login-footer { + .form-signin .login-wrap .login-footer { padding-bottom: 15px; } - .form-signin div.login-wrap .login-footer .login-create { + .form-signin .login-wrap .login-footer .login-create { float: left; } - .form-signin div.login-wrap .login-footer .login-reset { + .form-signin .login-wrap .login-footer .login-reset { float: right; } - .form-signin div.input-group { + .form-signin .input-group { margin-bottom: 15px; border-radius: 5px; - -webkit-border-radius: 5px; - border: 1px solid #eaeaea; + border: 1px solid #089dc9; box-shadow: none; font-size: 12px; } - .form-signin div.input-group > span { + .form-signin .input-group > span { top: 0; background-color: #5bc0de; } - .form-signin div.input-group > span, div.input-group > input { - border-color: #5bc0de; + .form-signin .form-control, .form-signin .input-group span { + border: none; } + .form-signin .has-success .input-group { + border: solid 1px #3c763d; + } + + .form-signin .has-error .input-group { + border: solid 1px #a94442; + } + + .form-signin .form-control, .form-signin .form-control:focus { + box-shadow: none; + } + .form-signin .btn-login { background: #f67a6e; color: #fff; @@ -86,12 +83,5 @@ .form-signin .checkbox > label { padding-left: 4px; + color: #333; } - -/*end login*/ - -@media (min-width: 375px) { - .form-signin { - width: 320px; - } -} diff --git a/Bootstrap.Admin/Controllers/HomeController.cs b/Bootstrap.Admin/Controllers/HomeController.cs index f6b5930d..0d0b599c 100644 --- a/Bootstrap.Admin/Controllers/HomeController.cs +++ b/Bootstrap.Admin/Controllers/HomeController.cs @@ -45,27 +45,15 @@ namespace Bootstrap.Admin.Controllers /// /// [AllowAnonymous] - public ActionResult Login(string userName, string password, string remember) - { - var model = new LoginModel(); - if (string.IsNullOrEmpty(userName)) return View(model); - model.UserName = userName; - if (LgbPrincipal.Authenticate(userName, password) || BootstrapUser.Authenticate(userName, password)) - { - FormsAuthentication.RedirectFromLoginPage(userName, remember == "true"); - return new EmptyResult(); - } - return View(model); - } - /// - /// - /// - /// - [AllowAnonymous] - public ActionResult Logout() + public ActionResult Login(LoginModel login) { FormsAuthentication.SignOut(); - return Redirect(FormsAuthentication.LoginUrl); + if (!string.IsNullOrEmpty(login.UserName) && (LgbPrincipal.Authenticate(login.UserName, login.Password) || BootstrapUser.Authenticate(login.UserName, login.Password))) + { + FormsAuthentication.RedirectFromLoginPage(login.UserName, login.Remember == "true"); + return new EmptyResult(); + } + return View(login); } /// /// diff --git a/Bootstrap.Admin/Models/LoginModel.cs b/Bootstrap.Admin/Models/LoginModel.cs index 9dbc21fe..326ead0d 100644 --- a/Bootstrap.Admin/Models/LoginModel.cs +++ b/Bootstrap.Admin/Models/LoginModel.cs @@ -3,7 +3,7 @@ /// /// /// - public class LoginModel + public class LoginModel : ModelBase { /// /// @@ -20,5 +20,9 @@ /// /// public string Password { get; set; } + /// + /// + /// + public string Remember { get; set; } } } \ No newline at end of file diff --git a/Bootstrap.Admin/Views/Home/Login.cshtml b/Bootstrap.Admin/Views/Home/Login.cshtml index a5a91b24..4f90d830 100644 --- a/Bootstrap.Admin/Views/Home/Login.cshtml +++ b/Bootstrap.Admin/Views/Home/Login.cshtml @@ -1,10 +1,11 @@ @model LoginModel @{ - ViewBag.Title = "系统登陆"; + ViewBag.Title = Model.Title; Layout = "~/Views/Shared/_Layout.cshtml"; } @section css { + } @section javascript { @@ -13,7 +14,7 @@ }