Add job queue; e-mail sending; password reset support

This commit is contained in:
garrettmills
2020-05-25 15:45:26 -05:00
parent f371310620
commit 76ba843348
22 changed files with 884 additions and 30 deletions

View File

@@ -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 = `
<div class="coreid-login-form col-lg-6 col-md-8 col-sm-10 col-xs-12 offset-lg-3 offset-md-2 offset-sm-1 offset-xs-0 text-left">
@@ -41,6 +43,10 @@ const template = `
class="mr-3"
v-if="!step_two && !loading && registration_enabled"
><a href="#" class="text-secondary" @click="on_register_click">Need an account?</a></small>
<small
class="mr-3"
v-if="!loading"
><a href="#" class="text-secondary" @click="on_forgot_password">Forgot password?</a></small>
<button type="button" class="btn btn-primary" :disabled="loading" v-if="step_two" v-on:click="back_click">Back</button>
<button type="button" class="btn btn-primary" :disabled="loading || btn_disabled" v-on:click="step_click">{{ button_text }}</button>
</div>
@@ -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() {}
}