thirdculture/werc/tpl/_tools/hash.tpl

35 lines
1.7 KiB
Smarty
Raw Permalink Normal View History

2024-11-11 14:52:00 -05:00
<h1>Password Hash Generator</h1>
<p>This tool is for generating password hashes to be used for your Third Culture user account.</p>
<form method="POST" action="" style="text-align: right; float: left;">
<fieldset class="log">
<label>Enter password: <input type="password" name="password" value="%($"post_arg_password%)"/></label><br>
<label>Verify password: <input type="password" name="verify_password" value="%($"post_arg_verify_password%)"/></label><br>
<input name="s" type="submit" value="Generate Hashes">
</fieldset>
</form>
<br style="clear:left">
% if(~ $REQUEST_METHOD POST) {
% if(~ $#post_arg_password 0 || ~ $#post_arg_verify_password 0) {
<div class="notify_errors">Error: Both password fields are required!</div>
% }
% if not if(! ~ $"post_arg_password $"post_arg_verify_password) {
<div class="notify_errors">Error: Passwords do not match!</div>
% }
% if not {
% fn sanitize_input { printf '%s' $1 | sed 's/[[:cntrl:]]//g' }
% clean_password=`{sanitize_input $"post_arg_password}
% mkpasswd_hash=`{printf '%s' $"clean_password | mkpasswd}
% htpasswd_hash=`{printf '%s' $"clean_password | htpasswd -n -b dummy - | sed 's/^dummy://'}
<h3>Generated Hashes:</h3>
<div class="copybox">
<code>
mkpasswd hash: <b>%(`{echo $mkpasswd_hash | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/''/\&quot;/g'}%)</b><br>
htpasswd hash: <b>%(`{echo $htpasswd_hash | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/''/\&quot;/g'}%)</b>
</code>
</div>
<small>Copy the output in the box above and send them to q. DM or over email (moridori@disroot.org).</small>
<br />
% }
% }