Skip to content

Instantly share code, notes, and snippets.

@Mirch Mirch/Register.cshtml
Last active Sep 30, 2018

What would you like to do?
@model RandomPassword.Models.UserRegisterModel
ViewData["Title"] = "Register";
<hr />
<div class="row">
<div class="col-md-4">
<form asp-action="Register">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="Username" class="control-label"></label>
<input asp-for="Username" class="form-control" />
<span asp-validation-for="Username" class="text-danger"></span>
<div class="form-group">
<label asp-for="Password" class="control-label"></label>
<input readonly="readonly" id="passwordInput" asp-for="Password" class="form-control" /> <!-- mark as readonly and add id -->
<button onclick="generatePassword()">Generate password</button> <!-- create button that triggers the generatePassword() function-->
<span asp-validation-for="Password" class="text-danger"></span>
<div class="form-group">
<input type="submit" value="Create" class="btn btn-default" />
function generatePassword() {
function (data) {
document.getElementById("passwordInput").value = data;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.