Link to "User Sign Up Email Password feature"

Message board links from 2010 as taken from the Internet Wayback Machine pages.
Post Reply
User avatar
admin
Site Admin
Posts: 159
Joined: Mon Aug 26, 2013 3:47 pm

Re: Link to "User Sign Up Email Password feature"

Post by admin »

09-03-2009 3:46 AM
poolie
Top 10 Contributor
Joined on 08-20-2009
Posts 45

User Sign Up Email Password feature
Reply Contact

I want to use the email feature but I do not what my new uses to be emailed a temp password. I can only get this option if I turn off the email function. Is there anyway to just turn of the email random password feature?
Filed under: email, password, sign up
09-03-2009 8:04 AM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 295

Re: User Sign Up Email Password feature
Reply Contact

You edit the userSignUp.asp file like this, it should work:

'Handle the case where server-side email is not available.
if not SERVER_EMAIL_ENABLED then


'Handle the case where server-side email is not available.
if true then


and here:

<% if not SERVER_EMAIL_ENABLED then %>
<tr valign="middle">
<td><strong>Password:</strong></td>
<td><input type="password" name="password1" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<tr valign="middle">
<td><strong>Confirm password:</strong></td>
<td><input type="password" name="password2" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<% end if %>
</table>
<% if SERVER_EMAIL_ENABLED then %>
<p>If you don't receive your email within a few hours, please contact the Administrator at <a href="mailto:<% = ADMIN_EMAIL %>"><% = ADMIN_EMAIL %></a> for assistance.</p>
<% end if %>

<% if true then %>
<tr valign="middle">
<td><strong>Password:</strong></td>
<td><input type="password" name="password1" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<tr valign="middle">
<td><strong>Confirm password:</strong></td>
<td><input type="password" name="password2" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<% end if %>
</table>
<% if false then %>
<p>If you don't receive your email within a few hours, please contact the Administrator at <a href="mailto:<% = ADMIN_EMAIL %>"><% = ADMIN_EMAIL %></a> for assistance.</p>
<% end if %>
09-03-2009 11:13 AM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 201

Re: User Sign Up Email Password feature
Reply Contact

will this allow someone like me on a free host that doesnt allow email to use this option?
09-03-2009 11:32 AM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 295

Re: User Sign Up Email Password feature
Reply Contact

You should already have that. As it is by default, if you have SERVER_EMAIL_ENABLED set to false users will be prompted to choose a password on sign up. If it's set to true, it will just ask for an email address and email a generated password to them.

In his case he has emailing capability (SERVER_EMAIL_ENABLED = true) but he wants to let user's sign up with their own password instead of getting a generated in their email.
09-03-2009 11:34 PM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 201

Re: User Sign Up Email Password feature
Reply Contact

I thought this was to work with ROBs script for forgot password
09-05-2009 5:07 PM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 201

Re: User Sign Up Email Password feature
Reply Contact

now that I have email server working with gmail, I want to get this one in.

Im not really sure what you are getting at on how to edit it.

am I replacing this:

'Handle the case where server-side email is not available.
if not SERVER_EMAIL_ENABLED then

with this:


'Handle the case where server-side email is not available.
if true then

and this:



<% if not SERVER_EMAIL_ENABLED then %>
<tr valign="middle">
<td><strong>Password:</strong></td>
<td><input type="password" name="password1" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<tr valign="middle">
<td><strong>Confirm password:</strong></td>
<td><input type="password" name="password2" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<% end if %>
</table>
<% if SERVER_EMAIL_ENABLED then %>
<p>If you don't receive your email within a few hours, please contact the Administrator at <a href="mailto:<% = ADMIN_EMAIL %>"><% = ADMIN_EMAIL %></a> for assistance.</p>
<% end if %>

with this:
<% if true then %>
<tr valign="middle">
<td><strong>Password:</strong></td>
<td><input type="password" name="password1" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<tr valign="middle">
<td><strong>Confirm password:</strong></td>
<td><input type="password" name="password2" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<% end if %>
</table>
<% if false then %>
<p>If you don't receive your email within a few hours, please contact the Administrator at <a href="mailto:<% = ADMIN_EMAIL %>"><% = ADMIN_EMAIL %></a> for assistance.</p>
<% end if %>
09-05-2009 10:14 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 295

Re: User Sign Up Email Password feature
Reply Contact

Here's the whole, edited file:

<%@ LANGUAGE="VBScript" %>
<!-- #include file="includes/config.asp" --><!-- #include file="includes/common.asp" --><% PageSubTitle = "User Sign Up" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><% = PAGE_TITLE & ": " & PageSubTitle %></title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="styles/common.css" />
<link rel="stylesheet" type="text/css" href="styles/print.css" media="print" />
<script type="text/javascript" src="scripts/scriptLib.js"></script>
<script type="text/javascript" src="scripts/common.js"></script>
</head>
<body>
<!-- #include file="includes/header.asp" -->
<!-- #include file="includes/siteMenu.asp" -->
<div id="contentSection">
<!-- #include file="includes/email.asp" -->
<!-- #include file="includes/encryption.asp" -->
<!-- #include file="includes/form.asp" -->
<!-- #include file="includes/passwords.asp" -->
<table id="mainWrapper" border="0" cellpadding="0" cellspacing="0"><tr><td>
<% 'Open the database.
call OpenDB()

