Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

add account details and fix login redirect on emp #659

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions www/change_password.psp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,25 @@ import gc
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Qiime</title>
<%
portal_type = 'qiime'
if 'portal_type' in form:
portal_type = form['portal_type']
if portal_type == 'emp':
req.write('<title>Earth Microbiome Project</title>')
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is portal_type not in form if it's the QIIME portal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to have to change call the qiime links that worked already,
so I just added it to EMP, i can change it, or use the 'sess' for these
pages.

On Fri, Mar 28, 2014 at 11:24 AM, adamrp [email protected] wrote:

In www/change_password.psp:

@@ -19,10 +19,22 @@ import gc

-<title>Qiime</title> +<% +if 'portal_type' in form: - req.write('<title>EMP</title>' ) +else:

Why is portal_type not in form if it's the QIIME portal?

Reply to this email directly or view it on GitHubhttps://github.com//pull/659/files#r11076052
.

req.write('<title>Qiime</title>')
#END INDENT
%>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="style/qiime.css" type="text/css">
<%
if portal_type == 'emp':
req.write('<link rel="stylesheet" href="style/emp.css" type="text/css">')
else:
req.write('<link rel="stylesheet" href="style/qiime.css" type="text/css">')
#END INDENT
%>
<script type="text/javascript" src="./js/qiime.js"></script>
<script type="text/javascript" src="./js/jquery_validate/lib/jquery.js"></script>
<script type="text/javascript" src="./js/jquery_validate/lib/jquery.metadata.js"></script>
Expand Down Expand Up @@ -144,6 +159,7 @@ if form.has_key('update_acct') and form.has_key('new_act_code'):
<tr><td>Re-Type Password:</td><td><input type="password" id="new_password_again" name="new_password_again" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Change Password"></tr>
</table>
<input type="hidden" name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
else:
Expand Down Expand Up @@ -177,6 +193,7 @@ elif form.has_key('update_username') and form.has_key('new_act_code'):
<tr><td>Re-Type Password:</td><td><input type="password" id="new_password_again" name="new_password_again" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Change Password" /></tr>
</table>
<input type="hidden" name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
else:
Expand All @@ -196,7 +213,10 @@ elif form.has_key('username'):
if good_password:
updated_data = data_access.updateWebAppUserPwd( form["username"], form["new_password"] )
req.write('<p>Your password has been updated!</p>')
req.write('<input type="button" onclick="send_me_home.submit();" value="Log In" \>')
if portal_type == 'emp':
req.write('<form action="/emp/index.psp"><button type="submit">Log In</button></form>')
else:
req.write('<input type="button" onclick="send_me_home.submit();" value="Log In" \>')
else:
#req.write('<div style="color:red;"><p><b>New Password Invalid!</b> Your password must contain at least 2 of following and have a length greater than 6 characters:</p><ul><li>non-alphanumeric characters </li><li> upper-case alphanumeric characters </li><li> lower-case alphanumeric characters </li><li> numbers </li></ul><p>For Example: "Password","password1" or "password*"</p></div>')
req.write('<div style="color:red;"><p><b>New Password Invalid! Your password must be 6 or more characters.</b></p></div>')
Expand All @@ -209,6 +229,7 @@ elif form.has_key('username'):
<tr><td>Re-Type Password:</td><td><input type="password" id="new_password_again" name="new_password_again" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Change Password" /></tr>
</table>
<input type="hidden" name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
#
Expand All @@ -224,6 +245,7 @@ elif form.has_key('username'):
<tr><td>Re-Type Password:</td><td><input type="password" id="new_password_again" name="new_password_again" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Change Password" /></tr>
</table>
<input type="hidden" name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
#
Expand All @@ -239,6 +261,7 @@ else:
<tr><td>Re-Type Password:</td><td><input type="password" id="new_password_again" name="new_password_again" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Change Password" /></tr>
</table>
<input type="hidden" name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
#
Expand Down
12 changes: 10 additions & 2 deletions www/emp/index.psp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ locale.setlocale(locale.LC_ALL, 'en_US')
data_access = data_access_factory(ServerConfig.data_access_type)
sess = Session.Session(req)
sess['portal_type'] = 'emp'
sess['stylesheet'] = 'style/emp.css'
sess.save()

# Get the general statistics
Expand Down Expand Up @@ -136,7 +137,6 @@ plots['country'] = 'By Location'
<title>Earth Microbiome Project - Metadata Portal</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link rel="stylesheet" href="/qiime/style/style.css" type="text/css">
<link rel="stylesheet" href="/qiime/style/emp.css" type="text/css">
<link class="include" rel="stylesheet" type="text/css" href="/qiime/js/jqChartJQueryPlugin_3_0_0_0/css/jquery.jqChart.css" />

Expand Down Expand Up @@ -200,7 +200,7 @@ if form.has_key('username'):
sess.set_timeout(604800)
sess.save()

