<page-header model="navModel"></page-header>

<div class="page-container page-body">
	<div class="signup">
		<h3 class="p-b-1">Reset password</h3>

		<div ng-if="ldapEnabled || authProxyEnabled">
			You cannot reset password when LDAP or Auth Proxy authentication is enabled.
		</div>
		<div ng-if="disableLoginForm">
			You cannot reset password when login form is disabled.
		</div>
		<form name="sendResetForm" class="login-form gf-form-group" ng-show="mode === 'send'" ng-hide="ldapEnabled || authProxyEnabled || disableLoginForm">
			<div class="gf-form">
					<span class="gf-form-label width-7">User</span>
					<input type="text" name="username" class="gf-form-input max-width-14" required ng-model='formModel.userOrEmail' placeholder="email or username">
			</div>
			<div class="gf-form-button-row">
				<button type="submit" class="btn btn-primary" ng-click="sendResetEmail();" ng-disabled="!sendResetForm.$valid">
					Reset Password
				</button>
				<a href="login" class="btn btn-inverse">
					Back
				</a>

			</div>
		</form>
		<div ng-show="mode === 'email-sent'">
			An email with a reset link has been sent to the email address. <br>
			You should receive it shortly.
			<div class="p-t-1">
				<a href="login" class="btn btn-primary p-t-1">
					Login
				</a>
			</div>
		</div>
		<form name="resetForm" class="login-form gf-form-group" ng-show="mode === 'reset'">
			<div class="gf-form">
				<span class="gf-form-label width-9">New Password</span>
				<input type="password" name="NewPassword" class="gf-form-input max-width-14" required ng-minlength="4" ng-model='formModel.newPassword' placeholder="password" watch-change="formModel.newPassword = inputValue;">
			</div>
			<div class="gf-form">
				<span class="gf-form-label width-9">Confirm Password</span>
				<input type="password" name="ConfirmPassword" class="gf-form-input max-width-14" required ng-minlength="4" ng-model='formModel.confirmPassword' placeholder="confirm password">
			</div>
			<div class="signup__password-strength">
				<password-strength password="formModel.newPassword"></password-strength>
			</div>
			<div class="gf-form-button-row">
				<button type="submit" class="btn btn-primary" ng-click="submitReset();" ng-disabled="!resetForm.$valid">
					Reset Password
				</button>
			</div>
		</form>
	</div>
</div>
