Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit a8b3581

Browse files
committed
update layout login form
1 parent 88fb2d3 commit a8b3581

File tree

6 files changed

+44
-20
lines changed

6 files changed

+44
-20
lines changed

Clients/SampleSolution.Web/.stats/cabinetes2020_stat.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Clients/SampleSolution.Web/.stats/cabinetes5_stat.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Clients/SampleSolution.Web/.stats/logines2020_stat.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Clients/SampleSolution.Web/.stats/logines5_stat.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

Clients/SampleSolution.Web/wwwrootsrc/login/scripts/pages/signin-page/SignInPageController.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { PageController } from "../../../../core/scripts/components/_base/PageController";
22
import { signInPageView } from "./SignInPageView";
33
import { BaseController } from "../../../../core/scripts/components/_base/BaseController";
4-
import { alertify } from "@labeg/alertify.js";
54
import style from "./SignInPageStyles.scss";
65
import { autowired } from "first-di";
76
import { AccountService } from "../../../../core/scripts/services/AccountService";
@@ -31,6 +30,8 @@ export class SignInPageController<P, S> extends BaseController<P, S> {
3130

3231
public isProgress: boolean = false;
3332

33+
public errorMessage: string | null = null;
34+
3435
public login: string = "";
3536

3637
public password: string = "";
@@ -67,6 +68,7 @@ export class SignInPageController<P, S> extends BaseController<P, S> {
6768
public async makeLogin(): Promise<void> {
6869
try {
6970
this.isProgress = true;
71+
this.errorMessage = null;
7072
this.redraw();
7173

7274
const login = new LoginDto();
@@ -76,11 +78,7 @@ export class SignInPageController<P, S> extends BaseController<P, S> {
7678

7779
await this.accountService.login(login);
7880
} catch (err: unknown) {
79-
if (err instanceof Error && err.message === "400 - Bad Request") {
80-
alertify.error("An error occurred while trying to login: wrong login or password.");
81-
} else {
82-
alertify.error(`An error occurred while trying to login: ${String(err)}`);
83-
}
81+
this.errorMessage = (err as Error).message;
8482
} finally {
8583
this.isProgress = false;
8684
this.redraw();
@@ -89,22 +87,26 @@ export class SignInPageController<P, S> extends BaseController<P, S> {
8987

9088
public onEnterKeyPress(event: KeyboardEventInit): void {
9189
if (event.key === "Enter") {
90+
this.errorMessage = null;
9291
this.makeLogin();
9392
}
9493
}
9594

9695
public setLogin(value: string): void {
9796
this.login = value;
97+
this.errorMessage = null;
9898
this.redraw();
9999
}
100100

101101
public setPassword(value: string): void {
102102
this.password = value;
103+
this.errorMessage = null;
103104
this.redraw();
104105
}
105106

106107
public setRememberMe(value: boolean): void {
107108
this.rememberMe = value;
109+
this.errorMessage = null;
108110
this.redraw();
109111
}
110112

Clients/SampleSolution.Web/wwwrootsrc/login/scripts/pages/signin-page/SignInPageView.tsx

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,50 @@
11
import React from "react";
22
import { SignInPageController } from "./SignInPageController";
3-
import AccountCircle from "@material-ui/icons/AccountCircle";
43
import TextField from "@material-ui/core/TextField";
54
import Button from "@material-ui/core/Button";
65
import CircularProgress from "@material-ui/core/CircularProgress";
76
import { Link as RouterLink } from "react-router-dom";
87
import Link from "@material-ui/core/Link";
98
import Checkbox from "@material-ui/core/Checkbox";
109
import FormControlLabel from "@material-ui/core/FormControlLabel";
10+
import Collapse from "@material-ui/core/Collapse";
11+
import Alert from "@material-ui/lab/Alert";
1112

1213
export const signInPageView = <P, S>(ctrl: SignInPageController<P, S>, _props?: P): JSX.Element => (
1314
<div className="SignInPageController">
1415
<form>
15-
<h2 className="text-center">
16-
Sign In
17-
</h2>
18-
<AccountCircle key={10} className="avatar" />
19-
<div className="grid input-block">
20-
<div className="col-6 text-left link-block">
16+
17+
<div className="grid-bottom">
18+
<div className="col-3_sm-6 text-left link-block">
2119
<Link to="/sign-up" component={RouterLink}>
2220
Sign Up
2321
</Link>
2422
</div>
25-
<div className="col-6 text-right link-block">
23+
<div className="col-6_sm-12 mobile-order">
24+
<h2 className="text-center block-title">
25+
Sign In
26+
</h2>
27+
</div>
28+
<div className="col-3_sm-6 text-right link-block">
2629
<Link to="/restore" component={RouterLink}>
2730
Restore
2831
</Link>
2932
</div>
30-
<div className="col-12">
33+
</div>
34+
35+
<br />
36+
<br />
37+
38+
<div className="grid">
39+
<div className="col-6_sm-12">
3140
<TextField key={20}
3241
fullWidth
3342
name="login"
3443
label="Login"
3544
onChange={(event: React.ChangeEvent<HTMLInputElement>) => ctrl.setLogin(event.target.value)}
3645
onKeyPress={(event: KeyboardEventInit) => ctrl.onEnterKeyPress(event)} />
3746
</div>
38-
<div className="col-12">
47+
<div className="col-6_sm-12">
3948
<TextField key={30}
4049
fullWidth
4150
name="password"
@@ -44,6 +53,19 @@ export const signInPageView = <P, S>(ctrl: SignInPageController<P, S>, _props?:
4453
onChange={(event: React.ChangeEvent<HTMLInputElement>) => ctrl.setPassword(event.target.value)}
4554
onKeyPress={(event: KeyboardEventInit) => ctrl.onEnterKeyPress(event)} />
4655
</div>
56+
<div className="col-12">
57+
<Collapse className="full-width" in={Boolean(ctrl.errorMessage)}>
58+
<Alert severity="error">
59+
{ctrl.errorMessage}
60+
</Alert>
61+
</Collapse>
62+
</div>
63+
</div>
64+
65+
<br />
66+
<br />
67+
68+
<div className="grid">
4769
<div className="col-12">
4870
<FormControlLabel label={
4971
<small>

0 commit comments

Comments
 (0)