Skip to content

Commit 427e3db

Browse files
committed
Small improvements
* Allow the use of enter-key in log-in and sign-up views * Give a finnish error message if log-in fails * Don't stretch missing-info view to fit whole page
1 parent 3dacff8 commit 427e3db

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/components/user/CreateAccountForm.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ const FormContainer = styled.div`
2626

2727
class CreateAccountForm extends React.Component {
2828
onClick = async e => {
29+
e.preventDefault()
2930
this.setState({ submitting: true, triedSubmitting: true })
3031
if (!this.validate()) {
3132
this.setState({ canSubmit: false, submitting: false })
3233
return
3334
}
3435
try {
35-
e.preventDefault()
3636
const res = await createAccount({
3737
email: this.state.email,
3838
password: this.state.password,
@@ -224,6 +224,7 @@ class CreateAccountForm extends React.Component {
224224
variant="contained"
225225
color="primary"
226226
fullWidth
227+
type="submit"
227228
>
228229
Luo käyttäjätunnus
229230
</Button>

src/pages/missing-info.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { navigate } from "gatsby"
66
import LoginStateContext, {
77
withLoginStateContext,
88
} from "../contexes/LoginStateContext"
9+
import Container from "../components/Container"
910

1011
class MissingInfo extends React.Component {
1112
static contextType = LoginStateContext
@@ -27,7 +28,9 @@ class MissingInfo extends React.Component {
2728
}
2829
return (
2930
<Layout>
30-
<CourseOptionsEditor onComplete={this.onStepComplete} />
31+
<Container>
32+
<CourseOptionsEditor onComplete={this.onStepComplete} />
33+
</Container>
3134
</Layout>
3235
)
3336
}

src/pages/sign-in.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,15 @@ class SignInPage extends React.Component {
124124
variant="contained"
125125
color="primary"
126126
fullWidth
127+
type="submit"
127128
>
128129
Kirjaudu sisään
129130
</Button>
130131
</Row>
131132
</Form>
132133
{this.state.error && (
133134
<InfoBox>
134-
<b>Invalid credentials</b>
135+
<b>Virheelliset tunnukset, tarkista kirjoitusasu!</b>
135136
</InfoBox>
136137
)}
137138
<Row>

0 commit comments

Comments
 (0)