| 1 | # frozen_string_literal: true |
| 2 | |
| 3 | module Api |
| 4 | module V1 |
| 5 | # Resend the email-confirmation link for an unconfirmed account. |
| 6 | class ConfirmationsController < Api::BaseController |
| 7 | # POST /api/v1/auth/confirmation/resend |
| 8 | # Params: email |
| 9 | # |
| 10 | # The underlying endpoint always responds the same way regardless of |
| 11 | # whether the account exists or is already confirmed (no enumeration), so |
| 12 | # this returns 204 on success. |
| 13 | def create |
| 14 | email = params[:email].to_s.strip.downcase |
| 15 | if email.blank? |
| 16 | return render_error(ERR_INVALID, "Email is required.", status: :unprocessable_entity) |
| 17 | end |
| 18 | |
| 19 | SmbcloudAuthService.resend_confirmation(email: email) |
| 20 | head :no_content |
| 21 | end |
| 22 | end |
| 23 | end |
| 24 | end |