forgot_password.naml

<macro name="forgot_password_page" requires="servlet">
	<n.set_var name="error" value="[n.false/]" />
	<n.if.is_submitted_form>
		<then.if.exists_user_for_email.email_field.value>
			<then>
				<n.set_local_user.get_user_from_email email="[n.email_field.value/]" />
				<n.if.local_user.is_registered>
					<then>
						<n.local_user.send_password_mail/>
						<n.password_mail_sent_page/>
					</then>
					<else.unregistered_user_forgot_password_page/>
				</n.if.local_user.is_registered>
				<n.exit/>
			</then>
			<else.set_var name="error" value="[n.true/]" />
		</then.if.exists_user_for_email.email_field.value>
	</n.if.is_submitted_form>
	<n.html>
		<head>
			<meta name="robots" content="noindex,nofollow"/>
			<n.title.><t>Forgot Password?</t></n.title.>
			<style type="text/css">
				div.field-title { margin-top: 0; }
			</style>
		</head>
		<body>
			<h1><t>Forgot Password?</t></h1>

			<p><t>Please enter the email address you used to register and click on "Submit".
				We will email you a link to reset your password.</t></p>
			<p>
				<n.if.var name="error">
					<then.format_error message="[t]No registered user found with this email.[/t]" prompt="[t]Please enter a correct email address and try again.[/t]" />
				</n.if.var>
				<n.form.>
					<div class="second-font field-title"><t>Email</t></div>
					<n.email_field.input size="45" />
					<input type="submit" value="[t]Submit[/t]" />
				</n.form.>
			</p>
			<n.show_email_warning/>
		</body>
	</n.html>
</macro>

<macro name="send_password_mail" requires="user" unindent="true">
	<n.set_local_user.this_user />
	<n.block.>
		<n.new_email.>
			<n.send>
				<to.local_user.user_email/>
				<subject><t>Reset your password / <t.location.root_node.subject/></t></subject>
				<text_part>
					<t>Dear user,</t>

					<t>We received a request to reset your password in <t.location.root_node.subject/>.</t>

					<t>If you want to reset your password, click on the link below (or copy and paste the URL into your browser):</t>
					<n.base_url/><n.local_user.reset_password_path email="[n.local_user.user_email/]" q="[n.local_user.resetcode/]" />

					<t>If you don't want to reset your password, please ignore this message. Your password will not be reset.</t>

					<n.root_node.subject/>
					<n.base_url/>/
				</text_part>
				<aol_part>
					<t>Dear user,</t>

					<t>We received a request to reset your password in <t.location.root_node.subject/>.</t>

					<t>If you want to reset your password, click on the link below (or copy and paste the URL into your browser):</t>
					<n.base_url/><n.local_user.reset_password_path email="[n.local_user.user_email/]" q="[n.local_user.resetcode/]" />

					<t>If you don't want to reset your password, please ignore this message. Your password will not be reset.</t>

					<n.root_node.subject/>
					<n.base_url/>/
				</aol_part>
			</n.send>
		</n.new_email.>
	</n.block.>
</macro>

<macro name="password_mail_sent_page" requires="servlet">
	<n.html>
		<head>
			<n.title.><t>Password Reset Sent</t></n.title.>
		</head>
		<body>
			<h1><t>Password Reset Sent</t></h1>
			<p>
				<t>We have sent you a link to reset your password. Please check your email now.
					If you don't receive the instructions in a few minutes, check your spam folder
					or try to resend the request.</t>
			</p>
		</body>
	</n.html>
</macro>

<macro name="unregistered_user_forgot_password_page" requires="servlet">
	<n.html>
		<head>
			<n.title.><t>Forgot Password?</t></n.title.>
		</head>
		<body>
			<h1><t>Forgot Password?</t></h1>

			<p>
				<t>There is an unregistered user account associated with the email address <t.email.bold.email_field.value/>.</t>
				<t>If this email address is yours, you should <n.register_link.>register</n.register_link.> using this same address.
				After registration, you will own this user account.</t>
			</p>
		</body>
	</n.html>
</macro>

<macro name="forgot_password_path">
	<n.encode_url.>
		/template/NamlServlet.jtp?macro=forgot_password_page
	</n.encode_url.>
</macro>