<commit_before>MeshbluDB = require 'meshblu-db'
ForgotPasswordModel = require '../models/forgot-password-model'
debug = require('debug')('meshblu-email-password-authenticator:forgot-controller')

class ForgotPasswordController
  constructor: (meshbluJSON, @meshblu) ->
    @authenticatorUuid = meshbluJSON.uuid
    @authenticatorName = meshbluJSON.name
    @meshbludb = new MeshbluDB @meshblu
    @forgotPasswordModel = new ForgotPasswordModel(@authenticatorUuid, 'key-1363df07931b61ec9eeabda8702a8998', { db: @meshbludb, meshblu: @meshblu})


  forgot: (request, response) =>
    @forgotPasswordModel.forgot( request.body.email, (error, data)=>
      return response.status(404).send(error.message) if error && error.message == 'Device not found for email address'
      return response.status(500).send(error.message) if error
      return response.send(201)
    )



module.exports = ForgotPasswordController<commit_msg>move mailgun api key to ENV<commit_after>MeshbluDB = require 'meshblu-db'
ForgotPasswordModel = require '../models/forgot-password-model'
debug = require('debug')('meshblu-email-password-authenticator:forgot-controller')

class ForgotPasswordController
  constructor: (meshbluJSON, @meshblu) ->
    @authenticatorUuid = meshbluJSON.uuid
    @authenticatorName = meshbluJSON.name
    @meshbludb = new MeshbluDB @meshblu
    @forgotPasswordModel = new ForgotPasswordModel(@authenticatorUuid, process.env.MAILGUN_API_KEY, { db: @meshbludb, meshblu: @meshblu})


  forgot: (request, response) =>
    @forgotPasswordModel.forgot( request.body.email, (error, data)=>
      return response.status(404).send(error.message) if error && error.message == 'Device not found for email address'
      return response.status(500).send(error.message) if error
      return response.send(201)
    )



module.exports = ForgotPasswordController
{'fraction_non_alphanumeric': 0.11519740400216333, 'fraction_numerical': 0.02055164954029205, 'mean_word_length': 5.146179401993355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5993901', 'n_tokens_mistral': 619, 'n_tokens_neox': 581, 'n_words': 114}