ist folgender Code sicher?
passwort.html
Code: Alles auswählen
<form action="function.change-password.php" method="post"
name="passwordchange_form" class="form-horizontal"
role="form" ID="passwordchange_form" >
<input type="hidden" name="userId" value="{$User.UserID}">
<div class="form-group">
<label for="current_password" class="col-sm-3 control-label">aktuelles Passwort</label>
<div class="col-sm-3">
<input type="password" class="form-control" placeholder="aktuelles Passwort"
name="current_password" id="current_password">
</div>
</div>
<div class="form-group">
<label for="new_password" class="col-sm-3 control-label">neues Passwort</label>
<div class="col-sm-3">
<input type="password" class="form-control" placeholder="neues Passwort"
name="new_password" id="new_password">
</div>
</div>
<div class="form-group">
<label for="confirmed_password" class="col-sm-3 control-label">neues Passwort wiederholen</label>
<div class="col-sm-3">
<input type="password" class="form-control" placeholder="Passwort wiederholen"
name="confirmed_password" id="confirmed_password" onkeydown=" if (event.keyCode === 13)
document.getElementById('submitbtn').click();">
</div>
</div>
<button class="btn btn-default" type="submit" id="submitbtn" style="margin-bottom: 15px;"
value="change-pwd" onclick="return changeformhash(this.form,
this.form.userID,
this.form.current_password,
this.form.new_password,
this.form.confirmed_password);">Dein Passwort jetzt ändern</button>
</form>
Das neue passwort wird kurz auf inhalt geprüft und dann via
Code: Alles auswählen
// Erstelle ein neues Feld für das gehashte Passwort.
var np = document.createElement("input");
var cp = document.createElement("input");
// Füge es dem Formular hinzu.
form.appendChild(cp);
cp.name = "cp";
cp.type = "hidden";
cp.value = hex_sha512(current_password.value);
// Füge es dem Formular hinzu.
form.appendChild(np);
np.name = "np";
np.type = "hidden";
np.value = hex_sha512(new_password.value);
// Sorge dafür, dass kein Text-Passwort geschickt wird.
current_password.value = "";
new_password.value = "";
confirmed_password.value = "";
// Reiche das Formular ein.
form.submit();
return true;
gehashed, und gesaltet und als hidden feld per POST übergeben.
mit geht es vor allem um die übergabe als hidden feld. Ist das sicher? kennt ihr eine sichere Methode??
Danke und viele Grüße!