'If there is form data, process it.
dim code, username, email, password1, password2, badChar
dim salt, password
dim sql, rs
if Request.ServerVariables("Content_Length") > 0 and not IsCancelRequest() then
code = Trim(Request.Form("code"))
username = Trim(Request.Form("username"))
email = Trim(Request.Form("email"))
badChar = CheckUsername(username)

'Check the invitaion code field, if used.
if SIGN_UP_INVITATION_CODE <> "" then
if code = "" then
FormFieldErrors.Add "code", "The invitation code is required."
elseif code <> SIGN_UP_INVITATION_CODE then
FormFieldErrors.Add "code", "The invitation code is incorrect."
end if
end if

'Check the username field.
if username = "" then
FormFieldErrors.Add "username", "A username is required."
elseif badChar <> "" then
FormFieldErrors.Add "username", "Usernames may not contain a '" & Server.HtmlEncode(badChar) & "' character."
elseif Len(username) > USERNAME_MAX_LEN then
FormFieldErrors.Add "username", "Usernames may not exceed " & USERNAME_MAX_LEN & " characters."
else
sql = "SELECT * FROM Users WHERE Username = '" & SqlEscape(username) & "'"
set rs = DbConn.Execute(sql)
if not (rs.EOF and rs.BOF) then
FormFieldErrors.Add "username", "Username '" & username & "' is already taken, try another."
end if
end if

'Check the email field.
if email = "" then
FormFieldErrors.Add "email", "An email address is required."
elseif not IsValidEmailAddress(email) then
FormFieldErrors.Add "email", "'" & email & "' does not appear to be a valid email address."
end if

'Handle the case where server-side email is not available.
if true then

'Check the password fields.
password1 = Trim(Request.Form("password1"))
password2 = Trim(Request.Form("password2"))
if password1 = "" or password2 = "" then
FormFieldErrors.Add "password1", "A password is required."
FormFieldErrors.Add "password2", "You must enter your password twice, where indicated."
elseif password1 <> password2 then
FormFieldErrors.Add "password1", "Passwords fields do not match."
FormFieldErrors.Add "password2", ""
elseif Len(password1) < PASSWORD_MIN_LEN then
FormFieldErrors.Add "password1", "Password must be at least " & PASSWORD_MIN_LEN & " characters long."
end if
end if

'If the input data is good, add the user.
if FormFieldErrors.Count = 0 then
if true then
password = CreatePassword()
else
password = password1
end if
salt = CreateSalt()
sql = "INSERT INTO Users" _
& " (Username, EmailAddress, Salt, [Password])" _
& " VALUES('" & SqlEscape(username) & "'," _
& " '" & Encrypt(email) & "'," _
& " '" & salt & "'," _
& " '" & Hash(salt & password) & "')"
call DbConn.Execute(sql)

'If enabled, send the emails.
if false then

