providing password reset services for a long while: circa 2025

feat: add next stage of password

Changed files
+86 -1
features
+11 -1
features/command.ts
···
import { slackApp } from "../index";
const command = async () => {
-
slackApp.command("/hackatime", async ({ context, payload }) => {
+
slackApp.command("/hackatime", async ({ context }) => {
context.respond({
response_type: "ephemeral",
text: "Hi there! I'm the Hackatime bot :hyper-dino-wave:",
···
},
value: "yes",
style: "primary",
+
action_id: "create-account",
},
{
type: "button",
···
text: "No, thanks",
},
value: "no",
+
action_id: "no-thanks",
},
],
},
],
});
+
});
+
+
slackApp.action("no-thanks", async ({ context }) => {
+
if (context?.respond)
+
await context.respond({
+
response_type: "ephemeral",
+
text: "No worries! If you change your mind just type `/hackatime` again ^-^",
+
});
});
};
+1
features/index.ts
···
export { default as command } from "./command";
+
export { default as signup } from "./signup";
+74
features/signup.ts
···
+
import { slackApp } from "../index";
+
+
const signup = async () => {
+
slackApp.action("create-account", async ({ context }) => {
+
if (context?.respond)
+
await context.respond({
+
response_type: "ephemeral",
+
text: "sweet! i'll need a password from you then!",
+
blocks: [
+
{
+
type: "section",
+
text: {
+
type: "mrkdwn",
+
text: "sweet! i'll need a password from you then!",
+
},
+
},
+
{
+
type: "input",
+
dispatch_action: true,
+
block_id: "password",
+
element: {
+
type: "plain_text_input",
+
action_id: "set-password",
+
focus_on_load: true,
+
min_length: 6,
+
placeholder: {
+
type: "plain_text",
+
text: "hackatime4ever!",
+
},
+
},
+
label: {
+
type: "plain_text",
+
text: "Password:",
+
},
+
},
+
{
+
type: "context",
+
elements: [
+
{
+
type: "mrkdwn",
+
text: "`Password must be at least 6 characters long.`",
+
},
+
],
+
},
+
{
+
type: "actions",
+
elements: [
+
{
+
type: "button",
+
text: {
+
type: "plain_text",
+
text: "perfect, next!",
+
},
+
value: "next",
+
style: "primary",
+
action_id: "set-password",
+
},
+
{
+
type: "button",
+
text: {
+
type: "plain_text",
+
text: "i changed my mind",
+
},
+
value: "no",
+
action_id: "no-thanks",
+
},
+
],
+
},
+
],
+
});
+
});
+
};
+
+
export default signup;