Update the signup to eliminate a weird error where you could not sign up with a single name (no last name) that already existed as a name..

Also removed the ErrorMessage.dll that had a single Hiccup.cs in it, recreated the Hiccup class elsewhere.
This commit is contained in:
Sebastiaan Janssen
2014-01-05 14:21:50 +01:00
parent b4db29ab97
commit 6db14b96d8
8 changed files with 99 additions and 26 deletions
+1 -4
View File
@@ -70,9 +70,6 @@
<Reference Include="Elmah">
<HintPath>..\dependencies\Our\Elmah.dll</HintPath>
</Reference>
<Reference Include="ErrorMessage">
<HintPath>..\dependencies\Our\ErrorMessage.dll</HintPath>
</Reference>
<Reference Include="Examine, Version=0.1.42.2941, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dependencies\4.9.1\Examine.dll</HintPath>
@@ -396,6 +393,7 @@
<Content Include="css\search\documentation.gif" />
<Content Include="css\select2-new.css" />
<Content Include="css\select2.css" />
<Content Include="Hiccup.aspx" />
<Content Include="ImageGen.ashx" />
<Content Include="css\forum\wmd-buttons.png" />
<Content Include="images\releases\download.png" />
@@ -972,7 +970,6 @@
<Content Include="css\wiki\pin.png" />
<Content Include="css\wiki\pin_current.png" />
<Content Include="default.aspx" />
<Content Include="Hiccup.aspx" />
<Content Include="HTMLPage.html" />
<Content Include="images\add-your-projects.png" />
<Content Include="images\arrow-viewall.png" />
@@ -1,6 +1,10 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Signup.ascx.cs" Inherits="our.usercontrols.Signup" %>
<asp:panel ID="MemberExists" Visible="False" runat="server">
<p>There is already an account with this e-mail address! You can <a href="/member/login">login</a> or <a href="/member/forgot-password">reset your password</a>.</p>
</asp:panel>
<asp:panel ID="Panel1" runat="server" defaultbutton="bt_submit">
<div class="form simpleForm" id="registrationForm">
<fieldset>
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace our
{
public class Hiccup : Page
{
protected Literal titleLiteral;
protected Literal header1;
protected Literal header3;
protected Literal notAffect;
protected void Page_Load(object sender, EventArgs e)
{
var host = Request.Url.Host.Replace("http://", "");
titleLiteral.Text = host;
header1.Text = host;
header3.Text = host;
notAffect.Text = host;
}
}
}
+6 -1
View File
@@ -112,6 +112,9 @@
<Compile Include="custom Handlers\projectVote.cs" />
<Compile Include="custom Handlers\Sanitizer.cs" />
<Compile Include="custom Handlers\TopicVote.cs" />
<Compile Include="Hiccup.cs">
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Examine\CustomDataService.cs" />
<Compile Include="data.cs" />
<Compile Include="DefaultMemberAvatarHandler.cs" />
@@ -278,7 +281,9 @@
<Content Include="usercontrols\ProjectEditor.ascx" />
<Content Include="usercontrols\ProjectFileUpload.ascx" />
<Content Include="usercontrols\ProjectForums.ascx" />
<Content Include="usercontrols\Signup.ascx" />
<Content Include="usercontrols\Signup.ascx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="usercontrols\SignupSimple.ascx" />
</ItemGroup>
<ItemGroup>
+4
View File
@@ -1,6 +1,10 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Signup.ascx.cs" Inherits="our.usercontrols.Signup" %>
<asp:panel ID="MemberExists" Visible="False" runat="server">
<p>There is already an account with this e-mail address! You can <a href="/member/login">login</a> or <a href="/member/forgot-password">reset your password</a>.</p>
</asp:panel>
<asp:panel ID="Panel1" runat="server" defaultbutton="bt_submit">
<div class="form simpleForm" id="registrationForm">
<fieldset>
+52 -21
View File
@@ -3,10 +3,16 @@ using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using our.Rest;
using umbraco;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.member;
namespace our.usercontrols {
public partial class Signup : System.Web.UI.UserControl {
namespace our.usercontrols
{
public partial class Signup : System.Web.UI.UserControl
{
public string Group { get; set; }
public string memberType { get; set; }
@@ -14,11 +20,15 @@ namespace our.usercontrols {
private Member m = umbraco.cms.businesslogic.member.Member.GetCurrentMember();
protected void Page_Load(object sender, EventArgs e) {
protected void Page_Load(object sender, EventArgs e)
{
//lazyloading the needed javascript for validation. (addded it to the master template as our ahah forms need it aswel)
//umbraco.library.RegisterJavaScriptFile("jquery.validation", "/scripts/jquery.validation.js");
if (!Page.IsPostBack && m != null) {
MemberExists.Visible = false;
if (!Page.IsPostBack && m != null)
{
tb_name.Text = m.Text;
tb_email.Text = m.Email;
@@ -30,7 +40,8 @@ namespace our.usercontrols {
//treshold and newsletter
if (m.getProperty("bugMeNot") != null) {
if (m.getProperty("bugMeNot") != null)
{
int c = 0;
int.TryParse(m.getProperty("bugMeNot").Value.ToString(), out c);
@@ -54,10 +65,12 @@ namespace our.usercontrols {
}
protected void createMember(object sender, EventArgs e) {
protected void createMember(object sender, EventArgs e)
{
//Member is already logged in, and we just need to save his new data...
if (m != null) {
if (m != null)
{
m.Text = tb_name.Text;
m.Email = tb_email.Text;
m.LoginName = tb_email.Text;
@@ -84,7 +97,7 @@ namespace our.usercontrols {
m.XmlGenerate(new System.Xml.XmlDocument());
m.Save();
//Refresh the member cache data
@@ -93,16 +106,28 @@ namespace our.usercontrols {
Response.Redirect(umbraco.library.NiceUrl(NextPage));
} else {
if (tb_email.Text != "") {
m = Member.GetMemberFromEmail(tb_email.Text);
if (m == null) {
}
else
{
if (tb_email.Text != "")
{
m = Member.GetMemberFromLoginName(tb_email.Text);
if (m == null)
{
MemberType mt = MemberType.GetByAlias(memberType);
m = Member.MakeNew(tb_name.Text, mt, new umbraco.BusinessLogic.User(0));
// Adding " Temp" is a hack - bizarrely, when you create a member using MakeNew and
// the name does not have a space in it (like: Ben) you'll get a YSOD saying the
// username already exists. However, create it with a space in it and everything is
// fine and dandy! So now we just force the last name to be "Temp" during creation
// and then update the member's name immediately after that... -SJ
m = Member.MakeNew(tb_name.Text + " Temp", mt, new User(0));
m.Text = tb_name.Text;
m.Email = tb_email.Text;
m.Password = tb_password.Text;
m.LoginName = tb_email.Text;
//Location
m.getProperty("location").Value = tb_location.Text;
m.getProperty("latitude").Value = tb_lat.Value;
@@ -113,32 +138,38 @@ namespace our.usercontrols {
m.getProperty("flickr").Value = tb_flickr.Text;
m.getProperty("company").Value = tb_company.Text;
m.getProperty("profileText").Value = tb_bio.Text;
//treshold + newsletter
m.getProperty("treshold").Value = tb_treshold.Text;
m.getProperty("bugMeNot").Value = cb_bugMeNot.Checked;
//Standard values
m.getProperty("reputationTotal").Value = 20;
m.getProperty("reputationCurrent").Value = 20;
m.getProperty("forumPosts").Value = 0;
if (!string.IsNullOrEmpty(Group)) {
if (!string.IsNullOrEmpty(Group))
{
MemberGroup mg = MemberGroup.GetByName(Group);
if (mg != null)
m.AddGroup(mg.Id);
}
//set a default avatar
Rest.BuddyIcon.SetAvatar(m.Id, "gravatar");
BuddyIcon.SetAvatar(m.Id, "gravatar");
m.Save();
m.XmlGenerate(new System.Xml.XmlDocument());
m.XmlGenerate(new XmlDocument());
Member.AddMemberToCache(m);
Response.Redirect(umbraco.library.NiceUrl(NextPage));
Response.Redirect(library.NiceUrl(NextPage));
}
else
{
MemberExists.Visible = true;
Panel1.Visible = false;
}
}
}
+9
View File
@@ -12,6 +12,15 @@ namespace our.usercontrols {
public partial class Signup {
/// <summary>
/// MemberExists control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel MemberExists;
/// <summary>
/// Panel1 control.
/// </summary>