'Send emails, one to the user and one to the administrator.
dim mailSubj, mailMsg, errMsg
mailSubj = "Football Pool Sign Up"
mailMsg = "Thanks for signing up. You may login at " & POOL_URL & " with the username and password below." & vbCrLf _
& vbCrLf _
& "Username: " & username & vbCrLf _
& "Password: " & password & vbCrLf _
& vbCrLf
errMsg = SendMail(email, mailSubj, mailMsg)
if errMsg = "" then
call DisplaySuccessMessage("Username '" & username & "' added. Please check your email for the password.")
mailMsg = "A new user has signed up for the pool." & vbCrLf _
& vbCrLf _
& "Username: " & username & vbCrLf _
& "Email: " & email & vbCrLf _
& vbCrLf
errMsg = SendMail(ADMIN_EMAIL, mailSubj, mailMsg)
username = ""
email = ""
else
call DisplayErrorMessage("Email send failed with '" & errMsg & "' Please contact <a href=""mailto:" & ADMIN_EMAIL & """>" & ADMIN_EMAIL & "</a> for help.")
sql = "DELETE FROM Users WHERE Username = '" & SqlEscape(username) & "'"
call DbConn.Execute(sql)
end if

'Otherwise, show a message indicating the user may now log in.
else
call DisplaySuccessMessage("Username '" & username & "' added. You may now <a href=""userLogin.asp"">login</a>.")
end if

end if

'Show form field errors, if any.
if FormFieldErrors.Count > 0 then
call DisplayFormFieldErrorsMessage("Sign up failed, see below.")
end if

end if %>
<form action="<% = Request.ServerVariables("SCRIPT_NAME") %>" method="post">
<table class="main fixed" border="0" cellpadding="0" cellspacing="0">
<tr class="header bottomEdge">
<th align="left">User Sign Up</th>
</tr>
<tr>
<td class="freeForm">
<p>To sign up, enter
<% if SIGN_UP_INVITATION_CODE <> "" then %>
the invitation code,
<% end if
if false then %>
your name and email address and hit the <code>Submit</code> button.
An account will be created for you using a randomly generated password which will be sent to your email address.</p>
<% else %>
your name, email address and a password (twice, for confirmation) hit the <code>Submit</code> button.
<% end if %>
<table class="form" border="0" cellpadding="0" cellspacing="0">
<% if SIGN_UP_INVITATION_CODE <> "" then %>
<tr valign="middle">
<td><strong>Invitation code:</strong></td>
<td><input type="password" name="code" value="" class="<% = StyleFormField("", "code") %>" /></td>
</tr>
<% end if %>
<tr valign="middle">
<td><strong>Username:</strong></td>
<td><input type="text" name="username" value="<% = username %>" class="<% = StyleFormField("", "username") %>" /></td>
</tr>
<tr valign="middle">
<td><strong>Email address:</strong></td>
<td><input type="text" name="email" value="<% = email %>" class="<% = StyleFormField("", "email") %>" /></td>
</tr>
<% if true then %>
<tr valign="middle">
<td><strong>Password:</strong></td>
<td><input type="password" name="password1" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<tr valign="middle">
<td><strong>Confirm password:</strong></td>
<td><input type="password" name="password2" value="" class="<% = StyleFormField("", "password1") %>" /></td>
</tr>
<% end if %>
</table>
<% if false then %>
<p>If you don't receive your email within a few hours, please contact the Administrator at <a href="mailto:<% = ADMIN_EMAIL %>"><% = ADMIN_EMAIL %></a> for assistance.</p>
<% end if %>
</td>
</tr>
</table>
<p><input type="submit" name="submit" value="Submit" class="button" />&nbsp;<input type="submit" name="submit" value="Cancel" class="button" /></p>
</form>
</td></tr></table>
</div>
<!-- #include file="includes/footer.asp" -->
</body>
</html>

09-06-2009 8:12 AM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 201

Re: User Sign Up Email Password feature
Reply Contact



Active Server Pages error 'ASP 0126'

Include file not found

/w/a/v/waverly/userSignUp.asp, line 12

The include file 'includes/custom.asp' was not found.
09-06-2009 10:18 AM In reply to
Randy
Top 50 Contributor
Joined on 08-25-2009
Posts 3

Re: User Sign Up Email Password feature
Reply Contact

I also tried this new ASP but could not make it work until I deleted this

<!-- #include file="includes/custom.asp" -->

and also changed

'If the input data is good, add the user.
if FormFieldErrors.Count = 0 then
if SERVER_EMAIL_ENABLED then

to

'If the input data is good, add the user.
if FormFieldErrors.Count = 0 then
if not SERVER_EMAIL_ENABLED then

It seems to work as expected now.
09-06-2009 10:29 AM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 201

Re: User Sign Up Email Password feature
Reply Contact

mine works fine once I deleted

<!-- #include file="includes/custom.asp" -->



did not need to change the other stuff
09-06-2009 2:01 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 295

Re: User Sign Up Email Password feature
Reply Contact

My bad, I've removed it from the post.
09-06-2009 6:43 PM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 201

Re: User Sign Up Email Password feature
Reply Contact

ok so i copied your new code, and now it doesnt email the initial signup info to the new user, or email the admin to tell him that a new user signed up.

email is working, because the forgot password option from Rob is still emailing fine



the user signs up successfully, and works, just no emails for sosme reason
09-06-2009 10:57 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 295

Re: User Sign Up Email Password feature
Reply Contact

That's expected, the way it's coded is kind of all or nothing, If you use email, the user get's a random password emailed to them. Otherwise, they sign up with their own password and can then login, no emails sent.


09-07-2009 4:40 AM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 201

Re: User Sign Up Email Password feature
Reply Contact
ok, works for me. thanks
09-07-2009 6:50 AM In reply to
poolie
Top 10 Contributor
Joined on 08-20-2009
Posts 45

Re: User Sign Up Email Password feature
Reply Contact

Thanks for the help Mike.Your suggestions worked great.

Drizz, how did you get gmail to work? what port did you use?

you needed ssl right?
Filed under: email, ssl email, gmail

Page 1 of 2 (16 items) 1 2 Next >
User avatar
admin
Site Admin
Posts: 159
Joined: Mon Aug 26, 2013 3:47 pm

Re: Link to "User Sign Up Email Password feature"

Post by admin »

09-07-2009 7:40 AM In reply to
drizzt09
Top 10 Contributor
Joined on 08-22-2009
Ontario Canada
Posts 201

Re: User Sign Up Email Password feature
Reply Contact

see here [click=web.archive.org/web/20100102063317/http://brainjar.com/community/forums/t/60.aspx]web.archive.org/web/20100102063317/http://brainjar.com/community/forums/t/60.aspx[/click]

Page 2 of 2 (16 items) < Previous 1 2
Post Reply