diff --git a/package-lock.json b/package-lock.json index aa696be5..847235a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@oryd/kratos-client": { - "version": "0.0.0-next.e568324ce78b", - "resolved": "https://registry.npmjs.org/@oryd/kratos-client/-/kratos-client-0.0.0-next.e568324ce78b.tgz", - "integrity": "sha512-Ws7T0TSg6/XzR0qvSbULE4kyzPUrkBRmtZ+BWy4C1T0aIIA+Yl6QScesKEdY6UQHLzdPBxY6wM3IULcyjXam0g==", + "version": "0.0.0-next.2609b90cf011", + "resolved": "https://registry.npmjs.org/@oryd/kratos-client/-/kratos-client-0.0.0-next.2609b90cf011.tgz", + "integrity": "sha512-d8P2CJ4CMc3onNRIybIn/nCTbPP2fnT8LzgL1vTmWg2ncew7VEJJpqncT0vgw2wmvWUNCO2v/ZpSw05RF4dpOQ==", "requires": { "@types/bluebird": "*", "@types/request": "*", diff --git a/package.json b/package.json index 08c0c258..ede696ab 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/ory/kratos-selfservice-ui-node#readme", "dependencies": { - "@oryd/kratos-client": "0.0.0-next.e568324ce78b", + "@oryd/kratos-client": "0.0.0-next.2609b90cf011", "@types/cookie-parser": "^1.4.2", "@types/express": "^4.17.2", "@types/express-handlebars": "0.0.33", diff --git a/src/routes/auth.ts b/src/routes/auth.ts index 04854524..5a9af4a9 100644 --- a/src/routes/auth.ts +++ b/src/routes/auth.ts @@ -72,7 +72,11 @@ export const authHandler = (type: 'login' | 'registration') => ( } } - res.render(type, {oidc:methodConfig("oidc"), password:methodConfig("password")}) + res.render(type, { + ...request, + oidc:methodConfig("oidc"), + password:methodConfig("password"), + }) }) .catch(err => { console.error(err) diff --git a/src/routes/settings.ts b/src/routes/settings.ts index 2a97a75c..56b03ba4 100644 --- a/src/routes/settings.ts +++ b/src/routes/settings.ts @@ -33,6 +33,7 @@ const settingsHandler = (req: Request, res: Response, next: NextFunction) => { if (request) { res.render('settings', { + ...request, password: methodConfig("password"), profile: methodConfig("profile"), oidc: methodConfig("oidc"), diff --git a/src/routes/verification.ts b/src/routes/verification.ts index 7dd9ee92..ef6e35b5 100644 --- a/src/routes/verification.ts +++ b/src/routes/verification.ts @@ -31,7 +31,9 @@ export default (req: Request, res: Response, next: NextFunction) => { return body } ).then((request: any) => { - res.render('verification', request.form) + res.render('verification', { + ...request + }) } ).catch((err: any) => next(err)) } diff --git a/views/login.hbs b/views/login.hbs index f3e56440..df631a26 100644 --- a/views/login.hbs +++ b/views/login.hbs @@ -3,6 +3,8 @@ {{> icon_logo}}
Welcome to this example login screen!
+ {{> messages messages=messages className="global"}} + {{#if password}}
{{> form submitLabel="Sign in" form=password}} diff --git a/views/partials/form.hbs b/views/partials/form.hbs index 73fc1a85..5ad545d2 100644 --- a/views/partials/form.hbs +++ b/views/partials/form.hbs @@ -1,5 +1,5 @@ -{{> form_errors className="overview-form-errors" errors=form.errors}}
+ {{> messages messages=form.messages }} {{> form_fields fields=form.fields }} {{#if submitLabel}} diff --git a/views/partials/form_errors.hbs b/views/partials/form_errors.hbs deleted file mode 100644 index e3188d8c..00000000 --- a/views/partials/form_errors.hbs +++ /dev/null @@ -1,5 +0,0 @@ -
- {{~#each errors~}} -
{{message}}
- {{~/each~}} -
diff --git a/views/partials/form_input_default.hbs b/views/partials/form_input_default.hbs index 75547947..8c3d5473 100644 --- a/views/partials/form_input_default.hbs +++ b/views/partials/form_input_default.hbs @@ -3,5 +3,5 @@ {{getTitle name}} - {{> form_errors className="input-form-errors"}} + {{> messages }} \ No newline at end of file diff --git a/views/partials/form_input_password.hbs b/views/partials/form_input_password.hbs index bea37d0d..db37ac32 100644 --- a/views/partials/form_input_password.hbs +++ b/views/partials/form_input_password.hbs @@ -4,5 +4,5 @@ {{getTitle name}} {{> form_input_password_toggle }} - {{> form_errors className="input-form-errors"}} + {{> messages }} diff --git a/views/partials/form_messages.hbs b/views/partials/form_messages.hbs deleted file mode 100644 index 1205edd3..00000000 --- a/views/partials/form_messages.hbs +++ /dev/null @@ -1,5 +0,0 @@ -
- {{~#each messages~}} -
{{text}}
- {{~/each~}} -
diff --git a/views/partials/messages.hbs b/views/partials/messages.hbs new file mode 100644 index 00000000..24a1e733 --- /dev/null +++ b/views/partials/messages.hbs @@ -0,0 +1,5 @@ +
+ {{~#each messages~}} +
{{text}}
+ {{~/each~}} +
diff --git a/views/recovery.hbs b/views/recovery.hbs index eb7df045..20ba1d01 100644 --- a/views/recovery.hbs +++ b/views/recovery.hbs @@ -3,7 +3,7 @@

Recover your account

- {{> form_messages messages=messages className="global"}} + {{> messages messages=messages className="global"}} {{#if token}}
diff --git a/views/registration.hbs b/views/registration.hbs index 27674851..a38f24a1 100644 --- a/views/registration.hbs +++ b/views/registration.hbs @@ -4,6 +4,8 @@
Welcome to SecureApp!
Use the form below to sign up:
+ {{> messages messages=messages className="global"}} + {{#if password}}
{{> form submitLabel="Sign up" form=password}} diff --git a/views/settings.hbs b/views/settings.hbs index 8aa95a4d..fa4bb42a 100644 --- a/views/settings.hbs +++ b/views/settings.hbs @@ -3,6 +3,8 @@

Settings

+ {{> messages messages=messages className="global"}} + {{#if updateSuccessful}}

Your changes have been saved!

{{/if}} diff --git a/views/verification.hbs b/views/verification.hbs index 17f05d85..35a25226 100644 --- a/views/verification.hbs +++ b/views/verification.hbs @@ -3,10 +3,10 @@

Resend verification code

- {{> form_errors errors=errors className="overview-form-errors"}} + {{> messages messages=messages className="global"}} - - {{#each fields}} + + {{#each form.fields}} {{> (toFormInputPartialName type)}} {{/each}}