Making the User Name be the Email Address
01-01-2008, 11:19 PM
|
Making the User Name be the Email Address
|
Posts: 116
|
I'm using an asp membership script that has a Registration Page with an Email Address field, User Name field, Password field and Password Confirmation field, etc.
I'd like to get help making it so the registrar has to put his Email Address as his User Name. So I'd like to make the User Name field the Email Address field and the Email Address field the Email Address Confirmation field.
Can you help me with this? The Registration page code is a little longer in length than this Forum allows, so I've attached it as a text file. Can you tell me if this is possible to make this change with this page code, and if so, how to do it, please?
thanks
|
|
|
|
01-02-2008, 02:08 AM
|
Re: Making the User Name be the Email Address
|
Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
|
This has to be something you got from another site. It's the usual ASP dog's breakfast that most people create.
Anyway, I can help you with part of this, but you're going to have to do some digging to find the other parts
Change this part:
Code:
<td width="150">Username:</td>
<td><input style="width: 100%;" type="Text" name="username" value="" size="40" maxlength="25" class="textbox" /></td>
To...
Code:
<td width="150">Confirm Email:</td>
<td><input style="width: 100%;" type="Text" name="Email_Confirm" value="" size="40" maxlength="75" class="textbox" /></td>
I bolded the parts I changed. The maxlength property has to be changed to accommodate a proper email address.
As far as how to validate it, you'd have to change the line I bolded below:
Code:
With Request
sNAME = APO(.Form("name"))
sEMAILCONFIRM = APO(.Form("Email_Confirm"))
Then you'd have to add some form of validation somewhere before the database insert queries. I suspect that it's something in the CHECK_INP() sub, but I don't know where it would be exactly since that sub isn't in your code (it's probably in one of the include files).
You'll also need to alter anywhere that the user logs in to incorporate checking for email instead of username.
But...all of this leads to a much deeper issue. The type of question that you're asking is one that involves multiple parts, and you hadn't even gotten as far as the first one. That usually implies that you've bitten off a lot more than you can chew. The fact that you're using a script that someone else supplied also implies that.
Whatever it is you're doing, you may want to scale back your expectations of yourself and the script and go easy on yourself.
|
|
|
|
01-02-2008, 02:20 PM
|
Re: Making the User Name be the Email Address
|
Posts: 116
|
Thank you
|
|
|
|
01-03-2008, 02:25 PM
|
Re: Making the User Name be the Email Address
|
Posts: 116
|
Thanks. I have some questions.
Is the validation for making sure that the fields match each other?
Or is validation for something else?
Thanks
|
|
|
|
01-03-2008, 04:06 PM
|
Re: Making the User Name be the Email Address
|
Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
|
Making sure the fields match each other.
if (your email field) = (your email confirmation) field.
|
|
|
|
01-03-2008, 06:14 PM
|
Re: Making the User Name be the Email Address
|
Posts: 116
|
Thanks for your reply/help.
There's a file in the script called validate.asp. Could you look it over and tell me if this is where this validation would take place and need to be modified?
Thanks again.
Code:
<!--#include file="app_config.asp"-->
<!--#include file="inc_api.asp"-->
<!--#include file="inc_header.asp"-->
<%Dim sSQL, sRS, sID, sNAME, sCHAR, sFOUND, URL_ERROR, USERNAME, PASSWORD, EMAIL, STATUS
sCHAR = APO(Request.QueryString("char"))
sID = APO(Request.QueryString("ID"))
IF IS_VALID_ID(sID) = True AND NOT (sID = "" OR IsNUll(sID)) THEN
SQL = "SELECT fldNAME, fldUSERNAME, fldPASSWORD, fldEMAIL, fldSTATUS FROM mms_tbl_user WHERE ID = " & sID & " AND fldCHAR ='" & sCHAR & "'"
Call OPEN_DB()
Set RS = Server.CreateObject("ADODB.Recordset")
RS.LockType = 1
RS.CursorType = 0
RS.Open SQL, MyConn
IF NOT RS.EOF THEN
sNAME = trim(RS("fldNAME"))
USERNAME = trim(RS("fldUSERNAME"))
PASSWORD = trim(RS("fldPASSWORD"))
EMAIL = trim(RS("fldEMAIL"))
STATUS = trim(RS("fldSTATUS"))
sFOUND = True
ELSE
sFOUND = False
END IF
RS.Close
Set RS = Nothing
IF sFOUND = True THEN
SELECT CASE Trim(STATUS)
CASE Trim(drpSTATUS(5)) ' Unpaid Account
SQL = "UPDATE mms_tbl_user SET fldVALID = 1 WHERE ID = " & sID
MyConn.Execute(SQL)
Call RETURN_VALUE(False)
Call APPEND_LOG(False, sID, "Your profile has been validated.", Trim(sysVAL(7)))
CASE Trim(drpSTATUS(1)), Trim(drpSTATUS(0)) ' Pending, Registered
SQL = "UPDATE mms_tbl_user SET fldVALID = 1, fldSTATUS = '" & Cstr(drpSTATUS(0)) & "' WHERE ID = " & sID
MyConn.Execute(SQL)
Call RETURN_VALUE(False)
Call APPEND_LOG(False, sID, "Your profile has been validated.", Trim(sysVAL(7)))
END SELECT
END IF
Call RETURN_VALUE(False)
Dim SaccountVALID
SaccountVALID = RETURN_TEMPLATES(False,"fldMSG12", False)
MyConn.Close
Set MyConn = Nothing
SaccountVALID = Replace(SaccountVALID,"%name%", sNAME)
SaccountVALID = Replace(SaccountVALID,"%username%", USERNAME)
SaccountVALID = Replace(SaccountVALID,"%password%", PASSWORD)
SaccountVALID = Replace(SaccountVALID,"%now%", Now())
Call SEND_EMAIL_OUT(SaccountVALID , "Your account has been activated", EMAIL, Trim(sysVAL(12)), "")
ELSE
sFOUND = False
URL_ERROR = "Invalid validation string, please make sure to use the entire URL."
END IF
%>
<table width="80%" align="center" cellpadding="2" cellspacing="0" border="1" bordercolor="WhiteSmoke">
<tr bgcolor="whiteSmoke">
<td>Validation</td>
</tr><tr>
<td>
<% IF sFOUND = True THEN %>
Thank you <%= sNAME %>,<br /><br />
Your profile has been successfully validated.<br />
<% ELSE %>
Sorry, we were unable to find a matching profile.<br />
<% END IF %>
<% IF NOT (URL_ERROR = "" OR IsNull(URL_ERROR)) THEN %>
<%=URL_ERROR%>
<% End If %>
<br /><br />
</td>
</tr></table>
<!--#include file="inc_footer.asp"-->
|
|
|
|
|
« Reply to Making the User Name be the Email Address
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|