-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
252 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PREACT_APP_API_BASE_PATH=http://192.168.3.141/api/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PREACT_APP_API_BASE_PATH=/api/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
code/servowordclock-gui-develop/src/components/change-password/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { h, Component } from "preact"; | ||
import * as style from "./style.css"; | ||
import Button from "preact-material-components/Button"; | ||
import TextField from "preact-material-components/TextField"; | ||
import "preact-material-components/TextField/style.css"; | ||
import "preact-material-components/Button/style.css"; | ||
import "preact-material-components/Theme/style.css"; | ||
import { route } from "preact-router"; | ||
import Constants from "../../Constants"; | ||
import { SWCClient } from "../../domain/SWCClient"; | ||
|
||
class ChangePassword extends Component<Props, State> { | ||
onClickChangePassword(): void { | ||
if (this.state.password && this.state.password === this.state.confirm) { | ||
this.props.client | ||
.setPassword({ newlogin: this.state.password }) | ||
.then(() => { | ||
route(Constants.routes.Home); | ||
}); | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<div class={style.changePassword}> | ||
<h1>Change Password</h1> | ||
<div> | ||
<label htmlFor="password">Password</label> | ||
<TextField | ||
id="password" | ||
label="Password" | ||
helperText="Your password" | ||
class={style.full} | ||
value={this.state.password} | ||
onChange={e => | ||
this.setState({ | ||
password: (e.target as HTMLInputElement).value | ||
}) | ||
} | ||
/> | ||
</div> | ||
<div> | ||
<label htmlFor="confirm">Confirm password</label> | ||
<TextField | ||
id="confirm" | ||
label="Confirm password" | ||
helperText="Confirm your password" | ||
class={style.full} | ||
value={this.state.confirm} | ||
onChange={e => | ||
this.setState({ | ||
confirm: (e.target as HTMLInputElement).value | ||
}) | ||
} | ||
/> | ||
</div> | ||
{this.state.password && | ||
this.state.password !== this.state.confirm && ( | ||
<div class={style.error}> | ||
Passwords don't match | ||
</div> | ||
)} | ||
<div class={style.textRight}> | ||
<Button | ||
onClick={() => this.onClickChangePassword()} | ||
disabled={ | ||
!this.state.password || | ||
this.state.password !== this.state.confirm | ||
} | ||
> | ||
Change password | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
interface State { | ||
isLoading: boolean; | ||
password: string; | ||
confirm: string; | ||
loginFailed: boolean; | ||
} | ||
interface Props { | ||
client: SWCClient; | ||
} | ||
|
||
export default ChangePassword; |
17 changes: 17 additions & 0 deletions
17
code/servowordclock-gui-develop/src/components/change-password/style.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.changePassword { | ||
padding: 56px 20px; | ||
min-height: 100%; | ||
width: 100%; | ||
} | ||
|
||
.full { | ||
width: 100%; | ||
} | ||
|
||
.textRight { | ||
text-align: right; | ||
} | ||
|
||
.error { | ||
color: #ff3333; | ||
} |
5 changes: 5 additions & 0 deletions
5
code/servowordclock-gui-develop/src/components/change-password/style.css.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// This file is automatically generated from your CSS. Any edits will be overwritten. | ||
export const changePassword: string; | ||
export const full: string; | ||
export const textRight: string; | ||
export const error: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
code/servowordclock-gui-develop/src/components/header/style.css.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// This file is automatically generated from your CSS. Any edits will be overwritten. | ||
export const header: string; | ||
export const active: string; | ||
export const icon: string; | ||
export const drawer: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,4 @@ | |
|
||
.loginFailed { | ||
color: #ff3333; | ||
font-weight: bold; | ||
} |
Oops, something went wrong.