providing password reset services for a long while: circa 2025

feat: add next stage of password

+86 -1
+11 -1
features/command.ts
··· 1 1 import { slackApp } from "../index"; 2 2 3 3 const command = async () => { 4 - slackApp.command("/hackatime", async ({ context, payload }) => { 4 + slackApp.command("/hackatime", async ({ context }) => { 5 5 context.respond({ 6 6 response_type: "ephemeral", 7 7 text: "Hi there! I'm the Hackatime bot :hyper-dino-wave:", ··· 31 31 }, 32 32 value: "yes", 33 33 style: "primary", 34 + action_id: "create-account", 34 35 }, 35 36 { 36 37 type: "button", ··· 39 40 text: "No, thanks", 40 41 }, 41 42 value: "no", 43 + action_id: "no-thanks", 42 44 }, 43 45 ], 44 46 }, 45 47 ], 46 48 }); 49 + }); 50 + 51 + slackApp.action("no-thanks", async ({ context }) => { 52 + if (context?.respond) 53 + await context.respond({ 54 + response_type: "ephemeral", 55 + text: "No worries! If you change your mind just type `/hackatime` again ^-^", 56 + }); 47 57 }); 48 58 }; 49 59
+1
features/index.ts
··· 1 1 export { default as command } from "./command"; 2 + export { default as signup } from "./signup";
+74
features/signup.ts
··· 1 + import { slackApp } from "../index"; 2 + 3 + const signup = async () => { 4 + slackApp.action("create-account", async ({ context }) => { 5 + if (context?.respond) 6 + await context.respond({ 7 + response_type: "ephemeral", 8 + text: "sweet! i'll need a password from you then!", 9 + blocks: [ 10 + { 11 + type: "section", 12 + text: { 13 + type: "mrkdwn", 14 + text: "sweet! i'll need a password from you then!", 15 + }, 16 + }, 17 + { 18 + type: "input", 19 + dispatch_action: true, 20 + block_id: "password", 21 + element: { 22 + type: "plain_text_input", 23 + action_id: "set-password", 24 + focus_on_load: true, 25 + min_length: 6, 26 + placeholder: { 27 + type: "plain_text", 28 + text: "hackatime4ever!", 29 + }, 30 + }, 31 + label: { 32 + type: "plain_text", 33 + text: "Password:", 34 + }, 35 + }, 36 + { 37 + type: "context", 38 + elements: [ 39 + { 40 + type: "mrkdwn", 41 + text: "`Password must be at least 6 characters long.`", 42 + }, 43 + ], 44 + }, 45 + { 46 + type: "actions", 47 + elements: [ 48 + { 49 + type: "button", 50 + text: { 51 + type: "plain_text", 52 + text: "perfect, next!", 53 + }, 54 + value: "next", 55 + style: "primary", 56 + action_id: "set-password", 57 + }, 58 + { 59 + type: "button", 60 + text: { 61 + type: "plain_text", 62 + text: "i changed my mind", 63 + }, 64 + value: "no", 65 + action_id: "no-thanks", 66 + }, 67 + ], 68 + }, 69 + ], 70 + }); 71 + }); 72 + }; 73 + 74 + export default signup;