UNPKG

jangular-cli

Version:

A powerful CLI tool for rapidly bootstrapping Angular 17 & Spring Boot (Java 21) applications with integrated security, services, and enterprise-ready best practices.

95 lines (87 loc) 5.62 kB
<!-- register.component.html --> <div class="min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8"> <div class="max-w-md w-full space-y-8"> <div> <h2 class="mt-6 text-center text-3xl font-extrabold text-gray-900"> Create a new account </h2> <p class="mt-2 text-center text-sm text-gray-600"> Or <a [routerLink]="['/auth/login']" class="font-medium text-indigo-600 hover:text-indigo-500"> sign in to your account </a> </p> </div> <form class="mt-8 space-y-6" [formGroup]="registerForm" (ngSubmit)="onSubmit()"> <div class="rounded-md shadow-sm -space-y-px"> <div> <label for="username" class="sr-only">Username</label> <input id="username" name="username" type="text" formControlName="username" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" placeholder="Username"> <div *ngIf="registerForm.get('username')?.invalid && registerForm.get('username')?.touched" class="text-red-500 text-xs mt-1"> Username is required </div> </div> <div class="flex -space-y-px"> <div class="w-1/2 mr-1"> <label for="firstName" class="sr-only">First Name</label> <input id="firstName" name="firstName" type="text" formControlName="firstName" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" placeholder="First Name"> </div> <div class="w-1/2 ml-1"> <label for="lastName" class="sr-only">Last Name</label> <input id="lastName" name="lastName" type="text" formControlName="lastName" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" placeholder="Last Name"> </div> </div> <div> <label for="email" class="sr-only">Email</label> <input id="email" name="email" type="email" formControlName="email" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" placeholder="Email"> <div *ngIf="registerForm.get('email')?.invalid && registerForm.get('email')?.touched" class="text-red-500 text-xs mt-1"> Please enter a valid email address </div> </div> <div> <label for="password" class="sr-only">Password</label> <input id="password" name="password" type="password" formControlName="password" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" placeholder="Password"> <div *ngIf="registerForm.get('password')?.invalid && registerForm.get('password')?.touched" class="text-red-500 text-xs mt-1"> Password must be at least 6 characters </div> </div> <div> <label for="passwordConfirm" class="sr-only">Confirm Password</label> <input id="passwordConfirm" name="passwordConfirm" type="password" formControlName="passwordConfirm" required class="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 focus:z-10 sm:text-sm" placeholder="Confirm Password"> <div *ngIf="registerForm.hasError('passwordMismatch') && registerForm.get('passwordConfirm')?.touched" class="text-red-500 text-xs mt-1"> Passwords do not match </div> </div> </div> <div *ngIf="errorMessage" class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative" role="alert"> <span class="block sm:inline">{{ errorMessage }}</span> </div> <div> <button type="submit" [disabled]="registerForm.invalid || isLoading" class="group relative w-full flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50"> <span *ngIf="isLoading" class="absolute left-0 inset-y-0 flex items-center pl-3"> <!-- Loading spinner --> <svg class="animate-spin h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> </svg> </span> Register </button> </div> </form> </div> </div>