req.write('''<form action="http://www.microbio.me/qiime/index.psp" method="post" name="login_form" id="login_form">
req.write('''<form action="/qiime/index.psp" method="post" name="login_form" id="login_form">
<input type="hidden" name="page" value="./select_study.psp">
<input type="hidden" name="portal_type" value="emp">
<input type="hidden" name="username" value="%s">
Expand Down Expand Up @@ -242,6 +242,14 @@ if form.has_key('username'):

<br/>

<table>
<tr>
<td><a href="/qiime/register_user.psp?portal_type=emp">Create Account</a></td>
<td> | </td>
<td><a href="/qiime/forgot_password.psp?portal_type=emp">Reset Password</a></td>
<td> | </td>
<td><a href="/qiime/change_password.psp?portal_type=emp">Change Password</a></td>
</table>



Expand Down
26 changes: 23 additions & 3 deletions www/forgot_password.psp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,25 @@ from send_mail_from_server import process_and_send_email
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Qiime</title>
<%
portal_type = 'qiime'
if 'portal_type' in form:
portal_type = form['portal_type']
if portal_type == 'emp':
req.write('<title>Earth Microbiome Project</title>')
else:
req.write('<title>Qiime</title>')
#END INDENT
%>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="style/qiime.css" type="text/css">
<%
if portal_type == 'emp':
req.write('<link rel="stylesheet" href="style/emp.css" type="text/css">')
else:
req.write('<link rel="stylesheet" href="style/qiime.css" type="text/css">')
#END INDENT
%>
<script type="text/javascript" src="./js/qiime.js"></script>
<script type="text/javascript" src="./js/jquery_validate/lib/jquery.js"></script>
<script type="text/javascript" src="./js/jquery_validate/lib/jquery.metadata.js"></script>
Expand Down Expand Up @@ -135,7 +150,10 @@ if form.has_key('username'):
'QIIME account', \
'Acct: %s\n\nPlease click on the link below to change your QIIME password:\n\nhttp://microbio.me/qiime/change_password.psp?update_acct=%s;new_act_code=%s' % (form['username'],form['username'],new_act_code))
req.write('<p>You will receive an email shortly regarding your account.</p>')
req.write('<input type="button" onclick="send_me_home.submit();" value="Log In" \>')
if portal_type == 'emp':
req.write('<form action="/emp/index.psp"><button type="submit">Log In</button></form>')
else:
req.write('<input type="button" onclick="send_me_home.submit();" value="Log In" \>')
else:
# if username is invalid let the user know
req.write('<p style="color:red;">This username does not exist!</p>')
Expand All @@ -145,6 +163,7 @@ if form.has_key('username'):
<tr><td>Username (email):</td><td><input type="text" id="username" name="username" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Send E-mail" /></tr>
</table>
<input type='hidden' name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
# display default page if this is not a form submission load
Expand All @@ -155,6 +174,7 @@ else:
<tr><td>Username (email):</td><td><input type="text" id="username" name="username" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Send E-mail" /></tr>
</table>
<input type='hidden' name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
#
Expand Down
6 changes: 3 additions & 3 deletions www/index.psp
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ else:

<table>
<tr>
<td><a href="./register_user.psp">Create Account</a></td>
<td><a href="./register_user.psp?portal_type='qiime'">Create Account</a></td>
<td> | </td>
<td><a href="./forgot_password.psp">Reset Password</a></td>
<td><a href="./forgot_password.psp?portal_type='qiime'">Reset Password</a></td>
<td> | </td>
<td><a href="./change_password.psp">Change Password</a></td>
<td><a href="./change_password.psp?portal_tpye='qiime'">Change Password</a></td>
</table>

<br/>
Expand Down
23 changes: 21 additions & 2 deletions www/register_user.psp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,25 @@ from send_mail_from_server import process_and_send_email
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Qiime</title>
<%
portal_type = 'qiime'
if 'portal_type' in form:
portal_type = form['portal_type']
if portal_type == 'emp':
req.write('<title>Earth Mircrobiome Project</title>')
else:
req.write('<title>Qiime</title>')
#END INDENT
%>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="style/qiime.css" type="text/css">
<%
if portal_type == 'emp':
req.write('<link rel="stylesheet" href="style/emp.css" type="text/css">')
else:
req.write('<link rel="stylesheet" href="style/qiime.css" type="text/css">')
#END INDENT
%>
<script type="text/javascript" src="./js/qiime.js"></script>
<script type="text/javascript" src="./js/jquery_validate/lib/jquery.js"></script>
<script type="text/javascript" src="./js/jquery_validate/lib/jquery.metadata.js"></script>
Expand Down Expand Up @@ -166,6 +181,7 @@ if form.has_key('username'):
<tr><td>Re-Type Password:</td><td><input type="password" id="password_again" name="password_again" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Create User" /></tr>
</table>
<input type='hidden' name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
elif available and not good_password:
Expand All @@ -181,6 +197,7 @@ if form.has_key('username'):
<tr><td>Re-Type Password:</td><td><input type="password" id="password_again" name="password_again" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Create User" /></tr>
</table>
<input type='hidden' name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
else:
Expand All @@ -194,6 +211,7 @@ if form.has_key('username'):
<tr><td>Re-Type Password:</td><td><input type="password" id="password_again" name="password_again" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Create User" /></tr>
</table>
<input type='hidden' name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
else:
Expand All @@ -206,6 +224,7 @@ else:
<tr><td>Re-Type Password:</td><td><input type="password" id="password_again" name="password_again" /></td></tr>
<tr><td colspan="2"><input type="submit" value="Create User" /></tr>
</table>
<input type='hidden' name='portal_type' id='portal_type' value="<%=portal_type%>"/>
</form>
<%
#
Expand Down