Skip to content

Commit 891810b

Browse files
author
perploug
committed
Adds newsletter to installer
With the good ol' V6 installer code, ahhh the smell of code patina
1 parent 77d910b commit 891810b

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

src/Umbraco.Web.UI.Client/src/installer/steps/user.controller.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
angular.module("umbraco.install").controller("Umbraco.Install.UserController", function($scope, installerService) {
22

33
$scope.passwordPattern = /.*/;
4+
$scope.installer.current.model.subscribeToNewsLetter = true;
5+
46
if ($scope.installer.current.model.minNonAlphaNumericLength > 0) {
57
var exp = "";
68
for (var i = 0; i < $scope.installer.current.model.minNonAlphaNumericLength; i++) {

src/Umbraco.Web.UI.Client/src/installer/steps/user.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,22 @@ <h1>Install Umbraco 7</h1>
3333
required
3434
ng-model="installer.current.model.password" />
3535
<small class="inline-help">At least {{installer.current.model.minCharLength}} characters long</small>
36+
3637
<small ng-if="installer.current.model.minNonAlphaNumericLength > 0" class="inline-help">
3738
At least {{installer.current.model.minNonAlphaNumericLength}} symbol{{installer.current.model.minNonAlphaNumericLength > 1 ? 's' : ''}}
3839
</small>
3940
</div>
4041
</div>
4142

43+
44+
<div class="control-group">
45+
<div class="controls">
46+
<label class="checkbox" for="subscribeToNewsLetter">
47+
<input type="checkbox" name="subscribeToNewsLetter"
48+
ng-model="installer.current.model.subscribeToNewsLetter" /> Subscribe to our newsletter</label>
49+
</div>
50+
</div>
51+
4252
<div class="control-group" ng-class="{disabled:myForm.$invalid}">
4353
<div class="controls">
4454

src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Collections.Specialized;
34
using System.Configuration;
45
using System.Web.Security;
56
using Umbraco.Core;
@@ -69,7 +70,19 @@ public override InstallSetupResult Execute(UserModel user)
6970
admin.Username = user.Email.Trim();
7071

7172
_applicationContext.Services.UserService.Save(admin);
72-
73+
74+
75+
if (user.SubscribeToNewsLetter)
76+
{
77+
try
78+
{
79+
var client = new System.Net.WebClient();
80+
var values = new NameValueCollection { { "name", admin.Name }, { "email", admin.Email} };
81+
client.UploadValues("http://umbraco.org/base/Ecom/SubmitEmail/installer.aspx", values);
82+
}
83+
catch { /* fail in silence */ }
84+
}
85+
7386
return null;
7487
}
7588

src/Umbraco.Web/Install/Models/UserModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ public class UserModel
1313

1414
[DataMember(Name = "password")]
1515
public string Password { get; set; }
16+
17+
[DataMember(Name = "subscribeToNewsLetter")]
18+
public bool SubscribeToNewsLetter { get; set; }
1619
}
1720
}

0 commit comments

Comments
 (0)