Exemple #1
0
        protected BaseUserController(ULearnDb db)
        {
            this.db      = db;
            userManager  = new ULearnUserManager(db);
            usersRepo    = new UsersRepo(db);
            metricSender = new GraphiteMetricSender("web");

            secretForHashes = WebConfigurationManager.AppSettings["ulearn.secretForHashes"] ?? "";

            var spamEndpoint = WebConfigurationManager.AppSettings["ulearn.spam.endpoint"] ?? "";
            var spamLogin    = WebConfigurationManager.AppSettings["ulearn.spam.login"] ?? "ulearn";
            var spamPassword = WebConfigurationManager.AppSettings["ulearn.spam.password"] ?? "";

            spamChannelId  = WebConfigurationManager.AppSettings["ulearn.spam.channels.emailConfirmations"] ?? "";
            spamTemplateId = WebConfigurationManager.AppSettings["ulearn.spam.templates.withButton"] ?? "";

            try
            {
                spamClient = new SpamClient(new Uri(spamEndpoint), spamLogin, spamPassword);
            }
            catch (Exception e)
            {
                log.Error($"Can\'t initialize Spam.API client to {spamEndpoint}, login {spamLogin}, password {spamPassword.MaskAsSecret()}", e);
                throw;
            }
        }
        public RestorePasswordController(ULearnDb db)
        {
            this.db      = db;
            userManager  = new ULearnUserManager(db);
            requestRepo  = new RestoreRequestRepo(db);
            metricSender = new GraphiteMetricSender("web");

            var spamEndpoint = WebConfigurationManager.AppSettings["ulearn.spam.endpoint"] ?? "";
            var spamLogin    = WebConfigurationManager.AppSettings["ulearn.spam.login"] ?? "ulearn";
            var spamPassword = WebConfigurationManager.AppSettings["ulearn.spam.password"] ?? "";

            spamChannelId = WebConfigurationManager.AppSettings["ulearn.spam.channels.passwords"] ?? "";

            try
            {
                spamClient = new SpamClient(new Uri(spamEndpoint), spamLogin, spamPassword);
            }
            catch (Exception e)
            {
                log.Error($"Can\'t initialize Spam.API client to {spamEndpoint}, login {spamLogin}, password {spamPassword.MaskAsSecret()}", e);
                throw;
            }
        }