diff --git a/TODO.text b/TODO.text index d4eea01..43906d9 100644 --- a/TODO.text +++ b/TODO.text @@ -1,5 +1,3 @@ - MFA recovery codes handling -- Forgot password handling - - Admin password reset mechanism -> flag users as needing PW resets - OAuth2 -> support refresh tokens - Traps -> not clearing trust? diff --git a/Units.flitter.js b/Units.flitter.js index 5633aae..c9337f7 100644 --- a/Units.flitter.js +++ b/Units.flitter.js @@ -31,9 +31,12 @@ const FlitterUnits = { * Custom units that modify or add functionality that needs to be made * available to the middleware-routing-controller stack. */ + 'Redis' : require('flitter-redis/src/RedisUnit'), + 'Jobs' : require('flitter-jobs/src/JobsUnit'), 'Settings' : require('./app/unit/SettingsUnit'), 'Upload' : require('flitter-upload/UploadUnit'), 'Less' : require('flitter-less/LessUnit'), + 'SMTP' : require('./app/unit/SMTPUnit'), 'LDAPServer' : require('./app/unit/LDAPServerUnit'), 'LDAPMiddleware': require('./app/unit/LDAPMiddlewareUnit'), 'LDAPController': require('./app/unit/LDAPControllerUnit'), diff --git a/app/assets/app/auth/login/Form.component.js b/app/assets/app/auth/login/Form.component.js index 19db82f..f6f5c2e 100644 --- a/app/assets/app/auth/login/Form.component.js +++ b/app/assets/app/auth/login/Form.component.js @@ -1,6 +1,8 @@ import { Component } from '../../../lib/vues6/vues6.js' import { auth_api } from '../../service/AuthApi.service.js' import { location_service } from '../../service/Location.service.js' +import { message_service } from '../../service/Message.service.js' +import { password_service } from '../../service/Password.service.js' const template = `
@@ -41,6 +43,10 @@ const template = ` class="mr-3" v-if="!step_two && !loading && registration_enabled" >Need an account? + Forgot password?
@@ -147,5 +153,38 @@ export default class AuthLoginForm extends Component { location_service.redirect('/auth/register', 1500) // TODO get this dynamically } + async on_forgot_password() { + console.log(message_service) + await message_service.modal({ + title: 'Reset Password', + message: 'If you have forgotten your password, you can request a reset e-mail to be sent to your account. Enter your e-mail address:', + inputs: [ + { + type: 'email', + name: 'email', + placeholder: 'jdoe@contoso.com', + }, + ], + buttons: [ + { + type: 'close', + text: 'Cancel', + }, + { + type: 'close', + class: ['btn', 'btn-primary'], + text: 'Request', + on_click: async ($event, { email }) => { + await password_service.request_reset(email) + await message_service.alert({ + type: 'success', + message: 'Success! If that e-mail address is associated with a valid ' + this.app_name + ' account, it will receive an e-mail with more instructions shortly.', + }) + }, + }, + ], + }) + } + do_nothing() {} } diff --git a/app/assets/app/components.js b/app/assets/app/components.js index b19d3de..93f3d5a 100644 --- a/app/assets/app/components.js +++ b/app/assets/app/components.js @@ -6,6 +6,7 @@ import MFADisableComponent from './auth/MFADisable.component.js' import PasswordResetComponent from './auth/PasswordReset.component.js' import InvokeActionComponent from './InvokeAction.component.js' import RegistrationFormComponent from './auth/register/Form.component.js' +import MessageContainerComponent from './dash/message/MessageContainer.component.js' const components = { AuthLoginForm, @@ -16,6 +17,7 @@ const components = { PasswordResetComponent, InvokeActionComponent, RegistrationFormComponent, + MessageContainerComponent, } export { components } diff --git a/app/assets/app/dash/message/MessageContainer.component.js b/app/assets/app/dash/message/MessageContainer.component.js index 78c548c..a8bb85f 100644 --- a/app/assets/app/dash/message/MessageContainer.component.js +++ b/app/assets/app/dash/message/MessageContainer.component.js @@ -36,6 +36,16 @@ const template = `