I've successfully build simple registration system using ASP.NET Identity 2.2.1.
I only needed API so I've build simple controller that allows creating account using route account/create
, when account is created user receives SMS message with token needed to confirm his phone, same time I'm generating link that is needed to verify email address and I'm sending it to user email address.
Then user need to input token from SMS (do request to account/confirm_phone
) and click link in email he receives.
These two actions are needed to activate account, this part works fine.
I have requirement to change email link to email token, similar to one used to confirm phone number, so instead of clicking link user will have to input that token (request to account/confirm_email
)
Method GenerateEmailConfirmationTokenAsync
returns very long code that becomes part of link send in email, I'd like it to return 6 digit token.
I can't reuse GeneratePhoneConfirmationTokenAsync
because this will generate same token as send via SMS.
I've searched over the internet and I wasn't able to find any information how to customize token generated by GenerateEmailConfirmationTokenAsync
method.
Is it possible to configure that token generator so it will return 6 (or any configurable length) digit code that I can use to confirm user email address.
I'm aware that link send to user is better option, but as I wrote this is requirement I got and I can't change that.