Skip to content

Commit

Permalink
Merge pull request #670 from dataswift/fix/claim-api-email-supression
Browse files Browse the repository at this point in the history
Exposed Authentication.handleVerificationRequest's  sendEmailToUser i…
  • Loading branch information
mudspot authored Sep 29, 2023
2 parents e02b07e + 806e323 commit 351d874
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions hat/app/org/hatdex/hat/api/controllers/Authentication.scala
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,10 @@ class Authentication @Inject() (
*/
def handleVerificationRequest(
lang: Option[String],
send_email_to_user: Boolean = true): Action[ApiVerificationRequest] =
sendEmailToUser: Option[Boolean]): Action[ApiVerificationRequest] =
UserAwareAction.async(parsers.json[ApiVerificationRequest]) { implicit request =>
implicit val language: Lang = Lang.get(lang.getOrElse("en")).getOrElse(Lang.defaultLang)
implicit val sendEmail: Boolean = sendEmailToUser.getOrElse(true)

val claimHatRequest = request.body
val email = request.dynamicEnvironment.ownerEmail
Expand Down Expand Up @@ -445,7 +446,7 @@ class Authentication @Inject() (
val emailVerificationOptions =
EmailVerificationOptions(email, language, app.application.id, maybeSetupUrl.getOrElse(""))
val verificationLink = emailVerificationLink(request.host, token.id, emailVerificationOptions)
if (send_email_to_user) {
if (sendEmail) {
mailer.verifyEmail(email,
app.application.info.name,
app.application.info.graphics.logo.normal,
Expand Down
4 changes: 2 additions & 2 deletions hat/conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ GET /control/v2/auth/hatlogin org.hatdex.hat.
POST /control/v2/auth/password org.hatdex.hat.api.controllers.Authentication.passwordChangeProcess
POST /control/v2/auth/passwordReset org.hatdex.hat.api.controllers.Authentication.handleForgotPassword
POST /control/v2/auth/passwordreset/confirm/:token org.hatdex.hat.api.controllers.Authentication.handleResetPassword(token: String)
POST /control/v2/auth/claim org.hatdex.hat.api.controllers.Authentication.handleVerificationRequest(lang: Option[String])
POST /control/v2/auth/request-verification org.hatdex.hat.api.controllers.Authentication.handleVerificationRequest(lang: Option[String])
POST /control/v2/auth/claim org.hatdex.hat.api.controllers.Authentication.handleVerificationRequest(lang: Option[String], sendEmailToUser: Option[Boolean])
POST /control/v2/auth/request-verification org.hatdex.hat.api.controllers.Authentication.handleVerificationRequest(lang: Option[String], sendEmailToUser: Option[Boolean])
POST /control/v2/auth/claim/complete/:verificationToken org.hatdex.hat.api.controllers.Authentication.handleVerification(verificationToken: String)

# Metrics
Expand Down

0 comments on commit 351d874

Please sign in to comment.